Browse Source

寓健接口代码修改

lipc 6 years ago
parent
commit
fea689debd

+ 22 - 3
icss-service/src/main/java/com/diagbot/vo/SaveInquiryToHisVO.java

@@ -13,9 +13,28 @@ import lombok.Setter;
 @Getter
 @Setter
 public class SaveInquiryToHisVO {
-	
+
 	private List<String> contentList;
-	
 
-   
+	private Long hospitalId;
+
+	private Long doctorId;
+
+	private Long hospitalDeptId;
+
+	private Long patientId;
+
+	private Long inquiryCode;
+
+	//寓健额外要求参数
+	private String feeType;
+
+	private String hisCode;
+
+	private String clinicNo;
+
+	private String clinicTypeId;
+
+	private String userId;
+
 }

+ 31 - 38
tran-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -1,5 +1,6 @@
 package com.diagbot.facade;
 
+import java.rmi.RemoteException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -10,7 +11,9 @@ import com.diagbot.util.BeanUtil;
 import com.diagbot.yujian.model.ReqBody;
 import com.diagbot.yujian.model.ReqHead;
 import com.diagbot.yujian.model.patientInfo.request.PatientInfoRequest;
+import com.diagbot.yujian.model.patientInfo.response.HISPatient;
 import com.diagbot.yujian.model.patientInfo.response.PatientInfoResponseBody;
+import com.diagbot.yujian.util.JaxbUtil;
 import com.diagbot.yujian.webservicetest.WebServicesPortTypeProxy;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -101,7 +104,7 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
      * @param patientInfoVO 病人各项信息
      * @return 病人信息
      */
-    public PatientInfoDTO getHisPatientInfo(@RequestBody PatientInfoVO patientInfoVO) throws ParseException {
+    public PatientInfoDTO getHisPatientInfo(@RequestBody PatientInfoVO patientInfoVO) throws ParseException, RemoteException {
 
         //请求交易头head
         ReqHead head = new ReqHead();
@@ -124,61 +127,51 @@ public class PatientInfoFacade extends PatientInfoServiceImpl {
         String resXml=proxy.ICSS_GET_PATIENT(reqXml);
         System.out.println("返回 Xml : " + resXml);
 
-        /*try {
-            //接口调用信息记录
-            HttpApi<InterfaceResponse> api = new HttpApi<InterfaceResponse>();
-            InterfaceInfoWrapper interfaces = new InterfaceInfoWrapper();
-            interfaces.setHospitalId(patient.getHospitalCode());
-            interfaces.setDoctorNo(patient.getDoctorCode());
-            interfaces.setName("创业保存接口");
-            interfaces.setParamIn(reqXml);
-            interfaces.setParamOut(resXml);
-            interfaces.setTransTime(new Date().toString());
-            api.doPost(InitConfig.get("save.interfaces.record.url"), interfaces, InterfaceResponse.class);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }*/
+		/*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 = (PatientInfoResponseBody) JaxbUtil.converyToJavaBean(resXml,
-                PatientInfoResponseBody.class);
+        PatientInfoResponseBody resBody = JaxbUtil.converyToJavaBean(resXml, PatientInfoResponseBody.class);
 
-        PatientInfo patientInfo = new PatientInfo();
+        PatientInfoDTO patientInfo = new PatientInfoDTO();
         if(resBody!=null){
             if(resBody.getRet()==0){
                 HISPatient hISPatien = resBody.getData();
-                patientInfo.setId(Long.parseLong(patient.getHisCode()));
+                patientInfo.setCode(patientInfoVO.getPatientCode());
                 patientInfo.setName(hISPatien.getPatName());
-                patientInfo.setSex(hISPatien.getPatSex());
+                patientInfo.setSex(Integer.parseInt(hISPatien.getPatSex()));
                 if (hISPatien.getPatBirthday() != null) {
-                    SimpleDateFormat sdf=new SimpleDateFormat("yyyy-mm-dd");//小写的mm表示的是分钟
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                     patientInfo.setBirthday(sdf.parse(hISPatien.getPatBirthday()));
                 }
-                patientInfo.setHisCode(patient.getHisCode());
-                if((hISPatien.getNatureId()).equals("3")){
-                    patientInfo.setNatureId("2");
-                }else{
-                    patientInfo.setNatureId(hISPatien.getNatureId());
-                }
+                //patientInfo.setIdType("");
                 patientInfo.setIdNo(hISPatien.getPatIdentityNum());
                 patientInfo.setAddress(hISPatien.getPatFamAddress());
+                patientInfo.setPhone(hISPatien.getPatPhone());
+                patientInfo.setIdentityNum(hISPatien.getPatIdentityNum());
                 patientInfo.setPostcode(hISPatien.getPatPostcode());
-                patientInfo.setContactPhone(hISPatien.getPatContactPhone());
                 patientInfo.setContacts(hISPatien.getPatContacts());
-                patientInfo.setPhone(hISPatien.getPatPhone());
+                patientInfo.setContactPhone(hISPatien.getPatContactPhone());
                 patientInfo.setWorkUnit(hISPatien.getPatWorkUnit());
                 patientInfo.setOperation(hISPatien.getPatOperation());
                 patientInfo.setCountry(hISPatien.getPatCountry());
                 patientInfo.setNationality(hISPatien.getPatNationality());
-                patientInfo.setMatrimony(hISPatien.getPatMatrimony());
-                patientInfo.setHisPrevious(hISPatien.getPatHisPrevious());
-                patientInfo.setHisAllergic(hISPatien.getPatHisAllergic());
-                patientInfo.setHisFamily(hISPatien.getPatHisFamily());
-                patientInfo.setRecordDate(hISPatien.getPatRecordDate());
-                patientInfo.setMemGrade(hISPatien.getPatMemGrade());
-                patientInfo.setCardNum(hISPatien.getPatCardNum());
-                patientInfo.setFeeId(hISPatien.getFeeId());
-
+                //patientInfo.setMatrimony(0);//婚姻状况:0未婚,1已婚,2未知
+                //patientInfo.setRemark("");
                 return patientInfo;
             }
             return null;

+ 20 - 1
tran-service/src/main/java/com/diagbot/vo/SaveInquiryToHisVO.java

@@ -16,6 +16,25 @@ public class SaveInquiryToHisVO {
 	
 	private List<String> contentList;
 	
+	private Long hospitalId;
+
+	private Long doctorId;
+
+	private Long hospitalDeptId;
+
+	private Long patientId;
+
+	private Long inquiryCode;
+
+	//寓健额外要求参数
+	private String feeType;
+
+	private String hisCode;
+
+	private String clinicNo;
+
+	private String clinicTypeId;
+
+	private String userId;
 
-   
 }

+ 141 - 8
tran-service/src/main/java/com/diagbot/web/InquiryInfoController.java

@@ -2,6 +2,17 @@ package com.diagbot.web;
 
 import javax.validation.Valid;
 
+import com.diagbot.dto.HisInquirysForDjDTO;
+import com.diagbot.facade.HospitalInfoFacade;
+import com.diagbot.facade.TranDiseaseIcdFacade;
+import com.diagbot.vo.*;
+import com.diagbot.yujian.model.InterfaceResponse;
+import com.diagbot.yujian.model.ReqBody;
+import com.diagbot.yujian.model.ReqHead;
+import com.diagbot.yujian.model.inquiryInfo.request.InquiryInfoRequest;
+import com.diagbot.yujian.model.inquiryInfo.response.InquiryResponseBody;
+import com.diagbot.yujian.util.JaxbUtil;
+import com.diagbot.yujian.webservicetest.WebServicesPortTypeProxy;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -11,10 +22,14 @@ import org.springframework.web.bind.annotation.RestController;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.InquiryInfoFacade;
-import com.diagbot.vo.SaveInquiryToHisVO;
 
 import io.swagger.annotations.Api;
 
+import java.rmi.RemoteException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * 对接问诊信息控制器
@@ -31,16 +46,134 @@ public class InquiryInfoController {
 	
 	 @Autowired
 	 private InquiryInfoFacade inquiryInfoFacade;
-	 
+	 @Autowired
+	 private HospitalInfoFacade hospitalInfoFacade;
+	@Autowired
+	private TranDiseaseIcdFacade diseaseIcdFacade;
 	 @PostMapping("/saveInquiryToHis")
 	 @SysLogger("saveInquiryToHis")
-	 public RespDTO<Boolean> saveInquiryToHis(@Valid @RequestBody SaveInquiryToHisVO saveInquiryToHisVO) {
-		 
-		 
-		
-	     return RespDTO.onSuc(true);
+	 public RespDTO<Boolean> saveInquiryToHis(@Valid @RequestBody SaveInquiryToHisVO saveInquiryToHisVO) throws RemoteException {
+		 ReqHead head = new ReqHead();
+		 head.setTranKey("ICSS_POST_DIS_EMR_LIS_PACS");
+		 head.setTranType("ICSS_POST_DIS_EMR_LIS_PACS");
+		 head.setStffNo(saveInquiryToHisVO.getDoctorId().toString());
+		 head.setHospitalId(saveInquiryToHisVO.getHospitalId().toString());
+		 head.setDepartId(saveInquiryToHisVO.getHospitalDeptId().toString());
+
+		 InquiryInfoRequest request = new InquiryInfoRequest();
+		 //数据格式转换
+		 dataFormat(saveInquiryToHisVO, request);
+
+		 ReqBody<InquiryInfoRequest> body = new ReqBody<InquiryInfoRequest>();
+		 body.setHead(head);
+		 body.setBody(request);
+
+		 String reqXml = JaxbUtil.convertToXml(body);
+		 System.out.println("请求Xml : " + reqXml);
+		 WebServicesPortTypeProxy proxy = new WebServicesPortTypeProxy("http://118.31.73.190:8081/APP_Webservicesfuzl/service/WebServices");
+		 String resXml = proxy.ICSS_POST_DIS_EMR_LIS_PACS(reqXml);
+		 System.out.println("返回 Xml : " + resXml);
+
+		 /*try {
+			 //接口调用信息记录
+			 HttpApi<InterfaceResponse> api = new HttpApi<InterfaceResponse>();
+			 InterfaceInfoWrapper interfaces = new InterfaceInfoWrapper();
+			 interfaces.setHospitalId(saveInquiryToHisVO.getHospitalId().toString());
+			 interfaces.setDoctorNo(saveInquiryToHisVO.getDoctorId().toString());
+			 interfaces.setDeptId(saveInquiryToHisVO.getHospitalDeptId().toString());
+			 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://127.0.0.1:8082/note-web/interfaces/record", interfaces, InterfaceResponse.class);
+		 } catch (Exception e) {
+			 e.printStackTrace();
+		 }*/
+
+		 /**
+		  * 添加webservice访问寓健接口
+		  */
+		 InquiryResponseBody resBody = (InquiryResponseBody) JaxbUtil.converyToJavaBean(resXml, InquiryResponseBody.class);
+		 String recordId = resBody.getData().getRecordId();
+		 if(recordId!=null&&!"".equals(recordId)){
+			 return RespDTO.onSuc(true);
+		 }else{
+			 return RespDTO.onSuc(false);
+		 }
+
 	 }
-	 
+
+	//数据格式转换
+	private void dataFormat(SaveInquiryToHisVO info, InquiryInfoRequest req) {
+		//1、病人流水号
+		req.setPatientId(info.getPatientId().toString());
+		//寓健需求参数
+		if (info.getFeeType() != null) {
+			req.setFeetype(info.getFeeType());
+		}
+		if (info.getHisCode() != null) {
+			req.setBrjzId(info.getHisCode());
+		}
+		if (info.getClinicNo() != null) {
+			req.setClinicno(info.getClinicNo());
+		}
+		if (info.getClinicTypeId() != null) {
+			req.setClinictypeid(info.getClinicTypeId());
+		}
+		if (info.getUserId() != null) {
+			req.setUserid(info.getUserId());
+		}
+
+		StringBuffer sb = new StringBuffer();
+		//诊断
+		String diagnose = info.getContentList().get(6);
+		//diagnose格式 上呼吸道感染(初诊);糖尿病(初诊); 分割成["上呼吸道感染(初诊)","糖尿病(初诊)",""]
+		String[] disease = diagnose.split(";");
+		//循环去掉(初诊)
+		for(int i = 0; i < disease.length; i ++){
+			if(disease[i]!=null && !"".equals(disease[i].trim())){
+				disease[i] = disease[i].substring(0, disease[i].indexOf("("));
+			}
+		}
+		//通过本地数据库的医院id获取医院编码
+		HospitalInfoVO hospitalInfoVO = new HospitalInfoVO();
+		hospitalInfoVO.setId(info.getHospitalId());
+		String code = hospitalInfoFacade.getHospitalInfo(hospitalInfoVO).get(0).getCode();
+		GetDiseaseIcdVO getDiseaseIcdVO = new GetDiseaseIcdVO();
+		getDiseaseIcdVO.setHospitalCode(code);
+		//诊断返回格式:疾病名称[icd];疾病名称[icd];...
+		StringBuffer icd = null;
+		for(int j = 0;j < disease.length; j ++){
+			if(disease[j]!=null && !"".equals(disease[j].trim())) {
+				getDiseaseIcdVO.setQuestions(disease[j]);
+				icd = new StringBuffer(diseaseIcdFacade.getDiseaseIcds(getDiseaseIcdVO).get(0).getIcd());
+				sb.append(disease[j] + "[" + icd + "]" + ";");
+			}
+		}
+
+        //主诉
+        req.setChiefComplaint(info.getContentList().get(0));
+        //现病史
+        req.setPresentHistory(info.getContentList().get(1));
+        //既往史
+        req.setPastHistory(info.getContentList().get(2));
+        //其他史
+        req.setOtherHistory(info.getContentList().get(2));
+        //查体
+        req.setSigns(info.getContentList().get(3));
+        //化验
+        req.setAssay(info.getContentList().get(4));
+        //辅检
+        req.setSiteAdvisor(info.getContentList().get(5));
+        //诊断
+        req.setDiagnosis(icd.toString());
+        //治疗
+        req.setTreatment(info.getContentList().get(7));
+
+
+	}
+
 	 @PostMapping("/hisInquirysForDj")
 	 @SysLogger("hisInquirysForDj")
 	 public RespDTO<Object> hisInquirysForDj() {

+ 2 - 1
tran-service/src/main/java/com/diagbot/web/PatientInfoController.java

@@ -1,6 +1,7 @@
 package com.diagbot.web;
 
 
+import java.rmi.RemoteException;
 import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
@@ -79,7 +80,7 @@ public class PatientInfoController {
     @PostMapping(value = "/getHisPatientInfo")
     @SysLogger("getHisPatientInfo")
     @ApiOperation(value = "根据his病人就诊号获取病人信息[by:lipc]")
-    public RespDTO<PatientInfoDTO> getHisPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) throws ParseException {
+    public RespDTO<PatientInfoDTO> getHisPatientInfo(@Valid @RequestBody PatientInfoVO patientInfoVO) throws ParseException, RemoteException {
         PatientInfoDTO result = patientInfoFacade.getHisPatientInfo(patientInfoVO);
         patientInfoFacade.savePatientInfo(result);
         return RespDTO.onSuc(result);

+ 0 - 53
tran-service/src/main/java/com/diagbot/yujian/controller/InquiryController.java

@@ -1,53 +0,0 @@
-package com.diagbot.yujian.controller;
-
-import com.diagbot.yujian.model.inquiryInfo.InquiryResult;
-import com.diagbot.yujian.service.YJInquiryService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.xml.ws.Response;
-
-/***Title: 
-*	Description: 疾病电子病历检验检查写回
-*	Company:杭州朗通信息技术有限公司 
-	@author 吴文俊
-	@date 2016年5月30日
-*/
-@Controller
-@RequestMapping("/yujian/at")
-public class InquiryController {
-	
-	private static Logger logger = LoggerFactory.getLogger(InquiryController.class);
-	
-	@Autowired
-    YJInquiryService inquiryService;
-
-	
-	/**
-	 * @Description:保存诊断信息
-	 * @author:ztg
-	 * @time:2017年5月12日 下午12:04:50
-	 */
-	@RequestMapping(value = "/saveInquiry")
-	@ResponseBody
-	public Response<InquiryResult> saveInquiry(@RequestBody InquiryInfoWrapper info) throws Exception {
-		Response<InquiryResult> response = new Response<InquiryResult>();
-		response.start();
-		try {
-			// 调接口
-			logger.info("------------诊疗信息保存接口------------");
-			response.setData(inquiryService.saveInquiryInfo(info));
-		} catch (Exception loadException) {
-			loadException.printStackTrace();
-			logger.error("数据写入出错!", loadException);
-			return response.failure("数据写入出错!");
-		}
-		return response.success();
-	}
-	
-}

+ 0 - 64
tran-service/src/main/java/com/diagbot/yujian/controller/InquiryMsgController.java

@@ -1,64 +0,0 @@
-package com.diagbot.yujian.controller;
-
-import com.lantone.core.api.Response;
-import com.lantone.core.utils.http.HttpApi;
-import com.lantone.icss.api.at.model.wrapper.InquiryMsgWrapper;
-import com.lantone.icss.trans.common.listen.InitConfig;
-import com.lantone.icss.trans.yujian.model.inquiryMsg.response.LsData;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-/***Title: 
-*	Description: 疾病电子病历检验检查写回
-*	Company:杭州朗通信息技术有限公司 
-	@author 吴文俊
-	@date 2016年5月30日
-*/
-@Controller
-@RequestMapping("/yujian/at")
-public class InquiryMsgController {
-	
-	private static Logger logger = LoggerFactory.getLogger(InquiryMsgController.class);
-	
-	/**
-	 * @Description:保存诊断信息
-	 * @author:lpc
-	 * @time:2017年6月119日 下午16:04:50
-	 */
-	@ResponseBody
-	@RequestMapping(value="/saveinquirymsg_yujian",produces = "application/json; charset=utf-8",method=RequestMethod.POST)
-	public LsData saveInquirymsg(@RequestBody String patdescribe) throws Exception {
-		Response<Object> response = new Response<Object>();
-		response.start();
-		LsData lsData=new LsData();
-		try {
-			HttpApi<Response> httpApi = new HttpApi<Response>();
-			logger.info("---his就诊记录获取---"+patdescribe);
-			if(patdescribe!=null){
-				InquiryMsgWrapper infomsg=new InquiryMsgWrapper();
-				//String data=URLDecoder.decode(patdescribe.substring(0, patdescribe.length()-1),"UTF-8");
-				infomsg.setPatdescribe(patdescribe);
-				response= httpApi.doPost(InitConfig.get("yujian.inquirymsg.url"), infomsg, Response.class);
-				lsData.setRet(response.getRet());
-				lsData.setMsg(response.getMsg());
-				return lsData;
-			}else{
-				lsData.setRet(1);
-				lsData.setMsg("发送数据为空");
-				return lsData;
-			}	
-		} catch (Exception loadException) {
-			loadException.printStackTrace();
-			logger.error("数据写入出错:", loadException);
-			lsData.setRet(1);
-			lsData.setMsg("数据写入出错:"+loadException.getMessage());
-			return lsData;
-		}
-	}
-
-}

+ 0 - 43
tran-service/src/main/java/com/diagbot/yujian/controller/PatientInfoController.java

@@ -1,43 +0,0 @@
-package com.diagbot.yujian.controller;
-
-import com.lantone.core.api.Response;
-import com.lantone.icss.api.at.model.PatientInfo;
-import com.lantone.icss.api.at.model.wrapper.PatientInfoWrapper;
-import com.lantone.icss.trans.yujian.service.YJPatientInfoService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-@Controller
-@RequestMapping("/yujian/at/patient_info")
-public class PatientInfoController {
-
-	private static Logger logger = LoggerFactory.getLogger(PatientInfoController.class);
-	
-	@Autowired
-	YJPatientInfoService service;
-	//根据病人证号查询病人详细信息
-	@RequestMapping(value = "/get_patient_info")
-	@ResponseBody
-	public Response<PatientInfo> getPatientInfo(@RequestBody PatientInfoWrapper patientInfoWrapper) throws Exception {
-		Response<PatientInfo> response = new Response<PatientInfo>();
-		response.start();
-		try {
-			PatientInfo patientInfo = service.remotePatientInfo(patientInfoWrapper);
-			if(patientInfo!=null){
-				response.setData(patientInfo);
-			}else{
-				return response.failure("无数据!");
-			}
-		} catch (Exception loadException) {
-			loadException.printStackTrace();
-			logger.error("数据查看出错!", loadException);
-			return response.failure("数据查看出错!");
-		}
-		return response.success();
-	}
-}