|
@@ -62,6 +62,110 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
|
|
|
Map<Long, PatientInfo> patientInfoMap = this.listByIds(ids).stream().filter(i -> i.getIsDeleted().equals("N")).collect(Collectors.toMap(PatientInfo::getId, i -> i));
|
|
|
return patientInfoMap;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ //保存患者信息
|
|
|
+ public PatientInfoDTO savePatientInfo(PatientInfoDTO patientInfoDTO){
|
|
|
+ PatientInfoDTO a=baseMapper.getPatientInfos(patientInfoDTO.getCode(), patientInfoDTO.getHospitalCode());
|
|
|
+ PatientInfoDTO dto=updateOrInsert(patientInfoDTO,a);
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+
|
|
|
+ private PatientInfoDTO updateOrInsert(PatientInfoDTO patientInfoDTO,PatientInfoDTO a){
|
|
|
+ PatientInfo patientInfo=new PatientInfo();
|
|
|
+ if(a!=null && a.getId()!=null){
|
|
|
+ //更新
|
|
|
+ patientInfoDTO.setId(a.getId());
|
|
|
+ BeanUtil.copyProperties(patientInfoDTO,patientInfo);
|
|
|
+ patientInfo.setId(patientInfoDTO.getId());
|
|
|
+ patientInfo.setGmtModified(new Date());
|
|
|
+ baseMapper.updateById(patientInfo);
|
|
|
+ }else{
|
|
|
+ //新增
|
|
|
+ BeanUtil.copyProperties(patientInfoDTO,patientInfo);
|
|
|
+ patientInfo.setGmtCreate(new Date());
|
|
|
+ baseMapper.insert(patientInfo);
|
|
|
+ }
|
|
|
+ return patientInfoDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据his病人就诊号获取病人信息
|
|
|
+ * @param patientInfoVO 病人各项信息
|
|
|
+ * @return 病人信息
|
|
|
+ */
|
|
|
+ public PatientInfoDTO getHisPatientInfo(@RequestBody PatientInfoVO patientInfoVO) throws ParseException {
|
|
|
+ //请求交易头head
|
|
|
+ ReqHead head = new ReqHead();
|
|
|
+ head.setTranType("ICSS_GET_PATIENT");
|
|
|
+ head.setTranKey("ICSS_GET_PATIENT");
|
|
|
+ head.setStffNo("");
|
|
|
+ head.setHospitalId("");
|
|
|
+ head.setDepartId("");
|
|
|
+ //body
|
|
|
+ PatientInfoRequest request = new PatientInfoRequest();
|
|
|
+ request.setPatientId(patientInfoVO.getPatientCode());
|
|
|
+ //将head、body组成一个请求
|
|
|
+ ReqBody<PatientInfoRequest> body = new ReqBody<PatientInfoRequest>();
|
|
|
+ body.setHead(head);
|
|
|
+ body.setBody(request);
|
|
|
+
|
|
|
+ String reqXml = JaxbUtil.convertToXml(body);
|
|
|
+ System.out.println("请求Xml : " + reqXml);
|
|
|
+ PhisLtfzzdService ps = new PhisLtfzzdServiceService().getPhisLtfzzdServicePort();
|
|
|
+ String resXml = ps.icssGETPATIENT(reqXml);
|
|
|
+ System.out.println("返回 Xml : " + resXml);
|
|
|
+
|
|
|
+ /*try {
|
|
|
+ //接口调用信息记录
|
|
|
+ HttpApi<InterfaceResponse> api = new HttpApi<InterfaceResponse>();
|
|
|
+ InterfaceInfoWrapper interfaces = new InterfaceInfoWrapper();
|
|
|
+ interfaces.setHospitalId(patientInfoVO.getHospitalCode());
|
|
|
+ interfaces.setDoctorNo(patientInfoVO.getDoctorCode());
|
|
|
+ interfaces.setDeptId(patientInfoVO.getDeptNo());
|
|
|
+ interfaces.setName("创业患者信息获取接口");
|
|
|
+ interfaces.setParamIn(reqXml);
|
|
|
+ interfaces.setParamOut(resXml);
|
|
|
+ interfaces.setTransTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
+ interfaces.setRemark("江干区中医院创业");
|
|
|
+ api.doPost("http://localhost:8082/note-web/interfaces/record", interfaces, InterfaceResponse.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }*/
|
|
|
+
|
|
|
+ //将返回的xml格式的数据拆包
|
|
|
+ PatientInfoResponseBody resBody = JaxbUtil.converyToJavaBean(resXml, PatientInfoResponseBody.class);
|
|
|
+
|
|
|
+ PatientInfoDTO patientInfo = new PatientInfoDTO();
|
|
|
+ if(resBody!=null){
|
|
|
+ if(resBody.getRet()==0){
|
|
|
+ HISPatient hISPatien = resBody.getData();
|
|
|
+ patientInfo.setCode(patientInfoVO.getPatientCode());
|
|
|
+ patientInfo.setName(hISPatien.getPatName());
|
|
|
+ patientInfo.setSex(Integer.parseInt(hISPatien.getPatSex()));
|
|
|
+ if (hISPatien.getPatBirthday() != null) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ patientInfo.setBirthday(sdf.parse(hISPatien.getPatBirthday()));
|
|
|
+ }
|
|
|
+ //patientInfo.setIdType("");
|
|
|
+ patientInfo.setIdNo(hISPatien.getPatIdentityNum());
|
|
|
+ patientInfo.setAddress(hISPatien.getPatFamAddress());
|
|
|
+ patientInfo.setPhone(hISPatien.getPatPhone());
|
|
|
+ patientInfo.setIdentityNum(hISPatien.getPatIdentityNum());
|
|
|
+ patientInfo.setPostcode(hISPatien.getPatPostcode());
|
|
|
+ patientInfo.setContacts(hISPatien.getPatContacts());
|
|
|
+ patientInfo.setContactPhone(hISPatien.getPatContactPhone());
|
|
|
+ patientInfo.setWorkUnit(hISPatien.getPatWorkUnit());
|
|
|
+ patientInfo.setOperation(hISPatien.getPatOperation());
|
|
|
+ patientInfo.setCountry(hISPatien.getPatCountry());
|
|
|
+ patientInfo.setNationality(hISPatien.getPatNationality());
|
|
|
+ //patientInfo.setMatrimony(0);//婚姻状况:0未婚,1已婚,2未知
|
|
|
+ //patientInfo.setRemark("");
|
|
|
+ return patientInfo;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
}
|