|  | @ -9,10 +9,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalBillDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.healthCare.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.httplog.YlzHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
 | 
	
	
		
			
				|  | @ -23,10 +20,7 @@ import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.healthCare.utils.AES;
 | 
	
		
			
				|  |  | import com.yihu.jw.healthCare.utils.SafeUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailBillDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.healthCare.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.httplog.dao.YlzHttpLogDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
 | 
	
	
		
			
				|  | @ -82,6 +76,8 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientMappingDao patientMappingDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YlzMedicalPrescriptionUploadDao ylzMedicalPrescriptionUploadDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionInfoDao prescriptionInfoDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private YlzMedicailRelationDao ylzMedicailRelationDao;
 | 
	
	
		
			
				|  | @ -99,6 +95,8 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |     private String ylzConfigSignKey;
 | 
	
		
			
				|  |  |     private String ylzConfigOrgCode;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void initConfig() throws Exception{
 | 
	
		
			
				|  |  |         logger.info("初始话参数!");
 | 
	
	
		
			
				|  | @ -406,7 +404,7 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 2.4.2	医师开方上传
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String doctorPrescriptionUpload(String prescriptionId)throws Exception{
 | 
	
		
			
				|  |  |     public String doctorPrescriptionUpload(String prescriptionId) throws Exception{
 | 
	
		
			
				|  |  |         WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
 | 
	
		
			
				|  |  |         if (wlyyPrescriptionDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("续方信息不存在");
 | 
	
	
		
			
				|  | @ -415,8 +413,49 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |         if (outpatientDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("门诊信息不存在");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
 | 
	
		
			
				|  |  |         if(hospitalSysDictDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("未配置网点编号");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String icCardNo = outpatientDO.getCardNo();
 | 
	
		
			
				|  |  |         String his_serial = outpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |         String org_code = hospitalSysDictDO.getDictCode();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject data;
 | 
	
		
			
				|  |  |         //获取his处方信息
 | 
	
		
			
				|  |  |         String getSettleInfoUrl = entranceUrl + "getSettleInfo?icCardNo="+icCardNo+"&his_serial="+his_serial+"&org_code="+org_code;
 | 
	
		
			
				|  |  |         String infoResponse = httpClientUtil.get(getSettleInfoUrl,"GBK");
 | 
	
		
			
				|  |  |         logger.info("处方infoResponse:"+infoResponse);
 | 
	
		
			
				|  |  |         JSONObject infoObject = JSONObject.parseObject(infoResponse);
 | 
	
		
			
				|  |  |         if (infoObject.getString("status").equalsIgnoreCase("200")) {
 | 
	
		
			
				|  |  |             JSONObject obj = infoObject.getJSONObject("obj");
 | 
	
		
			
				|  |  |             if("0".equals(obj.getString("ret_code"))){
 | 
	
		
			
				|  |  |                 data = obj;
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 throw new Exception("获取his处方信息失败:"+obj.getString("ret_mess"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             throw new Exception("获取his处方信息失败");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.remove("ret_code");
 | 
	
		
			
				|  |  |         data.remove("ret_mess");
 | 
	
		
			
				|  |  |         data.remove("log_no");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         YlzMedicalPrescriptionUploadDO uploadDO = new YlzMedicalPrescriptionUploadDO();
 | 
	
		
			
				|  |  |         uploadDO.setOrgCode(org_code);
 | 
	
		
			
				|  |  |         uploadDO.setIcCardNo(icCardNo);
 | 
	
		
			
				|  |  |         uploadDO.setHisSerial(his_serial);
 | 
	
		
			
				|  |  |         uploadDO.setOutpatientId(wlyyPrescriptionDO.getOutpatientId());
 | 
	
		
			
				|  |  |         uploadDO.setPrescriptionId(prescriptionId);
 | 
	
		
			
				|  |  |         uploadDO.setRegionCode(data.getString("region_code"));
 | 
	
		
			
				|  |  |         uploadDO.setName(data.getString("name"));
 | 
	
		
			
				|  |  |         uploadDO.setIdcard(data.getString("idcard"));
 | 
	
		
			
				|  |  |         uploadDO.setCertType(data.getString("cert_type"));
 | 
	
		
			
				|  |  |         uploadDO.setDataSource("53");//53移动支付
 | 
	
		
			
				|  |  |         uploadDO.setInsuranceSerial(data.getString("insurance_serial"));
 | 
	
		
			
				|  |  |         String result = requestYlz(data,"N20.17.03.01","医师开方上传");
 | 
	
		
			
				|  |  |         if(result == null){
 | 
	
		
			
				|  |  |             throw new Exception("医保请求失败");
 | 
	
	
		
			
				|  | @ -425,6 +464,8 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |         if (object.getString("flag").equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             JSONObject encryptData = object.getJSONObject("encrypt_data");
 | 
	
		
			
				|  |  |             uploadDO.setTransactionNo(encryptData.getString("transaction_no"));
 | 
	
		
			
				|  |  |             ylzMedicalPrescriptionUploadDao.save(uploadDO);
 | 
	
		
			
				|  |  |             return encryptData.toJSONString();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
	
		
			
				|  | @ -434,23 +475,27 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |      * 2.4.3	医师开方上传取消(N20.17.03.06)
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String doctorPrescriptionUploadCancle(String prescriptionId,String cancelReason)throws Exception{
 | 
	
		
			
				|  |  |         WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         YlzMedicalPrescriptionUploadDO uploadDO = ylzMedicalPrescriptionUploadDao.findByPrescriptionId(prescriptionId);
 | 
	
		
			
				|  |  |         if(uploadDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("未找到开发上传记录");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  |         data.put("transaction_no","");//处方上传流水号  	String	Y
 | 
	
		
			
				|  |  |         data.put("insurance_serial","insurance_serial");//医保流水号
 | 
	
		
			
				|  |  |         data.put("transaction_no",uploadDO.getTransactionNo());//处方上传流水号  	String	Y
 | 
	
		
			
				|  |  |         data.put("insurance_serial",uploadDO.getInsuranceSerial());//医保流水号
 | 
	
		
			
				|  |  |         data.put("cancel_reason",cancelReason);//作废原因
 | 
	
		
			
				|  |  |         data.put("region_code","");//参保地区划代码
 | 
	
		
			
				|  |  |         data.put("idcard",prescriptionDO.getIdcard());//证件号码
 | 
	
		
			
				|  |  |         data.put("name",prescriptionDO.getPatientName());//姓名
 | 
	
		
			
				|  |  |         data.put("cert_type","01");//证件类型
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("data_source","");//数据来源	String	Y	参见编码附件
 | 
	
		
			
				|  |  |         data.put("region_code",uploadDO.getRegionCode());//参保地区划代码
 | 
	
		
			
				|  |  |         data.put("idcard",uploadDO.getIdcard());//证件号码
 | 
	
		
			
				|  |  |         data.put("name",uploadDO.getName());//姓名
 | 
	
		
			
				|  |  |         data.put("cert_type",uploadDO.getCertType());//证件类型
 | 
	
		
			
				|  |  |         data.put("data_source",uploadDO.getDataSource());//数据来源	String	Y	参见编码附件
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String result = requestYlz(data,"N20.17.03.06","医师开方上传取消");
 | 
	
		
			
				|  |  |         if(result == null){
 | 
	
		
			
				|  |  |             throw new Exception("医保请求失败");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         logger.info("医师开方上传:"+result);
 | 
	
		
			
				|  |  |         logger.info("医师开方上传取消:"+result);
 | 
	
		
			
				|  |  |         JSONObject object = JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |         if (object.getString("flag").equalsIgnoreCase("1")){
 | 
	
		
			
				|  |  |             JSONObject encryptData = object.getJSONObject("encrypt_data");
 |