Browse Source

寓健接口代码添加

lipc 6 years ago
parent
commit
8bc9aa110e

+ 31 - 0
tran-service/pom.xml

@@ -19,6 +19,37 @@
     </parent>
 
     <dependencies>
+        <dependency>
+            <groupId>com.metaparadigm</groupId>
+            <artifactId>json-rpc</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.xml</groupId>
+            <artifactId>jaxrpc</artifactId>
+            <version>1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis</groupId>
+            <artifactId>axis</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <!-- Jackson JSON Mapper -->
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-mapper-asl</artifactId>
+            <version>1.9.13</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.module</groupId>
+            <artifactId>jackson-module-jaxb-annotations</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
         <dependency>
             <groupId>com.diagbot</groupId>
             <artifactId>common</artifactId>

+ 105 - 1
tran-service/src/main/java/com/diagbot/facade/PatientInfoFacade.java

@@ -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;
+    }
 
 }

+ 11 - 0
tran-service/src/main/java/com/diagbot/web/PatientInfoController.java

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

+ 7 - 29
tran-service/src/main/java/com/diagbot/yujian/controller/YJInquiryController.java

@@ -1,9 +1,7 @@
 package com.diagbot.yujian.controller;
 
-import com.lantone.core.api.Response;
-import com.lantone.icss.api.at.model.InquiryResult;
-import com.lantone.icss.api.at.model.wrapper.InquiryInfoWrapper;
-import com.lantone.icss.trans.yujian.service.YJInquiryService;
+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;
@@ -12,6 +10,8 @@ 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:杭州朗通信息技术有限公司 
@@ -20,12 +20,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
 */
 @Controller
 @RequestMapping("/yujian/at")
-public class YJInquiryController {
+public class InquiryController {
 	
-	private static Logger logger = LoggerFactory.getLogger(YJInquiryController.class);
+	private static Logger logger = LoggerFactory.getLogger(InquiryController.class);
 	
 	@Autowired
-	YJInquiryService inquiryService;
+    YJInquiryService inquiryService;
 
 	
 	/**
@@ -50,26 +50,4 @@ public class YJInquiryController {
 		return response.success();
 	}
 	
-
-	/**
-	 * @Description:查询
-	 * @author:ztg
-	 * @time:2017年5月12日 下午12:06:34
-	 */
-	/*@RequestMapping(value = "/searchInquiry")
-	@ResponseBody	
-	public Response<VisitedObject> searchInquiry(Long visitedId) throws Exception {
-		Response<VisitedObject> response = new Response<VisitedObject>();
-		response.start();
-		try {
-			// 调接口
-			logger.info("------------诊疗信息保存接口------------");
-			response.setData(inquiryService.searchInquiry(visitedId));
-		} catch (Exception loadException) {
-			loadException.printStackTrace();
-			logger.error("数据写入出错!", loadException);
-			return response.failure("数据写入出错!");
-		}
-		return response.success();
-	}*/
 }

+ 2 - 2
tran-service/src/main/java/com/diagbot/yujian/controller/YJInquiryMsgController.java

@@ -21,9 +21,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 */
 @Controller
 @RequestMapping("/yujian/at")
-public class YJInquiryMsgController {
+public class InquiryMsgController {
 	
-	private static Logger logger = LoggerFactory.getLogger(YJInquiryMsgController.class);
+	private static Logger logger = LoggerFactory.getLogger(InquiryMsgController.class);
 	
 	/**
 	 * @Description:保存诊断信息

+ 2 - 2
tran-service/src/main/java/com/diagbot/yujian/controller/YJPatientInfoController.java

@@ -14,9 +14,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 @Controller
 @RequestMapping("/yujian/at/patient_info")
-public class YJPatientInfoController {
+public class PatientInfoController {
 
-	private static Logger logger = LoggerFactory.getLogger(YJPatientInfoController.class);
+	private static Logger logger = LoggerFactory.getLogger(PatientInfoController.class);
 	
 	@Autowired
 	YJPatientInfoService service;

+ 33 - 0
tran-service/src/main/java/com/diagbot/yujian/model/inquiryInfo/InquiryResult.java

@@ -0,0 +1,33 @@
+package com.diagbot.yujian.model.inquiryInfo;
+
+import java.io.Serializable;
+
+/**
+ * @Description:问诊记录表
+ * @author:ztg
+ * @time:2017年3月29日 下午1:49:26
+ */
+public class InquiryResult implements Serializable{
+
+	private static final long serialVersionUID = 1L;
+	
+	private Long SCJLID;
+
+	public Long getSCJLID() {
+		return SCJLID;
+	}
+
+	public void setSCJLID(Long sCJLID) {
+		SCJLID = sCJLID;
+	}
+
+	public static long getSerialversionuid() {
+		return serialVersionUID;
+	}
+	
+	
+	
+	
+	
+	
+}