| 
					
				 | 
			
			
				@@ -19,6 +19,7 @@ import cn.hnthyy.thmz.entity.his.zd.ZdChequeType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.entity.his.zd.ZdUnitCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.entity.his.zy.ZyZdAuditItem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.entity.thmz.Clinic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hnthyy.thmz.entity.thmz.Discount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.entity.thmz.HybirdTest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.entity.thmz.PayInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.entity.thmz.TurnToConsultation; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -39,15 +40,7 @@ import cn.hnthyy.thmz.service.his.zd.ZdChargeItemService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.ClinicService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.HaiCiAdapterService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.HybirdTestService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.RationalUseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.TransactionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.TsmzService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.TurnToConsultationService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.UserDeptRelationService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import cn.hnthyy.thmz.service.thmz.WindowsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hnthyy.thmz.service.thmz.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.vo.ChargeFeeParamsVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.vo.MzDepositFileVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cn.hnthyy.thmz.vo.MzPrescriptionVo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,6 +130,8 @@ public class MzChargeDetailController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MzOrderLockMapper mzOrderLockMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MzYjReqService mzYjReqService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    DiscountService discountService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Value("${healthEducationUrl}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String healthEducationUrl; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -434,6 +429,11 @@ public class MzChargeDetailController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 resultMap.put("receiptNo", receiptNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              else  if(CollUtil.isNotEmpty(mzDepositFiles)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 if(mzDepositFiles.stream().anyMatch(item->Constants.ZZWX.equals(item.getChequeType()))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     resultMap.put("code", -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     resultMap.put("message", "缴费失败,已经缴费,缴费方式为微信缴费,请不要重复缴费!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                     return resultMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //    修改收费人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mzChargeDetailService.updateOpId(HttpUtil.getIPAddress(httpServletRequest),TokenUtil.getUser().getUserIdCode(),mzDepositFileVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 resultMap.put("receiptNo", 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1957,8 +1957,42 @@ public class MzChargeDetailController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mzPrescriptionVo.setDoctorCode(Constants.BRZZJF_CODE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Tools.setReqNo(mzPrescriptionVo.getMzYjReqList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> tempPrescription = mzChargeDetailService.getAmountForTempPrescription(mzPrescriptionVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> chargeItemCodes = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            discountService.getChargeItemCodes(chargeItemCodes,mzPrescriptionVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Discount> discounts = discountService.containsTcItem(chargeItemCodes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            BigDecimal discountAmount = Convert.toBigDecimal(tempPrescription.get("discountAmount"), BigDecimal.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(CollUtil.isNotEmpty(discounts) && discountAmount.compareTo(new BigDecimal("1")) <= 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //优惠警告信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<String> discountWarningMessageList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for(Discount discount: discounts){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(StrUtil.isNotBlank(discount.getDeptNo())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<String> deptList = CollUtil.newArrayList(discount.getDeptNo().split(",")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<String> deptNameList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (String dept :deptList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ZdUnitCode zdUnitCode = zdUnitCodeService.queryByCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(zdUnitCode != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                deptNameList.add(zdUnitCode.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String msg = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(!deptList.contains(mzPrescriptionVo.getVisitDeptCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            msg += "该处方包含优惠套餐("+discount.getName()+"),但是申请科室不符(该优惠套餐只有科室["+CollUtil.join(deptNameList,",")+"]享受折扣优惠,请检查是否申请科室是否正确),如果不要套餐优惠折扣请忽略;"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(Convert.toInt(mzPrescriptionVo.getZgmztczf(),0) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            msg += "该处方包含优惠套餐("+discount.getName()+"),已选择门诊统筹处方不享受折扣优惠,如要优惠折扣,门诊统筹请选否,如果不要套餐优惠折扣请忽略"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(StrUtil.isNotBlank(msg)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            discountWarningMessageList.add(msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(CollUtil.isNotEmpty(discountWarningMessageList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    resultMap.put("discountWarningMessage",CollUtil.join(discountWarningMessageList,";")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             resultMap.put("code", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            resultMap.put("data", mzChargeDetailService.getAmountForTempPrescription(mzPrescriptionVo)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resultMap.put("data",tempPrescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             resultMap.put("message", "计算临时处方的中药,西药,诊疗以及总金额成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return resultMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (MzException e) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3009,6 +3043,10 @@ public class MzChargeDetailController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(mzOrderLock != null && Convert.toInt(mzOrderLock.getLockFlag(),0) == 1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return R.error("处方在缴费中,不能修改处方"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer countYbJs = mzPatientMiService.countYbJs(patientId, times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(Convert.toInt(countYbJs,0) > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("处方已经结算,不能修改处方,如要修改请找医保科取消医保结算再修改"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @UserLoginToken 
			 |