| 
														
															@@ -190,6 +190,10 @@ public class YbService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public ResultVo returnGoodsItem(SelinfoReturn selinfoReturn) { 
														 | 
														
														 | 
														
															     public ResultVo returnGoodsItem(SelinfoReturn selinfoReturn) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         ResultVo response = null; 
														 | 
														
														 | 
														
															         ResultVo response = null; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         List<DrugTracCodg> drugTracCodgList = selinfoReturn.getDrugtracinfo(); 
														 | 
														
														 | 
														
															         List<DrugTracCodg> drugTracCodgList = selinfoReturn.getDrugtracinfo(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(drugTracCodgList == null || drugTracCodgList.size() == 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            response = new ResultVo(-1, "追溯码不能为空"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return response; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															          
														 | 
														
														 | 
														
															          
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 记录关联字段信息(用于关联退药记录) 
														 | 
														
														 | 
														
															         // 记录关联字段信息(用于关联退药记录) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         // 这些字段用于后续查询退药记录,确保医保记录与退药记录的一一对应 
														 | 
														
														 | 
														
															         // 这些字段用于后续查询退药记录,确保医保记录与退药记录的一一对应 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -231,11 +235,27 @@ public class YbService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } else { 
														 | 
														
														 | 
														
															         } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             log.warn("退药操作没有追溯码信息,继续处理"); 
														 | 
														
														 | 
														
															             log.warn("退药操作没有追溯码信息,继续处理"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }*/ 
														 | 
														
														 | 
														
															         }*/ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-         
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<SelinfoSold> selinfoSoldList = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                selinfoSoldMapper.getSelinfoSoldList(selinfoReturn.getPatientId(), selinfoReturn.getTimes(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        selinfoReturn.getOrderNo(), selinfoReturn.getChargeItemCode(), selinfoReturn.getRealNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(selinfoSoldList == null || selinfoSoldList.size() == 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            response = new ResultVo(-1, "关联追溯码上传失败"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return response; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        SelinfoSold selinfoSold = selinfoSoldList.get(0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         selinfoReturn.setSelRetnCnt(drugTracCodgList != null ? drugTracCodgList.size() : 0); 
														 | 
														
														 | 
														
															         selinfoReturn.setSelRetnCnt(drugTracCodgList != null ? drugTracCodgList.size() : 0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); 
														 | 
														
														 | 
														
															         String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setMedListCodg(selinfoSold.getMedListCodg()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         selinfoReturn.setSelRetnTime(now); 
														 | 
														
														 | 
														
															         selinfoReturn.setSelRetnTime(now); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        selinfoReturn.setMdtrtSn("MDTRT_ID"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setMdtrtSn(selinfoSold.getMdtrtSn()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setFixmedinsBchno(selinfoSold.getFixmedinsBchno()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setManuLotnum(selinfoSold.getManuLotnum()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setManuDate(selinfoSold.getManuDate()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setRxFlag(selinfoSold.getRxFlag()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        selinfoReturn.setTrdnFlag(selinfoSold.getTrdnFlag()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															         String realUrl = siInventoryServiceUrl + "/returnGoodsItem"; 
														 | 
														
														 | 
														
															         String realUrl = siInventoryServiceUrl + "/returnGoodsItem"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         try { 
														 | 
														
														 | 
														
															         try { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -263,4 +283,44 @@ public class YbService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public ResultVo getGoods(SelinfoSold selinfoSold) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ResultVo response = null; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List<SelinfoSold> selinfoSoldList = 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                selinfoSoldMapper.getSelinfoSoldList(selinfoSold.getPatientId(), selinfoSold.getTimes(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        selinfoSold.getOrderNo(), selinfoSold.getChargeItemCode(), selinfoSold.getRealNo()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(selinfoSoldList == null || selinfoSoldList.size() == 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            response = new ResultVo(-1, "关联追溯码上传失败"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return response; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        SelinfoSold sold = selinfoSoldList.get(0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Map<String, String> param = new HashMap<>(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        param.put("med_list_codg", sold.getMedListCodg()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String realUrl = siInventoryServiceUrl + "/selectSalesGoodsItem"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            String jsonString = JSONObject.toJSONString(param, SerializerFeature.WriteNonStringKeyAsString); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            String ybResult = HttpUtil.sendHttpPost(realUrl, jsonString, 8000); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            JSONObject ybResultJson = JSONObject.parseObject(ybResult); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            int responseCode = 0; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if(ybResultJson.getInteger("code") != 200) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                responseCode = ybResultJson.getInteger("code"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            response = new ResultVo(responseCode, ybResultJson.getString("message")); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // 记录医保接口调用结果 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // 通过关联键可以快速定位具体的退药记录,便于问题排查和审计 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            log.info("医保退药接口调用结果 - 结果: {}", response); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } catch (Exception e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            e.printStackTrace(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            response = new ResultVo(-1, "商品销售查询失败"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            // 记录错误信息时包含关联键,便于快速定位问题 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            log.error("医保退药接口调用失败 - 错误: {}", e.getMessage()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return response; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |