| 
					
				 | 
			
			
				@@ -20,6 +20,7 @@ import thyyxxk.webserver.entity.datamodify.ZyDetailCharge; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.inpatient.ZyActpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.login.UserInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import thyyxxk.webserver.entity.projectEntry.DrugReturnForm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.service.PublicServer; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.service.medicalinsurance.SiZyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.service.redislike.RedisLikeService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -27,10 +28,7 @@ import thyyxxk.webserver.utils.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -207,6 +205,8 @@ public class XiangMuLuRuService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.setChargeAmount(item.getChargeAmount().negate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     drug.add(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     updateDrugLabel.add(item.getDetailSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // todo 要开启把这个代码注释掉 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号:【%s】,此药品为医技科室录入,药品无法退费。", item.getDetailSn())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -229,19 +229,17 @@ public class XiangMuLuRuService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     item.setDrugClass(a.getDrugClass()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ZyActpatient patientInfo = publicServer.huoQuHuanZheXinXi(param.getInpatientNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer pageNo = publicServer.getTheDrugListNo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 药品单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String groupNo = publicServer.getGroupNo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer pageNo = publicServer.getTheDrugListNo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 退药单汇总 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dao.drugReturnForm(pageNo, patientInfo.getWard(), TokenUtil.getTokenUserId(), groupNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dao.drugReturnForm(pageNo, userInfo.getDeptCode(), TokenUtil.getTokenUserId(), param.getGroupNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 退药明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dao.detailsOfDrugReturnForm(drug, patientInfo.getInpatientNo(), patientInfo.getAdmissTimes(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    patientInfo.getName(), patientInfo.getBedNo(), patientInfo.getWard(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    infantFlag, groupNo, TokenUtil.getTokenUserId(), pageNo, ledgerSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    patientInfo.getName(), patientInfo.getBedNo(), userInfo.getDeptCode(), infantFlag, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    param.getGroupNo(), TokenUtil.getTokenUserId(), pageNo, ledgerSn); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 药品的退药 标准 为 -2 申请退药 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dao.genXinZhenShuTuiFeiLiuShui(param.getInpatientNo(), param.getAdmissTimes(), ledgerSn, updateDrugLabel, -2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.info("项目录入==》药品退费,操作人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONStringWithDateFormat(drug, DateUtil.DEFAULT_PATTERN)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -260,7 +258,6 @@ public class XiangMuLuRuService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "退费成功。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -862,5 +859,33 @@ public class XiangMuLuRuService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         siZyService.revokeUploadFees(p); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResultVo<Map<String, Map<String, DrugReturnForm>>> drugRefundForm(String groupNo, String patNo, Integer times) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, Map<String, DrugReturnForm>> map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        UserInfo info = redisLikeService.getUserInfoByToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<String, List<DrugReturnForm>> drugPageNoGy = dao.queryTheDrugReturnForm(info.getDeptCode(), groupNo, patNo, times).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.groupingBy(DrugReturnForm::getPageNoTy)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (drugPageNoGy.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有护士退药单。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (Map.Entry<String, List<DrugReturnForm>> drugList : drugPageNoGy.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, DrugReturnForm> tempMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (DrugReturnForm item : drugList.getValue()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String key = item.getChargeCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (tempMap.containsKey(key)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DrugReturnForm drug = tempMap.get(key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    drug.setAmount(drug.getAmount().add(item.getAmount())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    drug.setRetprice(drug.getRetprice().add(item.getRetprice())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tempMap.put(key, item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            map.put(drugList.getKey(), tempMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ResultVoUtil.success(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |