| 
					
				 | 
			
			
				@@ -7,7 +7,8 @@ import thyyxxk.webserver.constants.sidicts.Insutype; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.constants.sidicts.MedType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.dao.his.medicalinsurance.SiSettleApplyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.ResultVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import thyyxxk.webserver.entity.medicalinsurance.inpatient.SiSettleApply; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.request.SettledApplyInquiry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import thyyxxk.webserver.entity.medicalinsurance.inpatient.settleapply.response.SiSettleApply; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbDiag; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.inpatient.dismiss.ZyDisYbSrgry; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import thyyxxk.webserver.entity.inpatient.patient.Patient; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -96,7 +97,8 @@ public class SiSettleApplyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResultVo<Map<String, Object>> selectPatientInfo(SiSettleApply param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ResultVo<Patient> ptntRsvo = ptntSrvc.getPatientInfo(param.getPatNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ResultVo<Patient> ptntRsvo = param.getInOutFlag() == 1 ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ptntSrvc.getPatientInfo(param.getPatNo()) : ptntSrvc.getDisPatient(param.getPatNo(), param.getTimes()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (ptntRsvo.getCode() != ExceptionEnum.SUCCESS.getCode()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, ptntRsvo.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -128,7 +130,7 @@ public class SiSettleApplyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             itm.setSszs2Name(redis.getEmployeeName(itm.getSszs2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             itm.setMzysName(redis.getEmployeeName(itm.getMzys())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (DecimalUtil.compare(apply.getDetailTotalCharge(), apply.getLedgerTotalCharge()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (param.getInOutFlag() == 1 && DecimalUtil.compare(apply.getDetailTotalCharge(), apply.getLedgerTotalCharge()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ptntSrvc.receiveAndRecalculateCost(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SiSettleApply chrgs = dao.selectTotalChargeAgain(apply); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             apply.setDetailTotalCharge(chrgs.getDetailTotalCharge()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -141,6 +143,9 @@ public class SiSettleApplyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         map.put("indiags", inYbDiags); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         map.put("disdiags", disYbDiags); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         map.put("surgeries", disYbSrgries); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (param.getInOutFlag() == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.success(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String message = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (DecimalUtil.compare(apply.getDetailTotalCharge(), apply.getMedinsTotalCharge()) != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            message += "此患者明细总费用与医保上传总费用不一致;"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,4 +173,15 @@ public class SiSettleApplyService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         list.forEach(item -> item.setHandleStaffName(redis.getEmployeeName(item.getHandleStaff()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResultVoUtil.success(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResultVo<List<SiSettleApply>> selectSettledApplies(SettledApplyInquiry inquiry) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String start = inquiry.getStart() + " 00:00:00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String end = inquiry.getEnd() + " 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<SiSettleApply> list = dao.selectSettledApplies(start, end); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (list.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        list.forEach(item -> item.setHandleStaffName(redis.getEmployeeName(item.getHandleStaff()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ResultVoUtil.success(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |