|
@@ -3,21 +3,29 @@ package com.diagbot.facade;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
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.utils.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
|
|
|
*
|
|
|
*/
|
|
@@ -25,79 +33,73 @@ import com.diagbot.vo.PushVO;
|
|
|
public class PushFacade {
|
|
|
@Autowired
|
|
|
MrFacade mrFacade;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
ReadProperties readProperties;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
InputInfoFacade inputInfoFacade;
|
|
|
-
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ SysSetFacade sysSetFacade;
|
|
|
+
|
|
|
@Autowired
|
|
|
TranLisConfigFacade tranLisConfigFacade;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
- PacsConfigFacade pacsConfigFacade;
|
|
|
-
|
|
|
+ PacsConfigFacade pacsConfigFacade;
|
|
|
+
|
|
|
@Autowired
|
|
|
- TranDiseaseIcdFacade diseaseIcdFacade;
|
|
|
+ TranDiseaseIcdFacade diseaseIcdFacade;
|
|
|
|
|
|
/**
|
|
|
- * plan: 配置信息编号,默认0
|
|
|
- * hospitalCode:医院code
|
|
|
- * mrId:医院数据唯一标识
|
|
|
- * tipsName: 静态信息名称(化验项名称、辅捡项名称)
|
|
|
- * tipsType: 静态信息类型(1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标)
|
|
|
+ * 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) {
|
|
|
- if(!"".equals(pushVO.getLisOrder()) && pushVO.getLisOrder()!=null) {
|
|
|
- pushVO.setLisOrder(pushVO.getLisOrder().replace("(", "(").replace(")", ")"));
|
|
|
- }
|
|
|
- if(!"".equals(pushVO.getPacsOrder()) && pushVO.getPacsOrder() !=null) {
|
|
|
- pushVO.setPacsOrder(pushVO.getPacsOrder().replace("(", "(").replace(")", ")"));
|
|
|
- }
|
|
|
-
|
|
|
- List<ConceptIntroduceVO> conceptIntroduceVOList=new ArrayList<ConceptIntroduceVO>();
|
|
|
-
|
|
|
-
|
|
|
- PushJoinVO pushJoinVO=new PushJoinVO();
|
|
|
+ PushJoinVO pushJoinVO = new PushJoinVO();
|
|
|
BeanUtil.copyProperties(pushVO, pushJoinVO);
|
|
|
- //将基本参数保存到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;
|
|
|
-
|
|
|
- if(("6").equals(pushVO.getCode())) {
|
|
|
- //化验静态知识
|
|
|
- //1-症状,5-化验,6-辅检,7-诊断,8-药品,9-药品大类,10-不良反应,11-药品小类,12-化验公表项,22-指标
|
|
|
- //urlHor+="&showTab=1&tipsName="+pushVO.getLisOrder()+"&tipsType=12&plan="+pushVO.getCode();
|
|
|
- urlHor+="&showTab=1&tipsInfoList="+JSONObject.toJSONString(conceptIntroduceVOList)+"&plan="+pushVO.getCode();
|
|
|
- url=urlHor;
|
|
|
- }else if(("7").equals(pushVO.getCode())) {
|
|
|
- //检查静态知识
|
|
|
- //urlHor+="&showTab=1&tipsName="+pushVO.getPacsOrder()+"&tipsType=6&plan="+pushVO.getCode();
|
|
|
- urlHor+="&showTab=1&tipsInfoList="+JSONObject.toJSONString(conceptIntroduceVOList)+"&plan="+pushVO.getCode();
|
|
|
- url=urlHor;
|
|
|
- }else if(("9").equals(pushVO.getCode())) {
|
|
|
- //门诊医嘱
|
|
|
- urlHor+="&showTab=0&tipsName="+pushVO.getDiag()+"&tipsType=7&plan="+pushVO.getCode();
|
|
|
- url=urlHor;
|
|
|
- }else {
|
|
|
- //首程、大病历、门诊病历
|
|
|
- urlVer+="&showTab=0&tipsName=&tipsType=&plan="+pushVO.getCode() ;
|
|
|
- url=urlVer;
|
|
|
+ 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>();
|
|
|
+ if (isConnect(pushVO)) {
|
|
|
+ // 比对映射表中的辅检项
|
|
|
+ getPacsConfig(conceptIntroduceVOList, pushVO);
|
|
|
+ // 比对映射表中的化验项
|
|
|
+ getLisConfig(conceptIntroduceVOList, pushVO);
|
|
|
}
|
|
|
+ // 比对映射表中的诊断名称
|
|
|
+ getDisease(conceptIntroduceVOList, pushVO);
|
|
|
+
|
|
|
+ // 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);
|
|
|
+ saveInputInfo(pushVO, url);
|
|
|
return url;
|
|
|
- }
|
|
|
-
|
|
|
- private void saveInputInfo(PushVO pushVO,String url) {
|
|
|
- InputInfo inputInfo=new InputInfo();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveInputInfo(PushVO pushVO, String url) {
|
|
|
+ InputInfo inputInfo = new InputInfo();
|
|
|
inputInfo.setHospitalCode(pushVO.getHosCode());
|
|
|
inputInfo.setHosptialDeptCode(pushVO.getHospitalDeptCopde());
|
|
|
inputInfo.setDoctorCode(pushVO.getDoctorCode());
|
|
@@ -110,7 +112,167 @@ public class PushFacade {
|
|
|
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());
|
|
|
+ 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("disease_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) {
|
|
|
+ // 调整入参中的中文符号问题,包含括号、加号等
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|