|  | @ -184,6 +184,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionEmrDao prescriptionEmrDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyHospitalSysDictDao hospitalSysDictDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${demo.flag}")
 | 
	
	
		
			
				|  | @ -435,6 +437,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 //检查检验信息
 | 
	
		
			
				|  |  |                 List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
 | 
	
		
			
				|  |  |                 vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(),1),inspectionVOs,WlyyInspectionVO.class));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //电子病历
 | 
	
		
			
				|  |  |                 vo.setWlyyPrescriptionEmrDO(prescriptionEmrDao.findEmrByPrescriptionId(vo.getId()));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         rs.put("prescriptions",prescriptionVOs);
 | 
	
	
		
			
				|  | @ -1816,7 +1821,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param diagnosisJson
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson) throws Exception {
 | 
	
		
			
				|  |  |     public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson,String emrJson) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String, Object> result = new HashedMap();
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1952,6 +1957,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //=====================检查检验=======================================================================
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //=====================电子病历=================================================start
 | 
	
		
			
				|  |  |             prescriptionEmrDao.deleteByPrescriptionId(prescription.getId());
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(emrJson)) {
 | 
	
		
			
				|  |  |                 WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = com.alibaba.fastjson.JSONObject.parseObject(emrJson,WlyyPrescriptionEmrDO.class);
 | 
	
		
			
				|  |  |                 wlyyPrescriptionEmrDO.setDel(1);
 | 
	
		
			
				|  |  |                 wlyyPrescriptionEmrDO.setPrescriptionId(prescription.getId());
 | 
	
		
			
				|  |  |                 prescriptionEmrDao.save(wlyyPrescriptionEmrDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //=====================电子病历=================================================end
 | 
	
		
			
				|  |  |             //保存挂号费用
 | 
	
		
			
				|  |  |             prescription.setRegFee(getChargeFee(outpatientDO.getDoctor()));
 | 
	
		
			
				|  |  |             //=====================保存日志 start=========================================================
 | 
	
	
		
			
				|  | @ -3922,6 +3937,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     public Map<String,Object> findPatientInfo(String patient){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
 | 
	
		
			
				|  |  |         rs.put("id",patient);
 | 
	
		
			
				|  |  |         rs.put("name",basePatientDO.getName());
 | 
	
		
			
				|  |  |         rs.put("sex",basePatientDO.getSex());
 | 
	
	
		
			
				|  | @ -3934,6 +3950,51 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         rs.put("idcard",basePatientDO.getIdcard());
 | 
	
		
			
				|  |  |         rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 | 
	
		
			
				|  |  |         rs.put("mobile",basePatientDO.getMobile());
 | 
	
		
			
				|  |  |         if (patientMedicareCardDO!=null){
 | 
	
		
			
				|  |  |             rs.put("ssc",patientMedicareCardDO.getCode());
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             rs.put("ssc","");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc){
 | 
	
		
			
				|  |  |         Map<String,Object> rs = new HashedMap();
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = basePatientDao.findById(patient);
 | 
	
		
			
				|  |  |         PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
 | 
	
		
			
				|  |  |         basePatientDO.setName(name);
 | 
	
		
			
				|  |  |         basePatientDO.setIdcard(idcard);
 | 
	
		
			
				|  |  |         basePatientDO = basePatientDao.save(basePatientDO);
 | 
	
		
			
				|  |  |         if (patientMedicareCardDO!=null){
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setCode(ssc);
 | 
	
		
			
				|  |  |             patientMedicareCardDO=basePatientMedicareCardDao.save(patientMedicareCardDO);
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             patientMedicareCardDO = new PatientMedicareCardDO();
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setCode(ssc);
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setType("A_01");
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setParentType("A");
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setDel("1");
 | 
	
		
			
				|  |  |             patientMedicareCardDO.setPatientCode(patient);
 | 
	
		
			
				|  |  |             patientMedicareCardDO=basePatientMedicareCardDao.save(patientMedicareCardDO);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         rs.put("id",patient);
 | 
	
		
			
				|  |  |         rs.put("name",basePatientDO.getName());
 | 
	
		
			
				|  |  |         rs.put("sex",basePatientDO.getSex());
 | 
	
		
			
				|  |  |         rs.put("provinceCode",basePatientDO.getProvinceCode());
 | 
	
		
			
				|  |  |         rs.put("provinceName",basePatientDO.getProvinceName());
 | 
	
		
			
				|  |  |         rs.put("cityCode",basePatientDO.getCityCode());
 | 
	
		
			
				|  |  |         rs.put("cityName",basePatientDO.getCityName());
 | 
	
		
			
				|  |  |         rs.put("townCode",basePatientDO.getTownCode());
 | 
	
		
			
				|  |  |         rs.put("townName",basePatientDO.getTownName());
 | 
	
		
			
				|  |  |         rs.put("idcard",basePatientDO.getIdcard());
 | 
	
		
			
				|  |  |         rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 | 
	
		
			
				|  |  |         rs.put("mobile",basePatientDO.getMobile());
 | 
	
		
			
				|  |  |         if (patientMedicareCardDO!=null){
 | 
	
		
			
				|  |  |             rs.put("ssc",patientMedicareCardDO.getCode());
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             rs.put("ssc","");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -5667,4 +5728,63 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String readOutPatient(String registerSn) throws Exception {
 | 
	
		
			
				|  |  |         String url = "";
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
 | 
	
		
			
				|  |  |         if (wlyyHospitalSysDictDO!=null){
 | 
	
		
			
				|  |  |             url = wlyyHospitalSysDictDO.getDictCode();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
 | 
	
		
			
				|  |  |                 "<HtRequest>\n";
 | 
	
		
			
				|  |  |         xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
 | 
	
		
			
				|  |  |         String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
 | 
	
		
			
				|  |  |         xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
 | 
	
		
			
				|  |  |         xmlStr+="</HtRequest>";
 | 
	
		
			
				|  |  |         String returnValue = "";
 | 
	
		
			
				|  |  |         Map<String, String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("type","writeOutPatient");
 | 
	
		
			
				|  |  |         params.put("xmlStr",xmlStr);
 | 
	
		
			
				|  |  |         returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
 | 
	
		
			
				|  |  |                 "http://business.htemr.haitaiinc.com",
 | 
	
		
			
				|  |  |                 "manageOutRegister",
 | 
	
		
			
				|  |  |                 params);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("调用电子病历查询接口请求成功,返回值xmlstr:" + returnValue);
 | 
	
		
			
				|  |  |         return returnValue;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String writeOutPatient(String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck) throws Exception {
 | 
	
		
			
				|  |  |         String url = "";
 | 
	
		
			
				|  |  |         WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_URL");
 | 
	
		
			
				|  |  |         if (wlyyHospitalSysDictDO!=null){
 | 
	
		
			
				|  |  |             url = wlyyHospitalSysDictDO.getDictCode();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String xmlStr = "<?xml version=\"1.0\" encoding=\"GBK\"?>\n" +
 | 
	
		
			
				|  |  |                 "<HtRequest>\n";
 | 
	
		
			
				|  |  |         xmlStr+="<REGISTER_SN>"+registerSn+"</REGISTER_SN>";
 | 
	
		
			
				|  |  |         String reqTime = DateUtil.dateToStr(new Date(),"yyyyMMddHHmmssSSS");
 | 
	
		
			
				|  |  |         xmlStr+="<REQ_TIME>"+reqTime+"</REQ_TIME>";
 | 
	
		
			
				|  |  |         xmlStr+="<OUTPATIENT_INFO>";
 | 
	
		
			
				|  |  |         xmlStr+="<CHIEF_COMPLAINT>"+chiefComplaint+"</CHIEF_COMPLAINT>";
 | 
	
		
			
				|  |  |         xmlStr+="<HPI>"+hpi+"</HPI>";
 | 
	
		
			
				|  |  |         xmlStr+="<ELAPSEMHIS>"+elapsemhis+"</ELAPSEMHIS>";
 | 
	
		
			
				|  |  |         xmlStr+="<BODYCHECK>"+bodycheck+"</BODYCHECK>";
 | 
	
		
			
				|  |  |         xmlStr+="<ASSISTANTCHECK>"+assistanTcheck+"</ASSISTANTCHECK>";
 | 
	
		
			
				|  |  |         xmlStr+="</OUTPATIENT_INFO>";
 | 
	
		
			
				|  |  |         xmlStr+="</HtRequest>";
 | 
	
		
			
				|  |  |         String returnValue = "";
 | 
	
		
			
				|  |  |         Map<String, String> params = new HashedMap();
 | 
	
		
			
				|  |  |         params.put("type","writeOutPatient");
 | 
	
		
			
				|  |  |         params.put("xmlStr",xmlStr);
 | 
	
		
			
				|  |  |         returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
 | 
	
		
			
				|  |  |                 "http://business.htemr.haitaiinc.com",
 | 
	
		
			
				|  |  |                 "manageOutRegister",
 | 
	
		
			
				|  |  |                 params);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("调用电子病历写入接口请求成功,返回值xmlstr:" + returnValue);
 | 
	
		
			
				|  |  |         return returnValue;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |