|
@@ -0,0 +1,214 @@
|
|
|
+package com.diagbot.yujian.service;
|
|
|
+
|
|
|
+import com.alibaba.dubbo.common.utils.CollectionUtils;
|
|
|
+import com.lantone.core.utils.JaxbUtil;
|
|
|
+import com.lantone.core.utils.http.HttpApi;
|
|
|
+import com.lantone.icss.api.at.model.InquiryResult;
|
|
|
+import com.lantone.icss.api.at.model.wrapper.InquiryDetailWrapper;
|
|
|
+import com.lantone.icss.api.at.model.wrapper.InquiryInfoWrapper;
|
|
|
+import com.lantone.icss.api.at.model.wrapper.InterfaceInfoWrapper;
|
|
|
+import com.lantone.icss.trans.common.listen.InitConfig;
|
|
|
+import com.lantone.icss.trans.yujian.model.InterfaceResponse;
|
|
|
+import com.lantone.icss.trans.yujian.model.ReqBody;
|
|
|
+import com.lantone.icss.trans.yujian.model.ReqHead;
|
|
|
+import com.lantone.icss.trans.yujian.model.inquiryInfo.request.InquiryInfoRequest;
|
|
|
+import com.lantone.icss.trans.yujian.model.inquiryInfo.response.InquiryResponseBody;
|
|
|
+import com.lantone.icss.trans.yujian.webservicetest.WebServicesPortTypeProxy;
|
|
|
+import net.sf.json.JSONArray;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.rmi.RemoteException;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:诊疗信息
|
|
|
+ * @author:ztg
|
|
|
+ * @time:2017年5月9日 下午3:00:36
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class YJInquiryService {
|
|
|
+ private static Logger logger = LoggerFactory.getLogger(YJInquiryService.class);
|
|
|
+
|
|
|
+ /***
|
|
|
+ * Title: Description: 调取病人信息 Company:杭州朗通信息技术有限公司
|
|
|
+ *
|
|
|
+ * @author 吴文俊
|
|
|
+ * @throws ParseException
|
|
|
+ * @date 2016年5月30日
|
|
|
+ */
|
|
|
+ public InquiryResult saveInquiryInfo(InquiryInfoWrapper info) throws RemoteException, ParseException {
|
|
|
+ ReqHead head = new ReqHead();
|
|
|
+ head.setTranKey("ICSS_POST_DIS_EMR_LIS_PACS");
|
|
|
+ head.setTranType("ICSS_POST_DIS_EMR_LIS_PACS");
|
|
|
+ head.setStffNo(info.getDoctorNo());
|
|
|
+ head.setHospitalId(info.getHospitalCode());
|
|
|
+ head.setDepartId(info.getDeptCode());
|
|
|
+
|
|
|
+ InquiryInfoRequest request = new InquiryInfoRequest();
|
|
|
+ //数据格式转换
|
|
|
+ dataFormat(info, request);
|
|
|
+
|
|
|
+ ReqBody<InquiryInfoRequest> body = new ReqBody<InquiryInfoRequest>();
|
|
|
+ body.setHead(head);
|
|
|
+ body.setBody(request);
|
|
|
+
|
|
|
+ String reqXml = JaxbUtil.convertToXml(body);
|
|
|
+ logger.info("请求Xml : " + reqXml);
|
|
|
+ WebServicesPortTypeProxy proxy = new WebServicesPortTypeProxy(InitConfig.get("yujian.webservice.url"));
|
|
|
+ String resXml = proxy.ICSS_POST_DIS_EMR_LIS_PACS(reqXml);
|
|
|
+ logger.info("返回 Xml : " + resXml);
|
|
|
+
|
|
|
+ try {
|
|
|
+ //接口调用信息记录
|
|
|
+ HttpApi<InterfaceResponse> api = new HttpApi<InterfaceResponse>();
|
|
|
+ InterfaceInfoWrapper interfaces = new InterfaceInfoWrapper();
|
|
|
+ interfaces.setHospitalId(info.getHospitalCode());
|
|
|
+ interfaces.setDoctorNo(info.getDoctorNo());
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加webservice访问寓健接口
|
|
|
+ */
|
|
|
+ InquiryResponseBody resBody = (InquiryResponseBody) JaxbUtil.converyToJavaBean(resXml, InquiryResponseBody.class);
|
|
|
+ String recordId = resBody.getData().getRecordId();
|
|
|
+ InquiryResult result = new InquiryResult();
|
|
|
+ result.setSCJLID(Long.parseLong(recordId));
|
|
|
+ //返回信息
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //数据格式转换
|
|
|
+ private void dataFormat(InquiryInfoWrapper info, InquiryInfoRequest req) {
|
|
|
+ //1、病人流水号
|
|
|
+ req.setPatientId(info.getHisPatientId());
|
|
|
+ //寓健需求参数
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+
|
|
|
+ //req.setHisCode(info.getHisCode());
|
|
|
+ //req.setHospitalId(info.getHospitalCode());
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ JSONArray detail = JSONArray.fromObject(info.getDetailStr());
|
|
|
+ List<InquiryDetailWrapper> details = (List<InquiryDetailWrapper>) JSONArray.toCollection(detail, InquiryDetailWrapper.class);
|
|
|
+
|
|
|
+ //主诉
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 0) {
|
|
|
+ sb.append(bean.getItemDescribe());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setChiefComplaint(sb.toString());
|
|
|
+ }
|
|
|
+ //现病史
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 1) {
|
|
|
+ if (!bean.getItemDescribe().equals("诊疗过程")) {
|
|
|
+ sb.append(bean.getItemDescribe());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setPresentHistory(sb.toString());
|
|
|
+ }
|
|
|
+ //既往史
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 2) {
|
|
|
+ sb.append(bean.getItemDescribe());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setPastHistory(sb.toString());
|
|
|
+ }
|
|
|
+ //其他史
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 3) {
|
|
|
+ sb.append(bean.getItemDescribe());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setOtherHistory(sb.toString());
|
|
|
+ }
|
|
|
+ //体征
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 4) {
|
|
|
+ sb.append(bean.getItemDescribe());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setSigns(sb.toString());
|
|
|
+ }
|
|
|
+ //化验
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 5) {
|
|
|
+ sb.append(bean.getItemDescribe() + ";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setAssay(sb.toString());
|
|
|
+ }
|
|
|
+ //器查
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 6) {
|
|
|
+ sb.append(bean.getItemDescribe().replace(";", " ") + ";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setSiteAdvisor(sb.toString());
|
|
|
+ }
|
|
|
+ //诊断
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 7) {
|
|
|
+ if(bean.getIcd()!=null){
|
|
|
+ sb.append(bean.getItemDescribe() + "[" + bean.getIcd() + "]" + ";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setDiagnosis(sb.toString());
|
|
|
+ }
|
|
|
+ //治疗
|
|
|
+ if (CollectionUtils.isNotEmpty(details)) {
|
|
|
+ sb.setLength(0);
|
|
|
+ for (InquiryDetailWrapper bean : details) {
|
|
|
+ if (bean.getType() == 8) {
|
|
|
+ sb.append(bean.getItemDescribe() + ";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ req.setTreatment(sb.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|