|  | @ -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("初始话参数!");
 | 
	
	
		
			
				|  | @ -287,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编码");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         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
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //诊断
 | 
	
		
			
				|  |  |         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);
 | 
	
		
			
				|  |  |         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.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){
 | 
	
	
		
			
				|  | @ -406,7 +334,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,123 +343,51 @@ 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("order_id","");//订单号 String	Y
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("medical_mode","");//就诊类型 String	Y
 | 
	
		
			
				|  |  |         data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
 | 
	
		
			
				|  |  |         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("phone",patientDO.getMobile());//用户手机号
 | 
	
		
			
				|  |  |         data.put("medical_type","11");//医疗类别	String	Y
 | 
	
		
			
				|  |  |         data.put("medical_type_name","普通门诊");//医疗类别	String	Y
 | 
	
		
			
				|  |  | //        data.put("insurance_ticket_no","");//诊查费结算后的收费单据号	String	N
 | 
	
		
			
				|  |  |         data.put("medical_time",DateUtil.dateToStr(outpatientDO.getCreateTime(),DateUtil.YYYY_MM_DD_HH_MM_SS));//特殊门诊病情编码	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编码");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         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());//医师身份证号
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /*        pharmacist_code	医院药师证件号码	String	N
 | 
	
		
			
				|  |  |         pharmacist_name	医院药师姓名	String	N
 | 
	
		
			
				|  |  |         pharmacist_audit_date	医院药师处方审核时间	String	N
 | 
	
		
			
				|  |  |         prescription _valid_date	处方过期时间	String	N
 | 
	
		
			
				|  |  |         prescription_type_code	处方类别编号	String	N
 | 
	
		
			
				|  |  |         tcm_nums	中药剂数	String	N
 | 
	
		
			
				|  |  |         tcm_method_code	中药药品用法编号	String	N
 | 
	
		
			
				|  |  |         tcm_method_name	中药药品用法名称	String	N
 | 
	
		
			
				|  |  |         tcm_freq_code	中药频次编号	String	N
 | 
	
		
			
				|  |  |         tcm_freq_name	中药频次名称	String	N*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("prescription_date", DateUtil.dateToStr(outpatientDO.getCreateTime(),DateUtil.YYYY_MM_DD));//处方日期
 | 
	
		
			
				|  |  |         data.put("prescription_counts","1");//处方项目数
 | 
	
		
			
				|  |  |         data.put("prescription_source","");//处方来源	String	Y 0:非外配处方;1:外配处方
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //诊断
 | 
	
		
			
				|  |  |         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","");//诊断或症状类型	String	Y	参见编码附件
 | 
	
		
			
				|  |  |             zd.put("disease_order","");//诊断或症状序号	String	Y	参见编码附件
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         data.put("zdlist",zdlist);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //医嘱明细
 | 
	
		
			
				|  |  |         JSONArray mxlist = new JSONArray();
 | 
	
		
			
				|  |  |         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("his_drug_no",wlyyPrescriptionInfoDO.getDrugNo());//院内药品编码
 | 
	
		
			
				|  |  |             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);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("mxlist",mxlist);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         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");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         data.put("order_id",prescriptionId);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         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("医保请求失败");
 | 
	
	
		
			
				|  | @ -540,6 +396,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;
 | 
	
	
		
			
				|  | @ -549,23 +407,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");
 |