|  | @ -1,6 +1,7 @@
 | 
	
		
			
				|  |  | package com.yihu.wlyy.service.service.prescription;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.model.Result;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.util.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.dao.DoctorMappingDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.dao.HospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.dao.PatientDao;
 | 
	
	
		
			
				|  | @ -59,6 +60,8 @@ public class PrescriptionService extends ZysoftBaseService{
 | 
	
		
			
				|  |  |     private PrescriptionExpressageDao prescriptionExpressageDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private HospitalDao hospitalDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionPayDao prescriptionPayDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${redisChannel.prescription}")
 | 
	
		
			
				|  |  |     private String channelTopic;
 | 
	
	
		
			
				|  | @ -478,7 +481,7 @@ public class PrescriptionService extends ZysoftBaseService{
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String executeSickSettle(JSONObject json, String hospital, String licence)  throws Exception
 | 
	
		
			
				|  |  |     public String executeSickSettle(String prescriptionCode, String hospital, String licence)  throws Exception
 | 
	
		
			
				|  |  |     {
 | 
	
		
			
				|  |  |         if(hospital==null){
 | 
	
		
			
				|  |  |             String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
 | 
	
	
		
			
				|  | @ -490,6 +493,39 @@ public class PrescriptionService extends ZysoftBaseService{
 | 
	
		
			
				|  |  |         header.put("ORGCODE",hospital);
 | 
	
		
			
				|  |  |         header.put("LICENCE",licence);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
 | 
	
		
			
				|  |  |         if(prescription == null){
 | 
	
		
			
				|  |  |             throw new Exception("未找到该处方!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(StringUtils.isBlank(prescription.getVisitNo())){
 | 
	
		
			
				|  |  |             throw new Exception("处方为挂号成功");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         PrescriptionPay prescriptionPay = prescriptionPayDao.findByPrescriptionPay(prescriptionCode);
 | 
	
		
			
				|  |  |         if(prescriptionPay == null){
 | 
	
		
			
				|  |  |             throw new Exception("支付失败,无法结算,请重新支付!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //拼接结算参数
 | 
	
		
			
				|  |  |         JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |         json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
 | 
	
		
			
				|  |  | //            "saveDept": "开单科室编码",
 | 
	
		
			
				|  |  | //            "REGISTER_TYPE": "挂号类型编码",
 | 
	
		
			
				|  |  | //            "RATE_TYPE": "费别类型编码",
 | 
	
		
			
				|  |  |         json.put("settleDept","结算科室编码");//结算科室编码------待处理
 | 
	
		
			
				|  |  |         String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(prescription.getDoctor(),hospital);
 | 
	
		
			
				|  |  |         json.put("saveOperator",jwdoctor);// "saveOperator": "开单人员编码",
 | 
	
		
			
				|  |  |         json.put("visitNo",prescription.getVisitNo());// "院内挂号号,取费用列表中最小的院内挂号号
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //医保支付需要组装一下参数
 | 
	
		
			
				|  |  |         if (1 == prescriptionPay.getType()){
 | 
	
		
			
				|  |  |             JSONObject insurResult = new JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //            insurResult.put("zhzfe0",prescriptionPay.get)
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             json.put("insurResult",insurResult);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String response = postSecond("executeSickSettle","院内结算确认接口",null,json,header,false,2);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return response;
 |