Browse Source

Merge remote-tracking branch 'origin/his/csxy3' into his/csxy3

wangsy 3 years ago
parent
commit
6afb1fa880
1 changed files with 40 additions and 7 deletions
  1. 40 7
      src/main/java/com/diagbot/facade/ViewFacade.java

+ 40 - 7
src/main/java/com/diagbot/facade/ViewFacade.java

@@ -2,13 +2,12 @@ package com.diagbot.facade;
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.facade.data.*;
-import com.diagbot.util.DateUtil;
-import com.diagbot.util.ReadProperties;
-import com.diagbot.util.TZDBConn;
+import com.diagbot.util.*;
 import com.diagbot.vo.AnalyzeRunVO;
 import com.diagbot.vo.OldInfoVo;
 import com.diagbot.vo.data.XyHomePageVo;
@@ -286,14 +285,21 @@ public class ViewFacade {
         //从视图拉取数据
 
         String homepageSql = "select * from homePage where behospitalCode= '" + xyHomePageVo.getBehospitalCode() + "' and behospitalnum= '" + xyHomePageVo.getFileCode() + "'";
-        String diagSql = "select * from homePage_diag where behospitalCode= '" + xyHomePageVo.getBehospitalCode() + "' and behospitalnum= '" + xyHomePageVo.getFileCode() + "'";
+        String diagSql = "select * from homePage_diag where behospitalCode= '" + xyHomePageVo.getBehospitalCode() + "' and behospitalnum= '" + xyHomePageVo.getFileCode() + "' and diagnosetype='出院诊断'";
         String opsSql = "select * from homePage_operation where behospitalCode= '" + xyHomePageVo.getBehospitalCode() + "' and behospitalnum= '" + xyHomePageVo.getFileCode() + "'";
-
         this.getHomePage(homepageSql);
         this.getHomeDiagnose(diagSql);
         this.getHomeOperation(opsSql);
-
-
+        //查询门急诊诊断
+        String diagnoseSql = "select diagnoseName from homePage_diag where behospitalCode= '" + xyHomePageVo.getBehospitalCode() + "' and behospitalnum= '" + xyHomePageVo.getFileCode() + "' and diagnosetype='门诊诊断'";
+        HomePage homePage=getHomeDiagnoseAndCode(diagnoseSql);
+        UpdateWrapper<HomePage> updateWrapper=new UpdateWrapper<>();
+        updateWrapper.eq("behospital_code",behospitalCode)
+                .eq("hospital_id", xyHomePageVo.getHospitalId())
+                .eq("home_page_id", homePage.getHomePageId())
+                .set("outpatient_emr_diagnose",homePage.getOutpatientEmrDiagnose())
+                .set("outpatient_emr_diagnose_code",homePage.getOutpatientEmrDiagnoseCode());
+        aHomePageFacade.update(updateWrapper);
         //根据传过来的方案编码来判断是否返回评分(1:返回评分,其他只保存数据)
         if (xyHomePageVo.getDockModeType().equals("1")) {
             QueryWrapper<BehospitalInfo> wrapper = new QueryWrapper<>();
@@ -327,6 +333,33 @@ public class ViewFacade {
         }
     }
 
+    //获取门诊诊断相关信息
+    public HomePage  getHomeDiagnoseAndCode(String sql){
+
+        HomePage homePage=new HomePage();
+        StringBuffer diagnoseName=new StringBuffer();
+        StringBuffer diagnoseCode=new StringBuffer();
+        try{
+            List<HomeDiagnoseInfo> homeDiagnoseInfos = new ArrayList<>();
+            homeDiagnoseInfos = tzDBConn.getHomeDiagnose(sql);
+            if(ListUtil.isNotEmpty(homeDiagnoseInfos)){
+                homeDiagnoseInfos.stream().forEach(s->{
+                    diagnoseName.append(s.getDiagnoseName());
+                    diagnoseCode.append(s.getIcdCode());
+                    homePage.setHomePageId(s.getHomePageId());
+                });
+            }
+            if(diagnoseName.length()>0){
+                homePage.setOutpatientEmrDiagnose(diagnoseName.toString());
+            }else if(diagnoseCode.length()>0){
+                homePage.setOutpatientEmrDiagnoseCode(diagnoseCode.toString());
+            }
+        }catch (Exception e){
+            return homePage;
+        }
+        return homePage;
+    }
+
     /**
      * 从视图获取出院诊断信息
      *