Przeglądaj źródła

七院入院登记修改触发点

shiyue 3 lat temu
rodzic
commit
d8bd68bb28

+ 14 - 2
src/main/java/com/diagbot/facade/data/ABehospitalInfoFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade.data;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.data.ABehospitalInfoDTO;
 import com.diagbot.entity.BehospitalInfo;
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
@@ -47,6 +49,8 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
     private boolean logSwitch;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+    @Autowired
+    private SendDataDealFacade sendDataDealFacade;
 
     private TZDBConn tzDBConn = new TZDBConn();
 
@@ -236,6 +240,13 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
 
     public RespDTO placeFileFlag(APlaceFileVO aPlaceFileVO){
         try {
+            //从新拉取最新的入院登记
+            sendDataDealFacade.sendInfo(aPlaceFileVO.getBehospitalCode());
+            //时间转换
+            String date="";
+            if (StringUtils.isNotBlank(aPlaceFileVO.getPlaceFileDate())){
+            date=aPlaceFileVO.getPlaceFileDate().replace("/", "-");
+            }
             //验证数据是否存在
             if(StringUtil.isBlank(aPlaceFileVO.getBehospitalCode())){
                 return RespDTO.onError("请输入病人住院编码!");
@@ -247,14 +258,15 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
                         .eq("hospital_id", aPlaceFileVO.getHospitalId())
                         .eq("is_deleted",IsDeleteEnum.N)
                         .set("is_placefile","1")
-                        .set("placefile_date",aPlaceFileVO.getPlaceFileDate().isEmpty()?DateUtil.formatDateTime(DateUtil.now()):DateUtil.parseDateTime(aPlaceFileVO.getPlaceFileDate()))
+                        .set("placefile_date",StringUtils.isNotEmpty(date)?DateUtil.parseDateTime(date):DateUtil.now())
                         .set("gmt_modified", DateUtil.now());
 
                 Boolean flag=update(new BehospitalInfo(),updateWrapper);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-归档 ","",JSON.toJSONString(aPlaceFileVO),flag.toString(),DateUtil.now()+"");
                 return RespDTO.onSuc(flag);
             }
         }catch (Exception e){
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-归档","",JSON.toJSONString(aPlaceFileVO),"",e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病人住院登记-归档cuowu ","",JSON.toJSONString(aPlaceFileVO),"",e.getMessage());
             return RespDTO.onError(e.getMessage());
         }
     }

+ 6 - 1
src/main/java/com/diagbot/facade/data/AHomePageFacade.java

@@ -48,6 +48,8 @@ public class AHomePageFacade extends HomePageServiceImpl{
 
     @Autowired
     private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Autowired
+    private SendDataDealFacade sendDataDealFacade;
 
     @Value("${log_switch.enable}")
     private boolean logSwitch;
@@ -154,6 +156,9 @@ public class AHomePageFacade extends HomePageServiceImpl{
                 if (StringUtil.isNotEmpty(s.getQcDate())){
                     homePage.setQcDate(DateUtil.parseDateTime(s.getQcDate()));
                 }
+
+                sendDataDealFacade.sendInfo(s.getBehospitalCode());
+
                 //从病案首页同步入院登记表中的住院医生behospitalDoctor,主治医生attendingDoctor和主任医生directorDoctor
                 String behospitalDoctor= StringUtils.isEmpty(homePage.getBehospitalDoctor()) ? "" : homePage.getBehospitalDoctor();
                 String attendingDoctor= StringUtils.isEmpty(homePage.getAttendingDoctor()) ? "" : homePage.getAttendingDoctor();
@@ -165,7 +170,6 @@ public class AHomePageFacade extends HomePageServiceImpl{
                         .set("beh_doctor_name",behospitalDoctor)
                         .set("doctor_name",attendingDoctor)
                         .set("director_doctor_name",directorDoctor);
-
                 behospitalInfoFacade.update(updateWrapper);
 
                 homePageList.add(homePage);
@@ -282,6 +286,7 @@ public class AHomePageFacade extends HomePageServiceImpl{
             List<HomePage> updateE = Lists.newLinkedList();
             if (homePageList != null && homePageList.size() > 0) {
                 homePageList.stream().forEach(s -> {
+
                     HomePage homePage = this.getOne(new QueryWrapper<HomePage>()
                             .eq("home_page_id", s.getHomePageId())
                             .eq("hospital_id", s.getHospitalId())

+ 4 - 0
src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

@@ -76,6 +76,9 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
     @Value("${log_switch.enable}")
     private boolean logSwitch;
 
+    @Autowired
+    private SendDataDealFacade sendDataDealFacade;
+
     private TZDBConn tzDBConn = new TZDBConn();
 
     /**
@@ -387,6 +390,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
                         qcAbnormal.setGmtCreate(new Date());
                         qcAbnormalList.add(qcAbnormal);
                     } else if (modeId == Long.valueOf("1")) {
+                        sendDataDealFacade.sendInfo(s.getBehospitalCode());
                         BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
                                 .eq("behospital_code", s.getBehospitalCode())
                                 .eq("hospital_id", s.getHospitalId()), false);

+ 14 - 1
src/main/java/com/diagbot/facade/data/SendDataDealFacade.java

@@ -57,7 +57,20 @@ public class SendDataDealFacade {
 
     }
 
-
+    /**
+     * 获取病人住院登记历史数据
+     */
+    public List<BehospitalInfo> sendInfo(String code) {
+        List<BehospitalInfo> behospitalInfos =new ArrayList<>();
+        try {
+            String sql = "select * from   v_jkcdss_zy_bingrenjbxx where behospitalCode = '"+code+"'";
+            behospitalInfos = tzDBConn.getBehospitalInfo(sql);
+            aBehospitalInfoFacade.execute(behospitalInfos);
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("获取病人住院登记历史数据", code, JSON.toJSONString(behospitalInfos), "", e.getMessage());
+        }
+        return behospitalInfos;
+    }
 
 
     /**

+ 3 - 3
src/main/java/com/diagbot/util/TZDBConn.java

@@ -408,11 +408,11 @@ public class TZDBConn {
 				behospitalInfo.setDiagnoseIcd(rs.getString("diagnoseIcd"));//疾病ICD编码
 				behospitalInfo.setDiagnose(rs.getString("diagnose"));//疾病名称
 				behospitalInfo.setBehDoctorId(rs.getString("behDoctorId"));//住院医生ID
-				behospitalInfo.setBehDoctorName(rs.getString("behDoctorName"));//住院医生姓名
+//				behospitalInfo.setBehDoctorName(rs.getString("behDoctorName"));//住院医生姓名
 				behospitalInfo.setDirectorDoctorId(rs.getString("directorDoctorId"));//主任医师ID
-				behospitalInfo.setDirectorDoctorName(rs.getString("directorDoctorName"));//主任医师姓名
+//				behospitalInfo.setDirectorDoctorName(rs.getString("directorDoctorName"));//主任医师姓名
 				behospitalInfo.setDoctorId(rs.getString("doctorId"));//主治医生ID
-				behospitalInfo.setDoctorName(rs.getString("doctorName"));//主治医生姓名
+//				behospitalInfo.setDoctorName(rs.getString("doctorName"));//主治医生姓名
 
 				behospitalInfoList.add(behospitalInfo);
 			}