|  | @ -21,6 +21,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
 |  | import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 |  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 |  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.prescription.*;
 |  | import com.yihu.jw.entity.hospital.prescription.*;
 | 
												
													
														
															|  | import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
 |  | import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
 | 
												
											
												
													
														
															|  | @ -52,7 +53,9 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
												
													
														
															|  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
												
													
														
															|  | import com.yihu.jw.util.common.IdCardUtil;
 |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.utils.PinYinUtils;
 | 
												
													
														
															|  | import com.yihu.jw.utils.StringUtil;
 |  | import com.yihu.jw.utils.StringUtil;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.utils.WebserviceUtil;
 | 
												
													
														
															|  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
												
													
														
															|  | import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
 |  | import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
 | 
												
													
														
															|  | import com.yihu.mysql.query.BaseJpaService;
 |  | import com.yihu.mysql.query.BaseJpaService;
 | 
												
											
												
													
														
															|  | @ -1216,11 +1219,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |     public net.sf.json.JSONObject registerOutPatient(String outPatientId,String doctor)throws Exception{
 |  |     public net.sf.json.JSONObject registerOutPatient(String outPatientId,String doctor)throws Exception{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
 |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctor,outpatientDO.getHospital());
 |  |         DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctor,outpatientDO.getHospital());
 | 
												
													
														
															|  |         if(doctorMappingDO==null){
 |  |         if(doctorMappingDO==null){
 | 
												
													
														
															|  |             throw new RuntimeException("未找到医生映射信息");
 |  |             throw new RuntimeException("未找到医生映射信息");
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  | 
 |  |         BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
 | 
												
													
														
															|  | 
 |  |     
 | 
												
													
														
															|  | 
 |  |         Integer manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //查找居民当天挂号记录
 |  |         //查找居民当天挂号记录
 | 
												
													
														
															|  |         String date = DateUtil.dateToStr(new Date(),"yyyy-MM-dd");
 |  |         String date = DateUtil.dateToStr(new Date(),"yyyy-MM-dd");
 | 
												
											
												
													
														
															|  | @ -1239,7 +1248,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 outpatientDO.setRegisterNo(registerDO.getRegisterNo());
 |  |                 outpatientDO.setRegisterNo(registerDO.getRegisterNo());
 | 
												
													
														
															|  |                 outpatientDO.setAdmDate(registerDO.getCreateTime());
 |  |                 outpatientDO.setAdmDate(registerDO.getCreateTime());
 | 
												
													
														
															|  |                 outpatientDao.save(outpatientDO);
 |  |                 outpatientDao.save(outpatientDO);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                 //调用电子病历注册
 | 
												
													
														
															|  | 
 |  |                 manageType =2;
 | 
												
													
														
															|  | 
 |  |                 registDianziBingli(outPatientId,basePatientDO,manageType);
 | 
												
													
														
															|  |                 return res;
 |  |                 return res;
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -1249,6 +1260,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         net.sf.json.JSONObject res = rs.getJSONObject("resquest");
 |  |         net.sf.json.JSONObject res = rs.getJSONObject("resquest");
 | 
												
													
														
															|  |         logger.info("挂号结果 res: " +res.toString());
 |  |         logger.info("挂号结果 res: " +res.toString());
 | 
												
													
														
															|  |         String rsCode = res.getString("@RESULT");
 |  |         String rsCode = res.getString("@RESULT");
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  |         if("0".equals(rsCode)){
 |  |         if("0".equals(rsCode)){
 | 
												
													
														
															|  |             //存储挂号号
 |  |             //存储挂号号
 | 
												
													
														
															|  |             // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
 |  |             // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
 | 
												
											
												
													
														
															|  | @ -1276,6 +1288,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |             registerDO.setCreateTime(new Date());
 |  |             registerDO.setCreateTime(new Date());
 | 
												
													
														
															|  |             registerDO.setDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd"));
 |  |             registerDO.setDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd"));
 | 
												
													
														
															|  |             patientRegisterDao.save(registerDO);
 |  |             patientRegisterDao.save(registerDO);
 | 
												
													
														
															|  | 
 |  |             
 | 
												
													
														
															|  |         }else if("-2".equals(rsCode)){
 |  |         }else if("-2".equals(rsCode)){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             String serialNo = (String)res.get("@serial_no");
 |  |             String serialNo = (String)res.get("@serial_no");
 | 
												
											
												
													
														
															|  | @ -1303,6 +1316,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             patientRegisterDao.save(registerDO);
 |  |             patientRegisterDao.save(registerDO);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |     
 | 
												
													
														
															|  | 
 |  |         manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填
 | 
												
													
														
															|  | 
 |  |     
 | 
												
													
														
															|  | 
 |  |         registDianziBingli(outPatientId,basePatientDO,manageType);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  |             //保存日志
 |  |             //保存日志
 | 
												
													
														
															|  |         WlyyHttpLogDO log = new WlyyHttpLogDO();
 |  |         WlyyHttpLogDO log = new WlyyHttpLogDO();
 | 
												
													
														
															|  |         log.setCode("registerOutPatient");
 |  |         log.setCode("registerOutPatient");
 | 
												
											
												
													
														
															|  | @ -1316,6 +1335,104 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         wlyyHttpLogDao.save(log);
 |  |         wlyyHttpLogDao.save(log);
 | 
												
													
														
															|  |         return res;
 |  |         return res;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  |     
 | 
												
													
														
															|  | 
 |  |     public String registDianziBingli(String outPatientId,BasePatientDO basePatientDO,Integer manageType) throws Exception {
 | 
												
													
														
															|  | 
 |  |     
 | 
												
													
														
															|  | 
 |  |         //调用电子病历接口注册居民信息
 | 
												
													
														
															|  | 
 |  |             String patientMappingCode =  patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
 | 
												
													
														
															|  | 
 |  |             Map<String,String> params = new HashedMap();
 | 
												
													
														
															|  | 
 |  |             params.put("type","PatientInfo");
 | 
												
													
														
															|  | 
 |  |             String xmlStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
 | 
												
													
														
															|  | 
 |  |                     "<HtRequest >" +
 | 
												
													
														
															|  | 
 |  |                     "<PatientInfo>" +
 | 
												
													
														
															|  | 
 |  |                     "<RecordFlow>"+outPatientId+"</RecordFlow >" +
 | 
												
													
														
															|  | 
 |  |                     "<PID>"+patientMappingCode+"</PID>" +
 | 
												
													
														
															|  | 
 |  |                     "<InsuranceNo>"+basePatientDO.getIdcard()+"</InsuranceNo>" +
 | 
												
													
														
															|  | 
 |  |                     "<PatientName>"+basePatientDO.getName()+"</PatientName>" +
 | 
												
													
														
															|  | 
 |  |                     "<TmpFlag>正式</TmpFlag>" +
 | 
												
													
														
															|  | 
 |  |                     "<LastName>"+basePatientDO.getName().substring(1,basePatientDO.getName().length())+"</LastName>" +
 | 
												
													
														
															|  | 
 |  |                     "<FirstName>"+basePatientDO.getName().substring(0,1)+"</FirstName>" +
 | 
												
													
														
															|  | 
 |  |                     "<PY>"+ PinYinUtils.getUpEname(basePatientDO.getName())+"</PY>" +
 | 
												
													
														
															|  | 
 |  |                     "<WB></WB>" +
 | 
												
													
														
															|  | 
 |  |                     "<SexCode>"+basePatientDO.getSex()+"</SexCode>";
 | 
												
													
														
															|  | 
 |  |             if(1 == basePatientDO.getSex()){
 | 
												
													
														
															|  | 
 |  |                 xmlStr = xmlStr + "<Sex>男</Sex>";
 | 
												
													
														
															|  | 
 |  |             }else{
 | 
												
													
														
															|  | 
 |  |                 xmlStr = xmlStr +  "<Sex>女</Sex>";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  | 
 |  |             xmlStr = xmlStr +    "<DateOfBirth>"+DateUtil.dateToStrShort(IdCardUtil.getBirthdayForIdcard(basePatientDO.getIdcard()))+"</DateOfBirth>" +
 | 
												
													
														
															|  | 
 |  |                     "<TimeOfBirth></TimeOfBirth>" +
 | 
												
													
														
															|  | 
 |  |                     "<MarriageStatusCode></MarriageStatusCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<MarriageStatus></MarriageStatus>" +
 | 
												
													
														
															|  | 
 |  |                     "<OccupationCode></OccupationCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<Occupation></Occupation>" +
 | 
												
													
														
															|  | 
 |  |                     "<NationalityCode></NationalityCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<Nationality></Nationality>" +
 | 
												
													
														
															|  | 
 |  |                     "<CountryCode>CN</CountryCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<Country>中国</Country>" +
 | 
												
													
														
															|  | 
 |  |                     "<FormalSchoolingCode></FormalSchoolingCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<FormalSchooling></FormalSchooling>" +
 | 
												
													
														
															|  | 
 |  |                     "<Religion></Religion>" +
 | 
												
													
														
															|  | 
 |  |                     "<BirthPlaceCode></BirthPlaceCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<BirthPlace></BirthPlace>" +
 | 
												
													
														
															|  | 
 |  |                     "<NativePlaceCode></NativePlaceCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<NativePlace></NativePlace>" +
 | 
												
													
														
															|  | 
 |  |                     "<BloodType></BloodType>" +
 | 
												
													
														
															|  | 
 |  |                     "<CertTypeCode>111</CertTypeCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<CertType>身份证</CertType>" +
 | 
												
													
														
															|  | 
 |  |                     "<CertNo>"+basePatientDO.getIdcard()+"</CertNo>" +
 | 
												
													
														
															|  | 
 |  |                     "<PatientClassCode></PatientClassCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<PatientClass></PatientClass>" +
 | 
												
													
														
															|  | 
 |  |                     "<FeeTypeCode></FeeTypeCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<FeeType></FeeType>" +
 | 
												
													
														
															|  | 
 |  |                     "<Company></Company>" +
 | 
												
													
														
															|  | 
 |  |                     "<PublicExpenseNo></PublicExpenseNo>" +
 | 
												
													
														
															|  | 
 |  |                     "<ContractUnitCode></ContractUnitCode> " +
 | 
												
													
														
															|  | 
 |  |                     "<ContractUnit></ContractUnit>" +
 | 
												
													
														
															|  | 
 |  |                     "<BusinessAddressCode></BusinessAddressCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<BusinessAddress></BusinessAddress>" +
 | 
												
													
														
															|  | 
 |  |                     "<BusinessPostCode></BusinessPostCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<BusinessPhone></BusinessPhone>" +
 | 
												
													
														
															|  | 
 |  |                     "<HomeAddressCode></HomeAddressCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<HomeAddress></HomeAddress>" +
 | 
												
													
														
															|  | 
 |  |                     "<HomePostCode></HomePostCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<MobilePhone></MobilePhone>" +
 | 
												
													
														
															|  | 
 |  |                     "<Contact></Contact>" +
 | 
												
													
														
															|  | 
 |  |                     "<RelationCode></RelationCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<Relation></Relation>" +
 | 
												
													
														
															|  | 
 |  |                     "<ContactEmail></ContactEmail>" +
 | 
												
													
														
															|  | 
 |  |                     "<ContactMethod></ContactMethod>" +
 | 
												
													
														
															|  | 
 |  |                     "<VIPType></VIPType>" +
 | 
												
													
														
															|  | 
 |  |                     "<OperatorID></OperatorID>" +
 | 
												
													
														
															|  | 
 |  |                     "<Operator></Operator>" +
 | 
												
													
														
															|  | 
 |  |                     "<OperatorTime>0</OperatorTime>" +
 | 
												
													
														
															|  | 
 |  |                     "<Available></Available>" +
 | 
												
													
														
															|  | 
 |  |                     "<ManageType>"+manageType+"</ManageType>" +
 | 
												
													
														
															|  | 
 |  |                     "<InsuranceTypeCode></InsuranceTypeCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<InsuranceType></InsuranceType>" +
 | 
												
													
														
															|  | 
 |  |                     "<RegisteredAddressCode></RegisteredAddressCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<RegisteredAddress></RegisteredAddress>" +
 | 
												
													
														
															|  | 
 |  |                     "<ContactAddressCode></ContactAddressCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<ContactAddress></ContactAddress>" +
 | 
												
													
														
															|  | 
 |  |                     "<RegisteredPostCode></RegisteredPostCode>" +
 | 
												
													
														
															|  | 
 |  |                     "<ContactPostcode></ContactPostcode>" +
 | 
												
													
														
															|  | 
 |  |                     "<BloodType></BloodType>" +
 | 
												
													
														
															|  | 
 |  |                     "<RhBloodType></RhBloodType>" +
 | 
												
													
														
															|  | 
 |  |                     "</PatientInfo>" +
 | 
												
													
														
															|  | 
 |  |                     "</HtRequest>";
 | 
												
													
														
															|  | 
 |  |             String returnValue = "";
 | 
												
													
														
															|  | 
 |  |             params.put("xmlStr",xmlStr);
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  | 
 |  |             returnValue = WebserviceUtil.post("http://192.10.33.34:9080/HtMzWebService/services/Manage",
 | 
												
													
														
															|  | 
 |  |                     "http://business.htemr.haitaiinc.com",
 | 
												
													
														
															|  | 
 |  |                     "manageAdt",
 | 
												
													
														
															|  | 
 |  |                     params);
 | 
												
													
														
															|  | 
 |  |         
 | 
												
													
														
															|  | 
 |  |             logger.info("调用电子病历注册接口请求成功,返回值xmlstr:"+returnValue);
 | 
												
													
														
															|  | 
 |  |             
 | 
												
													
														
															|  | 
 |  |             return returnValue;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取诊断
 |  |      * 获取诊断
 |