|
@@ -0,0 +1,116 @@
|
|
|
|
+package com.diagbot.facade;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.diagbot.biz.push.entity.Item;
|
|
|
|
+import com.diagbot.dto.GetDiseaseIcdDTO;
|
|
|
|
+import com.diagbot.dto.HospitalInfoDTO;
|
|
|
|
+import com.diagbot.entity.HospitalInfo;
|
|
|
|
+import com.diagbot.entity.InputInfo;
|
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
|
+import com.diagbot.utils.ReadProperties;
|
|
|
|
+import com.diagbot.vo.GetDiseaseIcdVO;
|
|
|
|
+import com.diagbot.vo.HospitalInfoVO;
|
|
|
|
+import com.diagbot.vo.PushJoinVO;
|
|
|
|
+import com.diagbot.vo.PushVO;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * HIS接口对接业务
|
|
|
|
+ * @author QQ
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+@Component
|
|
|
|
+public class PushFacade {
|
|
|
|
+ @Autowired
|
|
|
|
+ MrFacade mrFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ ReadProperties readProperties;
|
|
|
|
+ @Autowired
|
|
|
|
+ InputInfoFacade inputInfoFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ HospitalInfoFacade hospitalInfoFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ TranDiseaseIcdFacade tranDiseaseIcdFacade;
|
|
|
|
+ /**
|
|
|
|
+ * 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);
|
|
|
|
+
|
|
|
|
+ //查询
|
|
|
|
+ HospitalInfoVO hospitalInfoVO=new HospitalInfoVO();
|
|
|
|
+ HospitalInfoDTO hospitalInfoDTO=hospitalInfoFacade.getHospitalInfo(hospitalInfoVO);
|
|
|
|
+ if(hospitalInfoDTO!=null && StringUtil.isNotEmpty(hospitalInfoDTO.getRemark())){
|
|
|
|
+ GetDiseaseIcdVO getDiseaseIcdVO=new GetDiseaseIcdVO();
|
|
|
|
+ getDiseaseIcdVO.setDisNames(pushVO.getDiag());
|
|
|
|
+ getDiseaseIcdVO.setHospitalCode(hospitalInfoDTO.getRemark());
|
|
|
|
+ List<GetDiseaseIcdDTO> list=tranDiseaseIcdFacade.getDiseaseIcds(getDiseaseIcdVO);
|
|
|
|
+ List<Item> diags= Lists.newArrayList();
|
|
|
|
+ list.forEach(s->{
|
|
|
|
+ Item diagOrder=new Item();
|
|
|
|
+ diagOrder.setName(s.getDiseaseName());
|
|
|
|
+ diagOrder.setUniqueName(s.getConceptDisName());
|
|
|
|
+ diags.add(diagOrder);
|
|
|
|
+ });
|
|
|
|
+ pushJoinVO.setDiag(diags);
|
|
|
|
+ pushJoinVO.setDiagOrder(diags);
|
|
|
|
+ pushJoinVO.setDiseaseName(diags.size()>0?diags.get(0):null);
|
|
|
|
+ }else{
|
|
|
|
+ List<Item> diags= Lists.newArrayList();
|
|
|
|
+ Item diagOrder=new Item();
|
|
|
|
+ diagOrder.setName(pushVO.getDiag());
|
|
|
|
+ diagOrder.setUniqueName(pushVO.getDiag());
|
|
|
|
+ diags.add(diagOrder);
|
|
|
|
+ pushJoinVO.setDiagOrder(diags);
|
|
|
|
+ pushJoinVO.setDiseaseName(diagOrder);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //将基本参数保存到redis
|
|
|
|
+ String mrId=mrFacade.createMr(pushJoinVO);
|
|
|
|
+ //竖版
|
|
|
|
+ String urlVer=readProperties.remoteAddressVer+"?hospitalCode="+pushVO.getHosCode()+"&mrId="+mrId;
|
|
|
|
+ String urlHor=readProperties.remoteAddressHor+"?hospitalCode="+pushVO.getHosCode()+"&mrId="+mrId;
|
|
|
|
+ String url="";
|
|
|
|
+ if(("2").equals(pushVO.getCode())) {
|
|
|
|
+ urlHor+="&plan="+pushVO.getCode()+"&showTab=0&tipsName=&tipsType=";
|
|
|
|
+ url=urlHor;
|
|
|
|
+ }else{
|
|
|
|
+ urlVer+="&plan="+pushVO.getCode()+"&showTab=0&tipsName=&tipsType=";
|
|
|
|
+ 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()==null?0: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);
|
|
|
|
+ }
|
|
|
|
+}
|