|  | @ -285,107 +285,37 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |         if (outpatientDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("事前提醒失败:门诊信息不存在");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
 | 
	
		
			
				|  |  |         if(patientDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("事前提醒失败:居民不存在");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         JSONObject data = new JSONObject();
 | 
	
		
			
				|  |  |         data.put("his_serial",outpatientDO.getRegisterNo());//HIS 门诊挂号号
 | 
	
		
			
				|  |  |         data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊挂号流水号
 | 
	
		
			
				|  |  |         data.put("medical_mode","");//就诊类型 String	Y
 | 
	
		
			
				|  |  |         data.put("region_code","");//参保地区划代码	String	Y
 | 
	
		
			
				|  |  |         data.put("name",patientDO.getName());//姓名
 | 
	
		
			
				|  |  |         data.put("idcard",patientDO.getIdcard());//证件号码
 | 
	
		
			
				|  |  |         data.put("cert_type","01");//证件类型
 | 
	
		
			
				|  |  |         String sex = IdCardUtil.getSexForIdcard_new(patientDO.getIdcard(),patientDO.getSex());
 | 
	
		
			
				|  |  |         if("3".equals(sex)){
 | 
	
		
			
				|  |  |             sex = "9";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         data.put("sex",sex);//性别	String	Y
 | 
	
		
			
				|  |  |         String birth = IdCardUtil.getBirthdayForIdcardStr(patientDO.getIdcard(),patientDO.getBirthday());
 | 
	
		
			
				|  |  |         if(StringUtils.isBlank(birth)){
 | 
	
		
			
				|  |  |             throw new Exception("事前提醒失败:居民生日信息有误");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         data.put("birth",birth);//出生日期 	String	Y
 | 
	
		
			
				|  |  |         data.put("medical_type","11");//医疗类别	String	Y
 | 
	
		
			
				|  |  |         data.put("ticket_no","");//单据流水号	String	Y
 | 
	
		
			
				|  |  |         data.put("disease_code","");//特殊门诊病情编码	String	Y
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String doctorId = outpatientDO.getDoctor();
 | 
	
		
			
				|  |  |         BaseDoctorDO doctorDO = doctorDao.findOne(doctorId);
 | 
	
		
			
				|  |  |         if(doctorDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("事前提醒失败:医生不存在");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
 | 
	
		
			
				|  |  |         if(doctorHospitalDOS.size()<=0){
 | 
	
		
			
				|  |  |             throw new Exception("事前提醒失败:未找到医生科室编码");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctorId);
 | 
	
		
			
				|  |  |         if(doctorMappingDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("事前提醒失败:未找到医生his编码");
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
 | 
	
		
			
				|  |  |         if(hospitalSysDictDO == null){
 | 
	
		
			
				|  |  |             throw new Exception("未配置网点编号");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         data.put("dept_code",doctorHospitalDO.getDeptCode());//科室代码
 | 
	
		
			
				|  |  |         data.put("dept_name",doctorHospitalDO.getDeptName());//科室名称
 | 
	
		
			
				|  |  |         data.put("doctor_code",doctorMappingDO.getMappingCode());//医师编号
 | 
	
		
			
				|  |  |         data.put("doctor_name",doctorDO.getName());//医生名称
 | 
	
		
			
				|  |  |         data.put("doctor_idcard",doctorDO.getIdcard());//医师身份证号
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("prescription_date", DateUtil.dateToStr(outpatientDO.getCreateTime(),DateUtil.YYYY_MM_DD));//处方日期
 | 
	
		
			
				|  |  |         data.put("prescription_counts","1");//处方项目数
 | 
	
		
			
				|  |  |         data.put("prescription_source","");//处方来源	String	Y
 | 
	
		
			
				|  |  |         String icCardNo = outpatientDO.getCardNo();
 | 
	
		
			
				|  |  |         String his_serial = outpatientDO.getRegisterNo();
 | 
	
		
			
				|  |  |         String org_code = hospitalSysDictDO.getDictCode();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //诊断
 | 
	
		
			
				|  |  |         JSONArray zdlist = new JSONArray();
 | 
	
		
			
				|  |  |         String icd10 = outpatientDO.getIcd10();
 | 
	
		
			
				|  |  |         String icd10Name = outpatientDO.getIcd10Name();
 | 
	
		
			
				|  |  |         String icd10sz[] = icd10.split(",");
 | 
	
		
			
				|  |  |         String icd10Namesz[] = icd10Name.split(",");
 | 
	
		
			
				|  |  |         for (int i=0;i<icd10sz.length;i++){
 | 
	
		
			
				|  |  |             JSONObject zd = new JSONObject();
 | 
	
		
			
				|  |  |             zd.put("disease_code_icd10",icd10sz[i].trim());//诊断或症状编码	String	Y	见icd-10或症状表编码
 | 
	
		
			
				|  |  |             zd.put("disease_name_icd10",icd10Namesz[i].trim());//诊断或症状名称	String	Y	见icd-10或症状表名称
 | 
	
		
			
				|  |  |             zd.put("disease_type","01");//诊断或症状类型	String	Y	参见编码附件 01	门诊
 | 
	
		
			
				|  |  |             zd.put("disease_order","");//诊断或症状序号	String	Y	参见编码附件
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         data.put("zdlist",zdlist);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //医嘱明细
 | 
	
		
			
				|  |  |         JSONArray mxlist = new JSONArray();
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
 | 
	
		
			
				|  |  |         for (WlyyPrescriptionDO wlyyPrescriptionDO:wlyyPrescriptionDOS){
 | 
	
		
			
				|  |  |             List<WlyyPrescriptionInfoDO> prescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
 | 
	
		
			
				|  |  |             for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:prescriptionInfoDOS){
 | 
	
		
			
				|  |  |                 JSONObject infoObj = new JSONObject();
 | 
	
		
			
				|  |  |                 infoObj.put("catalog_item","");//社保三大目录统一编码          	String	Y
 | 
	
		
			
				|  |  |                 infoObj.put("his_item_name",wlyyPrescriptionInfoDO.getDrugName());//HIS院内项目名称
 | 
	
		
			
				|  |  |                 infoObj.put("his_item_code",wlyyPrescriptionInfoDO.getDrugNo());//HIS院内项目编码
 | 
	
		
			
				|  |  |                 infoObj.put("item_name","");//医保项目名称
 | 
	
		
			
				|  |  |                 infoObj.put("item_code","");//医保项目编码
 | 
	
		
			
				|  |  |                 infoObj.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
 | 
	
		
			
				|  |  |                 infoObj.put("his_detail_sn","");//his处方明细流水号
 | 
	
		
			
				|  |  |                 infoObj.put("invoice_type","");//发票项目类别
 | 
	
		
			
				|  |  |                 infoObj.put("specification_type",wlyyPrescriptionInfoDO.getSpecification());//规格型号
 | 
	
		
			
				|  |  |                 infoObj.put("dosage_form",wlyyPrescriptionInfoDO.getDosage());//剂型
 | 
	
		
			
				|  |  |                 infoObj.put("charge_unit","");//单位
 | 
	
		
			
				|  |  |                 infoObj.put("price",wlyyPrescriptionInfoDO.getPackRetprice());//单价
 | 
	
		
			
				|  |  |                 infoObj.put("amount",wlyyPrescriptionInfoDO.getQuantity());//数量
 | 
	
		
			
				|  |  |                 infoObj.put("total_money",wlyyPrescriptionInfoDO.getPackRetprice()*Integer.parseInt(wlyyPrescriptionInfoDO.getQuantity()));//金额
 | 
	
		
			
				|  |  |                 infoObj.put("single_dose",wlyyPrescriptionInfoDO.getDosage());//每次用量
 | 
	
		
			
				|  |  |                 infoObj.put("use_frequency",wlyyPrescriptionInfoDO.getUsageName());//使用频次
 | 
	
		
			
				|  |  |                 infoObj.put("medical_way","");//给药途径
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 infoObj.put("prescription_date", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()));//处方日期
 | 
	
		
			
				|  |  |                 infoObj.put("medication_days",wlyyPrescriptionInfoDO.getDays());//执行天数
 | 
	
		
			
				|  |  |                 infoObj.put("his_dept_code",wlyyPrescriptionDO.getDept());//his内部科室编码
 | 
	
		
			
				|  |  |                 infoObj.put("his_dept_name",wlyyPrescriptionDO.getDeptName());//his内部科室名称
 | 
	
		
			
				|  |  |                 infoObj.put("limit_type","");//限制范围类别
 | 
	
		
			
				|  |  |                 mxlist.add(infoObj);
 | 
	
		
			
				|  |  |         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.put("mxlist",mxlist);
 | 
	
		
			
				|  |  |         data.remove("ret_code");
 | 
	
		
			
				|  |  |         data.remove("ret_mess");
 | 
	
		
			
				|  |  |         data.remove("log_no");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("ticket_no","");//	单据流水号
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String result = requestYlz(data,"N20.17.03.03","事前提醒");
 | 
	
		
			
				|  |  |         if(result == null){
 | 
	
	
		
			
				|  | @ -444,6 +374,8 @@ public class HealthCareService {
 | 
	
		
			
				|  |  |         data.remove("ret_mess");
 | 
	
		
			
				|  |  |         data.remove("log_no");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("order_id",prescriptionId);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         YlzMedicalPrescriptionUploadDO uploadDO = new YlzMedicalPrescriptionUploadDO();
 | 
	
		
			
				|  |  |         uploadDO.setOrgCode(org_code);
 | 
	
		
			
				|  |  |         uploadDO.setIcCardNo(icCardNo);
 |