|
@@ -0,0 +1,372 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
|
+import com.diagbot.biz.push.entity.Lis;
|
|
|
+import com.diagbot.biz.push.entity.Pacs;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.diagbot.dto.SysSetInfoDTO;
|
|
|
+import com.diagbot.entity.InputInfo;
|
|
|
+import com.diagbot.enums.SysTypeEnum;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
+import com.diagbot.util.ReadProperties;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.vo.ConceptIntroduceVO;
|
|
|
+import com.diagbot.vo.HosCodeVO;
|
|
|
+import com.diagbot.vo.HospitalSetVO;
|
|
|
+import com.diagbot.vo.PushJoinVO;
|
|
|
+import com.diagbot.vo.PushVO;
|
|
|
+
|
|
|
+/**
|
|
|
+ * HIS接口对接业务
|
|
|
+ *
|
|
|
+ * @author QQ
|
|
|
+ *
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class PushFacade {
|
|
|
+ @Autowired
|
|
|
+ MrFacade mrFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ReadProperties readProperties;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ InputInfoFacade inputInfoFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ SysSetFacade sysSetFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TranLisConfigFacade tranLisConfigFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ PacsConfigFacade pacsConfigFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TranDiseaseIcdFacade diseaseIcdFacade;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * plan: 配置信息编号,默认0 hospitalCode:医院code mrId:医院数据唯一标识 tipsName:
|
|
|
+ * 静态信息名称(化验项名称、辅捡项名称) tipsType:
|
|
|
+ * 静态信息类型(1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标)
|
|
|
+ * showTab: 0默认显示治疗方案 1默认显示静态信息
|
|
|
+ *
|
|
|
+ * @param pushVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getDataService(PushVO pushVO) {
|
|
|
+ PushJoinVO pushJoinVO = new PushJoinVO();
|
|
|
+ BeanUtil.copyProperties(pushVO, pushJoinVO);
|
|
|
+ //病史
|
|
|
+ if(pushVO.getMedicalHistory()!=null){
|
|
|
+ pushJoinVO.setPasts(pushVO.getMedicalHistory().getPasts());
|
|
|
+ pushJoinVO.setInfectious(pushVO.getMedicalHistory().getInfectious());
|
|
|
+ pushJoinVO.setOperation(pushVO.getMedicalHistory().getOther());
|
|
|
+ pushJoinVO.setAllergy(pushVO.getMedicalHistory().getAllergy());
|
|
|
+ pushJoinVO.setVaccination(pushVO.getMedicalHistory().getVaccination());
|
|
|
+ pushJoinVO.setPersonal(pushVO.getMedicalHistory().getPersonal());
|
|
|
+ pushJoinVO.setMarital(pushVO.getMedicalHistory().getMarital());
|
|
|
+ pushJoinVO.setFamily(pushVO.getMedicalHistory().getFamily());
|
|
|
+ pushJoinVO.setMenstrual(pushVO.getMedicalHistory().getMenstrual());
|
|
|
+ pushJoinVO.setOther(pushVO.getMedicalHistory().getOther());
|
|
|
+ }
|
|
|
+ pushVO.setSysType(SysTypeEnum.DATA_SERVICE.getKey());//数据服务模式
|
|
|
+ // 将基本参数保存到redis
|
|
|
+ String mrId = mrFacade.createMr(pushJoinVO);
|
|
|
+ // 竖版
|
|
|
+ String url = "";
|
|
|
+ String urlVer = readProperties.remoteAddressVer + "?hospitalCode=" + pushVO.getHosCode() + "&mrId=" + mrId;
|
|
|
+ String urlHor = readProperties.remoteAddressHor + "?hospitalCode=" + pushVO.getHosCode() + "&mrId=" + mrId;
|
|
|
+
|
|
|
+ List<ConceptIntroduceVO> conceptIntroduceVOList = new ArrayList<ConceptIntroduceVO>();
|
|
|
+ List<Pacs> pacsList= Lists.newArrayList();
|
|
|
+ List<Lis> lisList= Lists.newArrayList();
|
|
|
+ List<Item> diagList= Lists.newArrayList();
|
|
|
+ //格式化化验、辅检、诊断
|
|
|
+ if (isConnect(pushVO)) {
|
|
|
+ // 比对映射表中的辅检项
|
|
|
+ if(StringUtil.isNotBlank(pushVO.getPacsOrder())){
|
|
|
+ //getPacsConfig(conceptIntroduceVOList, pushVO,pacs);
|
|
|
+ String[] pacsNames = pushVO.getPacsOrder().split("\\|");
|
|
|
+ if (pacsNames.length > 0) {
|
|
|
+ for (int i = 0; i < pacsNames.length; i++) {
|
|
|
+ Pacs pacs=new Pacs();
|
|
|
+ pacs.setName(pacsNames[i]);
|
|
|
+ pacsList.add(pacs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 比对映射表中的化验项
|
|
|
+ if(StringUtil.isNotBlank(pushVO.getLisOrder())){
|
|
|
+ //getLisConfig(conceptIntroduceVOList, pushVO);
|
|
|
+ String[] lisNames = pushVO.getLisOrder().split("\\|");
|
|
|
+ if (lisNames.length > 0) {
|
|
|
+ for (int i = 0; i < lisNames.length; i++) {
|
|
|
+ Lis lis=new Lis();
|
|
|
+ lis.setName(lisNames[i]);
|
|
|
+ lisList.add(lis);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 比对映射表中的诊断名称
|
|
|
+ if(StringUtil.isNotBlank(pushVO.getDiagOrder())){
|
|
|
+ //getDisease(conceptIntroduceVOList, pushVO);
|
|
|
+ String[] diseaseNames = pushVO.getPacsOrder().split("\\|");
|
|
|
+ if (diseaseNames.length > 0) {
|
|
|
+ for (int i = 0; i < diseaseNames.length; i++) {
|
|
|
+ Map<String, Object> diseaseMap = diseaseIcdFacade.getDiseaseIcdByDiseaseName(pushVO.getHosCode(), diseaseNames[i].toString());
|
|
|
+ if (diseaseMap!=null) {
|
|
|
+ String diseaseName = diseaseMap.get("concept_dis_name").toString();
|
|
|
+ if (StringUtil.isNotBlank(diseaseName)) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(diseaseName);
|
|
|
+ conceptIntroduceVO.setType(7);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+
|
|
|
+ Item item=new Item();
|
|
|
+ item.setName(diseaseNames[i]);
|
|
|
+ item.setUniqueName(diseaseName);
|
|
|
+ diagList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ if ("hor".equalsIgnoreCase(pushVO.getShowType())) {
|
|
|
+ // 横版
|
|
|
+ urlHor += "&showTab=1&tipsInfoList=" + JSONObject.toJSONString(conceptIntroduceVOList) + "&plan=" + pushVO.getCode();
|
|
|
+ url = urlHor;
|
|
|
+ } else {
|
|
|
+ // 竖版
|
|
|
+ urlVer += "&showTab=0&tipsInfoList=" + JSONObject.toJSONString(conceptIntroduceVOList) + "&plan=" + pushVO.getCode();
|
|
|
+ url = urlVer;
|
|
|
+ }
|
|
|
+
|
|
|
+ //将请求记录到统计表
|
|
|
+ saveInputInfo(pushVO, url);
|
|
|
+ return url;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveInputInfo(PushVO pushVO, String url) {
|
|
|
+ InputInfo inputInfo = new InputInfo();
|
|
|
+ inputInfo.setHospitalCode(pushVO.getHosCode());
|
|
|
+ inputInfo.setHosptialDeptCode(pushVO.getHospitalDeptCopde());
|
|
|
+ inputInfo.setDoctorCode(pushVO.getDoctorCode());
|
|
|
+ inputInfo.setInquiryCode(pushVO.getInquiryCode());
|
|
|
+ inputInfo.setAge(pushVO.getAge());
|
|
|
+ inputInfo.setSexType(pushVO.getSex().toString());
|
|
|
+ //inputInfo.setDiseaseName(pushVO.getDiseaseName());
|
|
|
+ inputInfo.setParamIn(JSONObject.toJSONString(pushVO));
|
|
|
+ inputInfo.setParamOut(url);
|
|
|
+ inputInfo.setTransTime(DateUtil.format(new Date(), DateUtil.DATE_TIME_FORMAT));
|
|
|
+ inputInfo.setRemark(pushVO.getCode());
|
|
|
+ inputInfoFacade.saveInputInfo(inputInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 比对诊断映射表公表项
|
|
|
+ *
|
|
|
+ * @param conceptIntroduceVOList
|
|
|
+ * @param pushVO
|
|
|
+ */
|
|
|
+ private void getDisease(List<ConceptIntroduceVO> conceptIntroduceVOList, PushVO pushVO) {
|
|
|
+ // 比对映射表中的诊断名称
|
|
|
+ if (!"".equals(pushVO.getDiag()) && pushVO.getDiag() != null) {
|
|
|
+ /*
|
|
|
+ String[] diagNames = pushVO.getDiag().split("\\|");
|
|
|
+ if (diagNames.length > 0) {
|
|
|
+ //pushVO.setDiag(diagNames[0].toString());
|
|
|
+ //pushVO.setDiseaseName(diagNames[0].toString());
|
|
|
+ if (isConnect(pushVO)) {
|
|
|
+ for (int i = 0; i < diagNames.length; i++) {
|
|
|
+ Map<String, Object> diseaseMap = diseaseIcdFacade.getDiseaseIcdByDiseaseName(pushVO.getHosCode(), diagNames[i].toString());
|
|
|
+ if (diseaseMap!=null) {
|
|
|
+ String diseaseName = diseaseMap.get("concept_dis_name").toString();
|
|
|
+ if (!"".equals(diseaseName) && diseaseName != null) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(diseaseName);
|
|
|
+ conceptIntroduceVO.setType(7);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < diagNames.length; i++) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(diagNames[i]);
|
|
|
+ conceptIntroduceVO.setType(7);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取公表项中对应的辅检,未查询到时去化验公表项再查
|
|
|
+ *
|
|
|
+ * @param pushVO
|
|
|
+ */
|
|
|
+ private void getPacsConfig(List<ConceptIntroduceVO> conceptIntroduceVOList, PushVO pushVO,List<Pacs> pacsList) {
|
|
|
+
|
|
|
+ pushVO.setPacsOrder(pushVO.getPacsOrder().replace("(", "(").replace(")", ")"));
|
|
|
+ // 比对映射表中的辅检项
|
|
|
+ Map<String, Object> pacsMap = pacsConfigFacade.getPacsConfigByMealname(pushVO.getHosCode(),
|
|
|
+ pushVO.getPacsOrder());
|
|
|
+ if (pacsMap!=null) {
|
|
|
+ String uniqueName = pacsMap.get("unique_name").toString();
|
|
|
+ if (!"".equals(uniqueName) && uniqueName != null) {
|
|
|
+ String[] uniqueNames = uniqueName.split("、");
|
|
|
+ for (int i = 0; i < uniqueNames.length; i++) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(uniqueNames[i]);
|
|
|
+ conceptIntroduceVO.setType(6);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ // 调整入参中的中文符号问题,包含括号、加号等
|
|
|
+ if (!"".equals(pushVO.getPacsOrder()) && pushVO.getPacsOrder() != null) {
|
|
|
+
|
|
|
+ pushVO.setPacsOrder(pushVO.getPacsOrder().replace("(", "(").replace(")", ")"));
|
|
|
+ // 比对映射表中的辅检项
|
|
|
+ Map<String, Object> pacsMap = pacsConfigFacade.getPacsConfigByMealname(pushVO.getHosCode(),
|
|
|
+ pushVO.getPacsOrder());
|
|
|
+ if (pacsMap!=null) {
|
|
|
+ String uniqueName = pacsMap.get("unique_name").toString();
|
|
|
+ if (!"".equals(uniqueName) && uniqueName != null) {
|
|
|
+ String[] uniqueNames = uniqueName.split("、");
|
|
|
+ for (int i = 0; i < uniqueNames.length; i++) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(uniqueNames[i]);
|
|
|
+ conceptIntroduceVO.setType(6);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Map<String, Object> lisMap = tranLisConfigFacade.getLisConfigByMealName(pushVO.getHosCode(),
|
|
|
+ pushVO.getPacsOrder());
|
|
|
+ if (lisMap!=null) {
|
|
|
+ String uniqueName = lisMap.get("unique_name").toString();
|
|
|
+ String[] uniqueNames = uniqueName.split("、");
|
|
|
+ for (int i = 0; i < uniqueNames.length; i++) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(uniqueNames[i]);
|
|
|
+ conceptIntroduceVO.setType(12);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取公表项中对应的化验,未查询到时去辅检公表项再查
|
|
|
+ *
|
|
|
+ * @param conceptIntroduceVOList
|
|
|
+ * @param pushVO
|
|
|
+ */
|
|
|
+ private void getLisConfig(List<ConceptIntroduceVO> conceptIntroduceVOList, PushVO pushVO) {
|
|
|
+ // 比对映射表中的化验项
|
|
|
+ if (!"".equals(pushVO.getLisOrder()) && pushVO.getLisOrder() != null) {
|
|
|
+ /*
|
|
|
+ pushVO.setLisOrder(pushVO.getLisOrder().replace("(", "(").replace(")", ")"));
|
|
|
+ Map<String, Object> lisMap = tranLisConfigFacade.getLisConfigByMealName(pushVO.getHosCode(),
|
|
|
+ pushVO.getLisOrder());
|
|
|
+ if (lisMap!=null) {
|
|
|
+ String uniqueName = lisMap.get("unique_name").toString();
|
|
|
+ String[] uniqueNames = uniqueName.split("、");
|
|
|
+ for (int i = 0; i < uniqueNames.length; i++) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(uniqueNames[i]);
|
|
|
+ conceptIntroduceVO.setType(12);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 比对映射表中的辅检项
|
|
|
+ Map<String, Object> pacsMap = pacsConfigFacade.getPacsConfigByMealname(pushVO.getHosCode(),
|
|
|
+ pushVO.getLisOrder());
|
|
|
+ if (pacsMap != null) {
|
|
|
+ String uniqueName = pacsMap.get("unique_name").toString();
|
|
|
+ if (!"".equals(uniqueName) && uniqueName != null) {
|
|
|
+ String[] uniqueNames = uniqueName.split("、");
|
|
|
+ for (int i = 0; i < uniqueNames.length; i++) {
|
|
|
+ ConceptIntroduceVO conceptIntroduceVO = new ConceptIntroduceVO();
|
|
|
+ conceptIntroduceVO.setName(uniqueNames[i]);
|
|
|
+ conceptIntroduceVO.setType(6);// 1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
+ conceptIntroduceVO.setPosition(1);// 1-摘要,2-全文,5-药品说明书,6-不良反应
|
|
|
+ conceptIntroduceVOList.add(conceptIntroduceVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询是否开启对接公表
|
|
|
+ *
|
|
|
+ * @param pushVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Boolean isConnect(PushVO pushVO) {
|
|
|
+ // 是否对接
|
|
|
+ Boolean isConnect = false;
|
|
|
+ if (StringUtil.isNotBlank(pushVO.getHosCode())) {
|
|
|
+ HosCodeVO hosCodeVO = new HosCodeVO();
|
|
|
+ hosCodeVO.setHosCode(pushVO.getHosCode());
|
|
|
+ HospitalSetVO hospitalSetVO = new HospitalSetVO();
|
|
|
+ hospitalSetVO.setHospitalCode(pushVO.getHosCode());
|
|
|
+ hospitalSetVO.setCode("connect");
|
|
|
+ if (pushVO.getSysType() != null) {
|
|
|
+ hospitalSetVO.setSysType(pushVO.getSysType());
|
|
|
+ } else {
|
|
|
+ hospitalSetVO.setSysType(SysTypeEnum.DATA_SERVICE.getKey());
|
|
|
+ }
|
|
|
+ List<SysSetInfoDTO> sysSetInfoList = sysSetFacade.getSysSetInfoData(hospitalSetVO);
|
|
|
+ if (sysSetInfoList.size() > 0) {
|
|
|
+ if (ListUtil.isNotEmpty(sysSetInfoList)) {
|
|
|
+ if (sysSetInfoList.get(0).getValue().equals(1)) {
|
|
|
+ isConnect = true;
|
|
|
+ } else {
|
|
|
+ isConnect = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ isConnect = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return isConnect;
|
|
|
+ }
|
|
|
+}
|