shiyue 3 роки тому
батько
коміт
e884aa7ae3
30 змінених файлів з 1406 додано та 1266 видалено
  1. 2 0
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  2. 2 0
      src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  3. 40 29
      src/main/java/com/diagbot/facade/data/AHomeDiagnoseInfoFacade.java
  4. 40 29
      src/main/java/com/diagbot/facade/data/AHomeOperationInfoFacade.java
  5. 1 0
      src/main/java/com/diagbot/facade/data/AMedCrisisFacade.java
  6. 212 210
      src/main/java/com/diagbot/facade/data/StructuralOldDataFacade.java
  7. 4 1
      src/main/java/com/diagbot/facade/str/AStrAdmissionNoteFacade.java
  8. 59 55
      src/main/java/com/diagbot/facade/str/AStrBloodResultFacade.java
  9. 60 56
      src/main/java/com/diagbot/facade/str/AStrBloodTransfusionFacade.java
  10. 60 55
      src/main/java/com/diagbot/facade/str/AStrConsultationRecordFacade.java
  11. 64 58
      src/main/java/com/diagbot/facade/str/AStrConsultationResultFacade.java
  12. 62 58
      src/main/java/com/diagbot/facade/str/AStrDeathDiscussionFacade.java
  13. 61 57
      src/main/java/com/diagbot/facade/str/AStrDeathNoteFacade.java
  14. 61 57
      src/main/java/com/diagbot/facade/str/AStrDifficultCaseFacade.java
  15. 60 55
      src/main/java/com/diagbot/facade/str/AStrFirstRecordFacade.java
  16. 5 1
      src/main/java/com/diagbot/facade/str/AStrIllCriticallyFacade.java
  17. 60 57
      src/main/java/com/diagbot/facade/str/AStrIllSeriouslFacade.java
  18. 73 74
      src/main/java/com/diagbot/facade/str/AStrLeaveHospitalFacade.java
  19. 71 66
      src/main/java/com/diagbot/facade/str/AStrOperativeFirstRecord.java
  20. 6 3
      src/main/java/com/diagbot/facade/str/AStrOperativeNoteFacade.java
  21. 62 56
      src/main/java/com/diagbot/facade/str/AStrPeriodConclusionFacade.java
  22. 61 57
      src/main/java/com/diagbot/facade/str/AStrPreoperativeDiscussionFacade.java
  23. 62 57
      src/main/java/com/diagbot/facade/str/AStrRescueNoteFacade.java
  24. 60 55
      src/main/java/com/diagbot/facade/str/AStrTransferInNoteFacade.java
  25. 61 56
      src/main/java/com/diagbot/facade/str/AStrTransferOutNoteFacade.java
  26. 67 62
      src/main/java/com/diagbot/facade/str/AStrWardRecordFacade.java
  27. 1 1
      src/main/java/com/diagbot/task/PullDataTask.java
  28. 5 0
      src/main/java/com/diagbot/util/FJTZDBConnHarp.java
  29. 23 0
      src/main/java/com/diagbot/web/DataController.java
  30. 1 1
      src/main/resources/application-test.yml

+ 2 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -150,6 +150,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/data/sendMrRecordIng").permitAll()
                 .antMatchers("/qc/data/sendStructuralData").permitAll()
                 .antMatchers("/qc/data/sendStructuralOneOld").permitAll()
+                .antMatchers("/qc/data/sendStructuralMoreOld").permitAll()
                 .antMatchers("/qc/data/sendStructuralDateOld").permitAll()
                 .antMatchers("/qc/data/sendMrContent").permitAll()
                 .antMatchers("/qc/data/sendMrRecord").permitAll()
@@ -165,6 +166,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/data/sendLisResults").permitAll()
                 .antMatchers("/qc/data/sendPacsResults").permitAll()
                 .antMatchers("/qc/data/getColumnZhAndCh").permitAll()
+                .antMatchers("/qc/data/getColumnZhAndCh1").permitAll()
                 .antMatchers("/qc/data/analyseRec").permitAll()
                 .antMatchers("/qc/data/hisDataDeal").permitAll()
                 .antMatchers("/qc/data_str/sendAdmissionNote").permitAll()

+ 2 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -194,6 +194,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/data/sendMrRecordIng", request)
                 || matchers("/qc/data/sendStructuralData", request)
                 || matchers("/qc/data/sendStructuralOneOld", request)
+                || matchers("/qc/data/sendStructuralMoreOld", request)
                 || matchers("/qc/data/sendStructuralDateOld", request)
                 || matchers("/qc/data/sendMrContent", request)
                 || matchers("/qc/data/sendMrRecord", request)
@@ -209,6 +210,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/data/sendLisResults", request)
                 || matchers("/qc/data/sendPacsResults", request)
                 || matchers("/qc/data/getColumnZhAndCh", request)
+                || matchers("/qc/data/getColumnZhAndCh1", request)
                 || matchers("/qc/data/analyseRec", request)
                 || matchers("/qc/data/hisDataDeal", request)
                 || matchers("/qc/data_str/sendAdmissionNote", request)

+ 40 - 29
src/main/java/com/diagbot/facade/data/AHomeDiagnoseInfoFacade.java

@@ -8,6 +8,7 @@ import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.data.AHomeDiagnoseDTO;
 import com.diagbot.entity.HomeDiagnoseInfo;
 import com.diagbot.entity.HomeOperationInfo;
+import com.diagbot.entity.MedCrisisInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.HomeDiagnoseInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
@@ -25,7 +26,7 @@ import java.util.Date;
 import java.util.List;
 
 @Component
-public class AHomeDiagnoseInfoFacade extends HomeDiagnoseInfoServiceImpl{
+public class AHomeDiagnoseInfoFacade extends HomeDiagnoseInfoServiceImpl {
 
     @Autowired
     @Qualifier("homeDiagnoseInfoServiceImpl")
@@ -42,78 +43,88 @@ public class AHomeDiagnoseInfoFacade extends HomeDiagnoseInfoServiceImpl{
     public void executeHomeDiagnose() {
         //String sql="select * from br_recdiagnose where BASYID in (select BASYID from br_rechome where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate())";//今年的数据
         //前一天的数据
-        String sql="select * from br_recdiagnose where BASYID in (select BASYID from br_rechome where cjcxrq>=(select CONVERT(varchar,GETDATE()-1,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)))";
+        String sql = "select * from br_recdiagnose where BASYID in (select BASYID from br_rechome where cjcxrq>=(select CONVERT(varchar,GETDATE()-1,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)))";
         List<HomeDiagnoseInfo> homeDiagnoseList = tzDBConn.getHomeDiagnose(sql);
         execute(homeDiagnoseList);
     }
 
     /**
      * 数据引擎-通过接口更新病案首页诊断
+     *
      * @param list
      * @return
      */
     public RespDTO<List<AHomeDiagnoseDTO>> executeHomeDiagnose(List<AHomeDiagnoseVO> list) {
-        if(list!=null && list.size()>0){
-            List<HomeDiagnoseInfo> homeDiagnoseList=Lists.newArrayList();
-            List<AHomeDiagnoseDTO> homeDiagnoseDtoList=Lists.newArrayList();
+        if (list != null && list.size() > 0) {
+            List<HomeDiagnoseInfo> homeDiagnoseList = Lists.newArrayList();
+            List<AHomeDiagnoseDTO> homeDiagnoseDtoList = Lists.newArrayList();
 
-            homeDiagnoseList=BeanUtil.listCopyTo(list,HomeDiagnoseInfo.class);
-            homeDiagnoseDtoList=BeanUtil.listCopyTo(list,AHomeDiagnoseDTO.class);
+            homeDiagnoseList = BeanUtil.listCopyTo(list, HomeDiagnoseInfo.class);
+            homeDiagnoseDtoList = BeanUtil.listCopyTo(list, AHomeDiagnoseDTO.class);
             execute(homeDiagnoseList);
             return RespDTO.onSuc(homeDiagnoseDtoList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<HomeDiagnoseInfo> homeDiagnoseList){
-        try{
+    public void execute(List<HomeDiagnoseInfo> homeDiagnoseList) {
+        try {
             List<HomeDiagnoseInfo> addE = Lists.newLinkedList();
+            List<HomeDiagnoseInfo> updateE = Lists.newLinkedList();
             if (homeDiagnoseList != null && homeDiagnoseList.size() > 0) {
                 homeDiagnoseList.stream().forEach(s -> {
-                    if(s.getHomePageId()!=null && !"".equals(s.getDiagnoseOrderNo())){
-                        QueryWrapper<HomeDiagnoseInfo> queryWrapper = Wrappers.query();
-                        queryWrapper.eq("home_page_id", s.getHomePageId())
-                                .eq("hospital_id", s.getHospitalId());
-                        this.remove(queryWrapper);
+                    HomeDiagnoseInfo homeDiagnoseInfo = this.getOne(new QueryWrapper<HomeDiagnoseInfo>()
+                            .eq("home_page_id", s.getHomePageId())
+                            .eq("hospital_id", s.getHospitalId())
+                            .eq("diagnose_order_no", s.getDiagnoseOrderNo()));
+                    if (homeDiagnoseInfo != null) {
+                        s.setGmtModified(new Date());
+                        updateE.add(s);
+                    } else {
                         s.setGmtCreate(new Date());
                         addE.add(s);
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 homeDiagnoseInfoService.saveBatch(addE);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断", "", JSON.toJSONString(addE), "", "新增病案首页诊断");
+            }
+            if (updateE.size() > 0) {
+                homeDiagnoseInfoService.updateBatchByKey(updateE);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断", "", JSON.toJSONString(updateE), "", "修改病案首页诊断");
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断","", JSON.toJSONString(homeDiagnoseList),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断", "", JSON.toJSONString(homeDiagnoseList), "", e.getMessage());
         }
     }
 
-    public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO){
+    public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO) {
         try {
             //验证数据是否存在
-            if(StringUtil.isEmpty(aDeleteFlagVO.getHomePageId())) {
+            if (StringUtil.isEmpty(aDeleteFlagVO.getHomePageId())) {
                 return RespDTO.onError("出院诊断未输入病案首页编号!");
-            }else if(aDeleteFlagVO.getHospitalId()==null){
+            } else if (aDeleteFlagVO.getHospitalId() == null) {
                 return RespDTO.onError("出院诊断未输入医院编码!");
-            }else if(StringUtil.isEmpty(aDeleteFlagVO.getDiagnoseOrderNo())){
+            } else if (StringUtil.isEmpty(aDeleteFlagVO.getDiagnoseOrderNo())) {
                 return RespDTO.onError("出院诊断未输入顺序号!");
-            }else {
-                UpdateWrapper<HomeDiagnoseInfo> updateWrapper=new UpdateWrapper<>();
+            } else {
+                UpdateWrapper<HomeDiagnoseInfo> updateWrapper = new UpdateWrapper<>();
                 updateWrapper.eq("home_page_id", aDeleteFlagVO.getHomePageId())
                         .eq("hospital_id", aDeleteFlagVO.getHospitalId())
                         .eq("diagnose_order_no", aDeleteFlagVO.getDiagnoseOrderNo())
                         .eq("is_deleted", IsDeleteEnum.N)
-                        .set("is_deleted",IsDeleteEnum.Y)
+                        .set("is_deleted", IsDeleteEnum.Y)
                         .set("gmt_modified", DateUtil.now());
 
-                Boolean flag=update(new HomeDiagnoseInfo(),updateWrapper);
+                Boolean flag = update(new HomeDiagnoseInfo(), updateWrapper);
                 //aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断-删除",JSON.toJSONString(aDeleteFlagVO),JSON.toJSONString(RespDTO.onSuc(flag)),"操作成功!");
                 return RespDTO.onSuc(flag);
             }
-        }catch (Exception e){
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断-删除","",JSON.toJSONString(aDeleteFlagVO),"",e.getMessage());
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-诊断-删除", "", JSON.toJSONString(aDeleteFlagVO), "", e.getMessage());
             return RespDTO.onError(e.getMessage());
         }
     }

+ 40 - 29
src/main/java/com/diagbot/facade/data/AHomeOperationInfoFacade.java

@@ -25,7 +25,7 @@ import java.util.Date;
 import java.util.List;
 
 @Component
-public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl{
+public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl {
 
     @Autowired
     @Qualifier("homeOperationInfoServiceImpl")
@@ -41,80 +41,91 @@ public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl{
     public void executeHomeOperation() {
         //String sql="select * from br_recoperation where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
         //前一天数据
-        String sql="select * from br_recoperation where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23))";
+        String sql = "select * from br_recoperation where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23))";
         List<HomeOperationInfo> homeOperationList = tzDBConn.getHomeOperation(sql);
         execute(homeOperationList);
     }
 
     /**
      * 终末质控-通过接口更新病案首页手术
+     *
      * @param list
      * @return
      */
     public List<AHomeOperationDTO> executeHomeOperation(List<AHomeOperationVO> list) {
-        List<HomeOperationInfo> homeOperationList=Lists.newArrayList();
-        List<AHomeOperationDTO> homeOperationDtoList=Lists.newArrayList();
-        if(list!=null && list.size()>0){
-            list.stream().forEach(s->{
-                HomeOperationInfo homeOperationInfo=new HomeOperationInfo();
-                BeanUtil.copyProperties(s,homeOperationInfo);
+        List<HomeOperationInfo> homeOperationList = Lists.newArrayList();
+        List<AHomeOperationDTO> homeOperationDtoList = Lists.newArrayList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                HomeOperationInfo homeOperationInfo = new HomeOperationInfo();
+                BeanUtil.copyProperties(s, homeOperationInfo);
                 homeOperationInfo.setOperationDate(DateUtil.parseDateTime(s.getOperationDate()));
                 homeOperationList.add(homeOperationInfo);
             });
-            homeOperationDtoList=BeanUtil.listCopyTo(list,AHomeOperationDTO.class);
+            homeOperationDtoList = BeanUtil.listCopyTo(list, AHomeOperationDTO.class);
             execute(homeOperationList);
         }
         return homeOperationDtoList;
     }
 
-    public void execute(List<HomeOperationInfo> homeOperationList){
+    public void execute(List<HomeOperationInfo> homeOperationList) {
         try {
             List<HomeOperationInfo> addE = Lists.newLinkedList();
+            List<HomeOperationInfo> updateE = Lists.newLinkedList();
             if (homeOperationList != null && homeOperationList.size() > 0) {
                 homeOperationList.stream().forEach(s -> {
-                    if(s.getHomePageId()!=null && !"".equals(s.getOperationOrderNo())) {
-                        QueryWrapper<HomeOperationInfo> queryWrapper = Wrappers.query();
-                        queryWrapper.eq("home_page_id", s.getHomePageId())
-                                .eq("hospital_id", s.getHospitalId());
-                        this.remove(queryWrapper);
+
+                    HomeOperationInfo homeOperationInfo = this.getOne(new QueryWrapper<HomeOperationInfo>()
+                            .eq("home_page_id", s.getHomePageId())
+                            .eq("hospital_id", s.getHospitalId())
+                            .eq("operation_order_no", s.getOperationOrderNo()));
+                    if (homeOperationInfo != null) {
+                        s.setGmtModified(new Date());
+                        updateE.add(s);
+                    } else {
                         s.setGmtCreate(new Date());
                         addE.add(s);
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 homeOperationInfoService.saveBatch(addE);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术", "", JSON.toJSONString(addE), "", "新增病案首页手术");
+            }
+            if (updateE.size() > 0) {
+                homeOperationInfoService.updateBatchByKey(updateE);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术", "", JSON.toJSONString(updateE), "", "修改病案首页手术");
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术","",JSON.toJSONString(homeOperationList),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术", "", JSON.toJSONString(homeOperationList), "", e.getMessage());
         }
     }
 
-    public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO){
+    public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO) {
         try {
             //验证数据是否存在
-            if(StringUtil.isEmpty(aDeleteFlagVO.getHomePageId())) {
+            if (StringUtil.isEmpty(aDeleteFlagVO.getHomePageId())) {
                 return RespDTO.onError("住院手术未输入病案首页编号!");
-            }else if(aDeleteFlagVO.getHospitalId()==null){
+            } else if (aDeleteFlagVO.getHospitalId() == null) {
                 return RespDTO.onError("住院手术未输入医院编码!");
-            }else if(StringUtil.isEmpty(aDeleteFlagVO.getOperationOrderNo())){
+            } else if (StringUtil.isEmpty(aDeleteFlagVO.getOperationOrderNo())) {
                 return RespDTO.onError("住院手术未输入顺序号!");
-            }else {
-                UpdateWrapper<HomeOperationInfo> updateWrapper=new UpdateWrapper<>();
+            } else {
+                UpdateWrapper<HomeOperationInfo> updateWrapper = new UpdateWrapper<>();
                 updateWrapper.eq("home_page_id", aDeleteFlagVO.getHomePageId())
                         .eq("hospital_id", aDeleteFlagVO.getHospitalId())
                         .eq("operation_order_no", aDeleteFlagVO.getOperationOrderNo())
                         .eq("is_deleted", IsDeleteEnum.N)
-                        .set("is_deleted",IsDeleteEnum.Y)
+                        .set("is_deleted", IsDeleteEnum.Y)
                         .set("gmt_modified", DateUtil.now());
 
-                Boolean flag=update(new HomeOperationInfo(),updateWrapper);
+                Boolean flag = update(new HomeOperationInfo(), updateWrapper);
                 //aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术-删除",JSON.toJSONString(aDeleteFlagVO),JSON.toJSONString(RespDTO.onSuc(flag)),"操作成功!");
                 return RespDTO.onSuc(flag);
             }
-        }catch (Exception e){
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术-删除","",JSON.toJSONString(aDeleteFlagVO),"",e.getMessage());
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病案首页-手术-删除", "", JSON.toJSONString(aDeleteFlagVO), "", e.getMessage());
             return RespDTO.onError(e.getMessage());
         }
     }

+ 1 - 0
src/main/java/com/diagbot/facade/data/AMedCrisisFacade.java

@@ -80,6 +80,7 @@ public class AMedCrisisFacade extends MedCrisisInfoServiceImpl {
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
                             .eq("behospital_code", s.getBehospitalCode())
+                            .eq("crisis_id", s.getCrisisId())
                             .eq("rec_type", s.getRecType()), false);
                     if (medCrisisInfo != null) {
                         s.setGmtModified(new Date());

+ 212 - 210
src/main/java/com/diagbot/facade/data/StructuralOldDataFacade.java

@@ -9,9 +9,11 @@ import com.diagbot.facade.MedLisInfoFacade;
 import com.diagbot.facade.MedPacsInfoFacade;
 import com.diagbot.facade.str.*;
 import com.diagbot.util.FJTZDBConnHarp;
+import com.diagbot.util.MapUtil;
 import com.diagbot.util.ReadProperties;
 import com.diagbot.vo.data.*;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -100,29 +102,31 @@ public class StructuralOldDataFacade {
     @Autowired
     private MedPacsInfoFacade medPacsInfoFacade;
 
+
     private FJTZDBConnHarp fjtzdbConnHarp = new FJTZDBConnHarp();
 
 
     /**
      * 终末质控,根据时间来导入数据
+     *
      * @param structuralDataVo
      */
-    public void  sendStructuralDataOld(StructuralDataVo structuralDataVo){
+    public void sendStructuralDataOld(StructuralDataVo structuralDataVo) {
         try {
-            String sql ="select * from med_behospital_info t  where  t.leaveHospitalDate >=to_date('"+structuralDataVo.getStartDate()
-                    + "','yyyymmdd') and t.leaveHospitalDate <= to_date('"+structuralDataVo.getStopDate()+"','yyyymmdd')";
+            String sql = "select * from med_behospital_info t  where  t.behospitalDate >=to_date('" + structuralDataVo.getStartDate()
+                    + "','yyyymmdd') and t.behospitalDate <= to_date('" + structuralDataVo.getStopDate() + "','yyyymmdd')";
 
 //            String sql ="select t.behospitalCode ,t.patientId  from med_behospital_info t where t.leaveHospitalDate is null";
-            List<StructuralDataVo> strings =fjtzdbConnHarp.getBehospitalInfoDate(sql);
+            List<StructuralDataVo> strings = fjtzdbConnHarp.getBehospitalInfoDate(sql);
 
-            strings.forEach(s->{
-                StructuralDataVo sData =new StructuralDataVo();
-                if (null!=structuralDataVo.getModeId()){
+            strings.forEach(s -> {
+                StructuralDataVo sData = new StructuralDataVo();
+                if (null != structuralDataVo.getModeId()) {
                     sData.setBehospitalCode(s.getBehospitalCode());
                     sData.setPatientId(s.getPatientId());
                     sData.setModeId(structuralDataVo.getModeId());
                     executeOld(sData);
-                }else {
+                } else {
                     for (int i = 0; i < 65; i++) {
                         String tableName = TableNameEnum.getName(i);
                         if (null != tableName) {
@@ -134,207 +138,206 @@ public class StructuralOldDataFacade {
                     }
                 }
             });
-        }catch (Exception e){
-            aMedAbnormalInfoFacade.saveAbnormalInfo("保存数据异常", "",JSON.toJSONString(structuralDataVo),"",e.getMessage());
+        } catch (Exception e) {
+            aMedAbnormalInfoFacade.saveAbnormalInfo("保存数据异常", "", JSON.toJSONString(structuralDataVo), "", e.getMessage());
         }
     }
 
     /**
      * 终末质控,单个病人来导入数据
+     *
      * @param behospitalCode
      */
-    public void  sendOnebehospitalCode(String behospitalCode,String patientId){
-            StructuralDataVo sData =new StructuralDataVo();
-            sData.setBehospitalCode(behospitalCode);
-            sData.setPatientId(patientId);
-            for (int i = 65; i >0 ; i--) {
-                String tableName=TableNameEnum.getName(i);
-                if (null!=tableName){
-                    sData.setModeId(String.valueOf(i));
-                    executeOld(sData);
-                }
+    public void sendOnebehospitalCode(String behospitalCode, String patientId) {
+        StructuralDataVo sData = new StructuralDataVo();
+        sData.setBehospitalCode(behospitalCode);
+        sData.setPatientId(patientId);
+        for (int i = 65; i > 0; i--) {
+            String tableName = TableNameEnum.getName(i);
+            if (null != tableName) {
+                sData.setModeId(String.valueOf(i));
+                executeOld(sData);
             }
+        }
     }
 
 
-
-
-
     /**
      * 终末,历史数据拉取
+     *
      * @param s
      */
-    public void executeOld(StructuralDataVo s){
+    public void executeOld(StructuralDataVo s) {
         String modelName = ModeIdEnum.getName(Integer.parseInt(s.getModeId()));
         s.setTableName(TableNameEnum.getName(Integer.parseInt(s.getModeId())));
         try {
-            if("首次病程录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()){
-                        aStrFirstRecordFacade.getOneList(map.get(key),s.getModeId());
+            if ("首次病程录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrFirstRecordFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("输血后效果评价".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrBloodResultFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("输血后效果评价".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrBloodResultFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("输血/血制品病程记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrBloodTransfusionFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("输血/血制品病程记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrBloodTransfusionFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("转入记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrTransferInNoteFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("转入记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrTransferInNoteFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("转出记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrTransferOutNoteFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("转出记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrTransferOutNoteFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("病危通知书".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrIllCriticallyFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("病危通知书".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrIllCriticallyFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("病重通知书".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrIllSeriouslFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("病重通知书".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrIllSeriouslFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("疑难病例讨论记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrDifficultCaseFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("疑难病例讨论记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrDifficultCaseFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("死亡记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrDeathNoteFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("死亡记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrDeathNoteFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("死亡病例讨论记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getMedDeathDiscussion(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrDeathDiscussionFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("死亡病例讨论记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getMedDeathDiscussion(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrDeathDiscussionFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("术后首次病程及谈话记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrOperativeFirstRecord.getOneList(map.get(key),s.getModeId());
+            } else if ("术后首次病程及谈话记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrOperativeFirstRecord.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("术前讨论、术前小结".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrPreoperativeDiscussionFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("术前讨论、术前小结".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrPreoperativeDiscussionFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("手术记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrOperativeNoteFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("手术记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrOperativeNoteFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("抢救记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrRescueNoteFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("抢救记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrRescueNoteFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("出院小结".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrLeaveHospitalFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("出院小结".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrLeaveHospitalFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("会诊申请单".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrConsultationResultFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("会诊申请单".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrConsultationResultFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("会诊单".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrConsultationNoteFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("会诊单".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrConsultationNoteFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if ("会诊记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrConsultationRecordFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("会诊记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrConsultationRecordFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            } else if("阶段小结".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrPeriodConclusionFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("阶段小结".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrPeriodConclusionFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if("查房记录".equals(modelName)){
-                List<HisViewVo> hisViewVos =fjtzdbConnHarp.getHisView(this.sqlOld(s));
-                if (hisViewVos.size()>0){
-                    Map<String,List<HisViewVo>> map=this.executeOldDeci(hisViewVos);
-                    for (String key:map.keySet()) {
-                        aStrWardRecordFacade.getOneList(map.get(key),s.getModeId());
+            } else if ("查房记录".equals(modelName)) {
+                List<HisViewVo> hisViewVos = fjtzdbConnHarp.getHisView(this.sqlOld(s));
+                if (hisViewVos.size() > 0) {
+                    Map<String, List<HisViewVo>> map = this.executeOldDeci(hisViewVos);
+                    for (String key : map.keySet()) {
+                        aStrWardRecordFacade.getOneList(map.get(key), s.getModeId());
                     }
                 }
-            }else if ("病案首页".equals(modelName)){
+            } else if ("病案首页".equals(modelName)) {
                 /**
                  * 病案首页
                  */
-                String sql ="select * from "+s.getTableName()+"  where  behospitalCode='"+s.getBehospitalCode()+"' and patientId='"+s.getPatientId()+ "'";
-                List<HisHomePageVO> homePage =fjtzdbConnHarp.getHomePage(sql);
-                if (homePage.size()>0) {
+                String sql = "select * from " + s.getTableName() + "  where  behospitalCode='" + s.getBehospitalCode() + "' and patientId='" + s.getPatientId() + "'";
+                List<HisHomePageVO> homePage = fjtzdbConnHarp.getHomePage(sql);
+                if (homePage.size() > 0) {
                     aHomePageFacade.getOneList(homePage);//病案首页
                     /**
                      * 病案首页诊断
@@ -348,14 +351,14 @@ public class StructuralOldDataFacade {
                      * 病案首页手术
                      */
                     List<HomeOperationInfo> homeinfo = new ArrayList<>();
-                    String sql02 = "select * from  med_home_operation_info  where " + " homePageId='" + homePage.get(0).getHomePageId() + "' and behospitalCode = '"+s.getBehospitalCode()+"' and patientId='"+s.getPatientId()+ "'";
+                    String sql02 = "select * from  med_home_operation_info  where " + " homePageId='" + homePage.get(0).getHomePageId() + "' and behospitalCode = '" + s.getBehospitalCode() + "' and patientId='" + s.getPatientId() + "'";
                     List<HomeOperationInfo> homeOperationInfos = fjtzdbConnHarp.getHomeOperation(sql02);
-                    if (homeOperationInfos.size()>0){
-                        homeOperationInfos.forEach(h->{
+                    if (homeOperationInfos.size() > 0) {
+                        homeOperationInfos.forEach(h -> {
                             homeinfo.add(h);
                         });
                     }
-                    String sql03 = "select * from  med_home_operation_info2  where " + "homePageId='" + homePage.get(0).getHomePageId() + "' and behospitalCode = '"+s.getBehospitalCode()+"' and patientId='"+s.getPatientId()+ "'";
+                    String sql03 = "select * from  med_home_operation_info2  where " + "homePageId='" + homePage.get(0).getHomePageId() + "' and behospitalCode = '" + s.getBehospitalCode() + "' and patientId='" + s.getPatientId() + "'";
                     List<HomeOperationInfo> homeOperation = fjtzdbConnHarp.getHomeOperation(sql03);
                     if (homeOperation.size() > 0) {
                         homeOperation.forEach(home -> {
@@ -364,99 +367,97 @@ public class StructuralOldDataFacade {
                     }
                     aHomeOperationInfoFacade.execute(homeinfo);//病案首页手术
                 }
-            }else if ("医嘱信息".equals(modelName)){
-                List<DoctorAdvice> doctorAdvice =fjtzdbConnHarp.getDoctorAdvice(this.sqlOld(s));
-                if (doctorAdvice.size()>0){
+            } else if ("医嘱信息".equals(modelName)) {
+                List<DoctorAdvice> doctorAdvice = fjtzdbConnHarp.getDoctorAdvice(this.sqlOld(s));
+                if (doctorAdvice.size() > 0) {
                     aDoctorAdviceFacade.execute(doctorAdvice);
                 }
-            }else if ("入院登记".equals(modelName)) {
+            } else if ("入院登记".equals(modelName)) {
                 List<BehospitalInfo> behospitalInfo = fjtzdbConnHarp.getBehospitalInfo(this.sqlOld(s));
                 if (behospitalInfo.size() > 0) {
                     aBehospitalInfoFacade.execute(behospitalInfo);
                 }
-            }
-            else if ("检查信息".equals(modelName)){
-                String sql ="select * from med_pacs_info where behospitalCode ='"+s.getBehospitalCode()+"' and patientId='"+s.getPatientId()+ "'";
-                List<MedPacsInfo> pacsInfo =fjtzdbConnHarp.getPacsInfo(sql);
-                if (pacsInfo.size()>0){
-                    pacsInfo.forEach(pacs->{
+            } else if ("检查信息".equals(modelName)) {
+                String sql = "select * from med_pacs_info where behospitalCode ='" + s.getBehospitalCode() + "' and patientId='" + s.getPatientId() + "'";
+                List<MedPacsInfo> pacsInfo = fjtzdbConnHarp.getPacsInfo(sql);
+                if (pacsInfo.size() > 0) {
+                    pacsInfo.forEach(pacs -> {
                         medPacsInfoFacade.save(pacs);
-                        String pacsSql ="select * from med_pacs_result where behospitalCode ='"+s.getBehospitalCode()+
-                                "' and recId = '"+pacs.getRepNo()+"'";
-                        List<MedPacsResult> pacsResult =fjtzdbConnHarp.getPacsResult(pacsSql);
-                        if (pacsResult.size()>0){
+                        String pacsSql = "select * from med_pacs_result where behospitalCode ='" + s.getBehospitalCode() +
+                                "' and recId = '" + pacs.getRepNo() + "'";
+                        List<MedPacsResult> pacsResult = fjtzdbConnHarp.getPacsResult(pacsSql);
+                        if (pacsResult.size() > 0) {
                             aMedPacsResultFacade.execute(pacsResult);
                         }
                     });
 
                 }
-            }else if ("检验信息".equals(modelName)){
-                String sql ="select * from med_lis_info where behospitalCode ='"+s.getBehospitalCode()+"' and patientId='"+s.getPatientId()+ "'";
-                List<MedLisInfo> lisInfo =fjtzdbConnHarp.getLisInfo(sql);
-                if (lisInfo.size()>0){
-                    lisInfo.forEach(lis->{
+            } else if ("检验信息".equals(modelName)) {
+                String sql = "select * from med_lis_info where behospitalCode ='" + s.getBehospitalCode() + "' and patientId='" + s.getPatientId() + "'";
+                List<MedLisInfo> lisInfo = fjtzdbConnHarp.getLisInfo(sql);
+                if (lisInfo.size() > 0) {
+                    lisInfo.forEach(lis -> {
                         medLisInfoFacade.save(lis);
-                        String lisSql ="select * from med_lis_result where behospitalCode ='"+s.getBehospitalCode()+
-                                "' and recId = '"+lis.getRepNo()+"' and patientId='"+s.getPatientId()+ "'";
-                        List<MedLisResult> lisResult =fjtzdbConnHarp.getLisResult(lisSql);
-                        if (lisResult.size()>0){
+                        String lisSql = "select * from med_lis_result where behospitalCode ='" + s.getBehospitalCode() +
+                                "' and recId = '" + lis.getRepNo() + "' and patientId='" + s.getPatientId() + "'";
+                        List<MedLisResult> lisResult = fjtzdbConnHarp.getLisResult(lisSql);
+                        if (lisResult.size() > 0) {
                             aMedLisResultFacade.execute(lisResult);
                         }
                     });
 
                 }
-            }
-            else if ("谈话告知书".equals(modelName)){
-                List<StrTalkInform> strTalkInforms =fjtzdbConnHarp.getStrTalkInform(this.sqlOld(s));
-                if (strTalkInforms.size()>0){
+            } else if ("谈话告知书".equals(modelName)) {
+                List<StrTalkInform> strTalkInforms = fjtzdbConnHarp.getStrTalkInform(this.sqlOld(s));
+                if (strTalkInforms.size() > 0) {
                     aStrTalkInformFacade.execute(strTalkInforms);
                 }
-            }else if ("知情同意书".equals(modelName)){
-                List<StrInformedConsent> strInformedConsents =fjtzdbConnHarp.getStrInformedConsent(this.sqlOld(s));
-                if (strInformedConsents.size()>0){
+            } else if ("知情同意书".equals(modelName)) {
+                List<StrInformedConsent> strInformedConsents = fjtzdbConnHarp.getStrInformedConsent(this.sqlOld(s));
+                if (strInformedConsents.size() > 0) {
                     aStrInformedConsentFacade.execute(strInformedConsents);
                 }
-            }else if ("危急值信息".equals(modelName)){
-                List<MedCrisisInfo> medCrisisInfos =fjtzdbConnHarp.getMedCrisisInfo(this.sqlOld(s));
-                if (medCrisisInfos.size()>0){
+            } else if ("危急值信息".equals(modelName)) {
+                List<MedCrisisInfo> medCrisisInfos = fjtzdbConnHarp.getMedCrisisInfo(this.sqlOld(s));
+                if (medCrisisInfos.size() > 0) {
                     aMedCrisisFacade.execute(medCrisisInfos);
                 }
-            }else if("入院记录".equals(modelName)){
-                List<FJStrAdmissionNoteVo> medAdmissionNote =fjtzdbConnHarp.getMedAdmissionNote(this.sqlOld(s));
-                if (medAdmissionNote.size()>0){
-                    aStrAdmissionNoteFacade.getOneList(medAdmissionNote,s.getModeId());
+            } else if ("入院记录".equals(modelName)) {
+                List<FJStrAdmissionNoteVo> medAdmissionNote = fjtzdbConnHarp.getMedAdmissionNote(this.sqlOld(s));
+                if (medAdmissionNote.size() > 0) {
+                    aStrAdmissionNoteFacade.getOneList(medAdmissionNote, s.getModeId());
                 }
-            }else if("危急值记录".equals(modelName)){
-                List<AStrCrisisNoteVO> medCrisisNote =fjtzdbConnHarp.getMedCrisisNote(this.sqlOld(s));
-                if (medCrisisNote.size()>0){
-                    medCrisisNote.forEach(crisis->{
-                        aStrCrisisNoteFacade.dealData(crisis,s.getModeId());
+            } else if ("危急值记录".equals(modelName)) {
+                List<AStrCrisisNoteVO> medCrisisNote = fjtzdbConnHarp.getMedCrisisNote(this.sqlOld(s));
+                if (medCrisisNote.size() > 0) {
+                    medCrisisNote.forEach(crisis -> {
+                        aStrCrisisNoteFacade.dealData(crisis, s.getModeId());
                     });
                 }
             }
-            log.info(modelName+"---- 保存数据完成!");
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("保存数据异常", "",JSON.toJSONString(s),"",e.getMessage());
+            log.info(modelName + "---- 保存数据完成!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("保存数据异常", "", JSON.toJSONString(s), "", e.getMessage());
         }
 
     }
 
 
     /**
-     *把得到的多个数据根据recId来分成一条数据
+     * 把得到的多个数据根据recId来分成一条数据
      */
-    public Map<String,List<HisViewVo>> executeOldDeci(List<HisViewVo> hisViewVos){
-        Map<String,List<HisViewVo>> map =new HashMap<>();
-        hisViewVos.forEach(s->{
-            List<HisViewVo> hisViewVos1=map.get(s.getRecId());
-            if (hisViewVos1!=null){
+    public Map<String, List<HisViewVo>> executeOldDeci(List<HisViewVo> hisViewVos) {
+        Map<String, List<HisViewVo>> map = new HashMap<>();
+        hisViewVos.forEach(s -> {
+            List<HisViewVo> hisViewVos1 = map.get(s.getRecId());
+            if (hisViewVos1 != null) {
                 hisViewVos1.add(s);
-                map.put(s.getRecId(),hisViewVos1);
-            }else {
-                List<HisViewVo> h =new ArrayList<>();
+                map.put(s.getRecId(), hisViewVos1);
+            } else {
+                List<HisViewVo> h = new ArrayList<>();
                 h.add(s);
-                map.put(s.getRecId(),h);
+                map.put(s.getRecId(), h);
             }
         });
         return map;
@@ -464,11 +465,12 @@ public class StructuralOldDataFacade {
 
     /**
      * 历史数据拉取
+     *
      * @param s
      * @return
      */
-    public String sqlOld(StructuralDataVo s){
-        String sql ="select * from "+s.getTableName()+"  where  behospitalCode = '"+s.getBehospitalCode()+"' and patientId='"+s.getPatientId()+ "'";
+    public String sqlOld(StructuralDataVo s) {
+        String sql = "select * from " + s.getTableName() + "  where  behospitalCode = '" + s.getBehospitalCode() + "' and patientId='" + s.getPatientId() + "'";
         return sql;
     }
 }

+ 4 - 1
src/main/java/com/diagbot/facade/str/AStrAdmissionNoteFacade.java

@@ -107,6 +107,7 @@ public class AStrAdmissionNoteFacade extends StrAdmissionNoteServiceImpl {
                 medAdmissionNote.setGmtCreate(new Date());//记录创建时间
                 medAdmissionNote.setIsDeleted("N");
                 this.save(medAdmissionNote);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("入院记录", medAdmissionNote.getRecId(), JSON.toJSONString(medAdmissionNote), "", "新增入院记录");
             } else {
                 medAdmissionNote.setGmtModified(new Date());//记录修改时间
                 medAdmissionNote.setIsDeleted("N");
@@ -114,10 +115,12 @@ public class AStrAdmissionNoteFacade extends StrAdmissionNoteServiceImpl {
                         .eq("rec_id", medAdmissionNote.getRecId())
                         .eq("hospital_id", medAdmissionNote.getHospitalId())
                         .eq("behospital_code", medAdmissionNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("入院记录", medAdmissionNote.getRecId(), JSON.toJSONString(medAdmissionNote), "", "修改入院记录");
+
             }
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("入院记录", medAdmissionNote.getRecId(), JSON.toJSONString(medAdmissionNote), "", e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("入院记录", medAdmissionNote.getRecId(), JSON.toJSONString(medAdmissionNote), "", "入院记录出错:" + e.getMessage());
         }
     }
 

+ 59 - 55
src/main/java/com/diagbot/facade/str/AStrBloodResultFacade.java

@@ -52,38 +52,40 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
 
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrBloodResult strBloodResult =new StrBloodResult();
+            StrBloodResult strBloodResult = new StrBloodResult();
             AStrBloodResultVO aStrBloodResultVO = (AStrBloodResultVO) MapUtil.mapToObject(map, AStrBloodResultVO.class);
-            BeanUtils.copyProperties(aStrBloodResultVO,strBloodResult);
-            BeanUtils.copyProperties(hisViewVos.get(0),strBloodResult);
+            BeanUtils.copyProperties(aStrBloodResultVO, strBloodResult);
+            BeanUtils.copyProperties(hisViewVos.get(0), strBloodResult);
             strBloodResult.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
 
             this.dealData(strBloodResult);
@@ -93,25 +95,25 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strBloodResult");
-        if(!flag){
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strBloodResult");
+        if (!flag) {
             return;
         }
         //Map<String, String> map=columnFacade.getColumn("strBloodResult");
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrBloodResult strBloodResult=new StrBloodResult();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrBloodResult strBloodResult = new StrBloodResult();
         try {
-            AStrBloodResultVO strBloodResultVO=(AStrBloodResultVO) MapUtil.mapToObject(entityMap, AStrBloodResultVO.class);
-            BeanUtils.copyProperties(strBloodResultVO,strBloodResult);
+            AStrBloodResultVO strBloodResultVO = (AStrBloodResultVO) MapUtil.mapToObject(entityMap, AStrBloodResultVO.class);
+            BeanUtils.copyProperties(strBloodResultVO, strBloodResult);
             strBloodResult.setHospitalId(hospitalId);//医院编码
             strBloodResult.setAuditDate(DateUtil.parseDateTime(strBloodResultVO.getAuditDate()));//审核时间
             strBloodResult.setRecDate(DateUtil.parseDateTime(strBloodResultVO.getRecDate()));//记录时间
@@ -119,20 +121,20 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
 
             strBloodResult.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strBloodResult)){
+            if (isExist(strBloodResult)) {
                 strBloodResult.setGmtCreate(new Date());//记录创建时间
                 this.save(strBloodResult);
-            }else{
+            } else {
                 strBloodResult.setGmtModified(new Date());//记录修改时间
-                this.update(strBloodResult,new QueryWrapper<StrBloodResult>()
+                this.update(strBloodResult, new QueryWrapper<StrBloodResult>()
                         .eq("rec_id", strBloodResult.getRecId())
                         .eq("hospital_id", strBloodResult.getHospitalId())
                         .eq("behospital_code", strBloodResult.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("输血效果评价",strBloodResult.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("输血效果评价", strBloodResult.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
@@ -142,14 +144,14 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
      * @Author:liuqq
      * @time: ${DATE} ${TIME}
      **/
-    public Boolean isExist(StrBloodResult strBloodResult){
-        Boolean flag=true;
+    public Boolean isExist(StrBloodResult strBloodResult) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrBloodResult>()
                 .eq("rec_id", strBloodResult.getRecId())
                 .eq("hospital_id", strBloodResult.getHospitalId())
                 .eq("behospital_code", strBloodResult.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -182,25 +184,27 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
         }
     }
 
-    public void dealData(StrBloodResult medBloodResult){
+    public void dealData(StrBloodResult medBloodResult) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medBloodResult)){
+            if (isExist(medBloodResult)) {
                 medBloodResult.setGmtCreate(new Date());//记录创建时间
                 this.save(medBloodResult);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("输血效果评价", medBloodResult.getRecId(), JSON.toJSONString(medBloodResult), "", "新增输血效果评价");
+            } else {
                 medBloodResult.setGmtModified(new Date());//记录修改时间
                 medBloodResult.setIsDeleted("N");
-                this.update(medBloodResult,new QueryWrapper<StrBloodResult>()
+                this.update(medBloodResult, new QueryWrapper<StrBloodResult>()
                         .eq("rec_id", medBloodResult.getRecId())
                         .eq("hospital_id", medBloodResult.getHospitalId())
                         .eq("behospital_code", medBloodResult.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("输血效果评价", medBloodResult.getRecId(), JSON.toJSONString(medBloodResult), "", "修改输血效果评价");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("输血效果评价",medBloodResult.getRecId(), JSON.toJSONString(medBloodResult),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("输血效果评价", medBloodResult.getRecId(), JSON.toJSONString(medBloodResult), "", "输血效果评价出错:" + e.getMessage());
         }
 
     }
@@ -210,30 +214,30 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
      * @Author:liuqq
      * @time: ${DATE} ${TIME}
      **/
-    public RespDTO execDealData(List<StrBloodResultVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrBloodResultVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrBloodResultVO strBloodResultVO:list) {
-                if("".equals(strBloodResultVO.getRecId())) {
+            for (StrBloodResultVO strBloodResultVO : list) {
+                if ("".equals(strBloodResultVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strBloodResultVO.getHospitalId()==null){
+                } else if (strBloodResultVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strBloodResultVO.getBehospitalCode())){
+                } else if ("".equals(strBloodResultVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrBloodResult> strBloodResultList= Lists.newArrayList();
-            strBloodResultList= BeanUtil.listCopyTo(list,StrBloodResult.class);
+            List<StrBloodResult> strBloodResultList = Lists.newArrayList();
+            strBloodResultList = BeanUtil.listCopyTo(list, StrBloodResult.class);
             execute(strBloodResultList);
 
             return RespDTO.onSuc(strBloodResultList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrBloodResult> list){
+    public void execute(List<StrBloodResult> list) {
         try {
             List<StrBloodResult> addE = Lists.newLinkedList();
             List<StrBloodResult> updateE = Lists.newLinkedList();
@@ -242,7 +246,7 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
                     StrBloodResult strBloodResult = this.getOne(new QueryWrapper<StrBloodResult>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strBloodResult != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -252,15 +256,15 @@ public class AStrBloodResultFacade extends StrBloodResultServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strBloodResultService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-输血后效果评价","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-输血后效果评价", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 60 - 56
src/main/java/com/diagbot/facade/str/AStrBloodTransfusionFacade.java

@@ -56,38 +56,40 @@ public class AStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
 
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrBloodTransfusion strBloodTransfusion =new StrBloodTransfusion();
-            AStrBloodTransfusionVO aStrBloodTransfusionVO= (AStrBloodTransfusionVO) MapUtil.mapToObject(map, AStrBloodTransfusionVO.class);
-            BeanUtils.copyProperties(aStrBloodTransfusionVO,strBloodTransfusion);
-            BeanUtils.copyProperties(hisViewVos.get(0),strBloodTransfusion);
+            StrBloodTransfusion strBloodTransfusion = new StrBloodTransfusion();
+            AStrBloodTransfusionVO aStrBloodTransfusionVO = (AStrBloodTransfusionVO) MapUtil.mapToObject(map, AStrBloodTransfusionVO.class);
+            BeanUtils.copyProperties(aStrBloodTransfusionVO, strBloodTransfusion);
+            BeanUtils.copyProperties(hisViewVos.get(0), strBloodTransfusion);
             strBloodTransfusion.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strBloodTransfusion);
         } catch (Exception e) {
@@ -96,27 +98,27 @@ public class AStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strBloodTransfusion");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strBloodTransfusion");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrBloodTransfusion strBloodTransfusion=new StrBloodTransfusion();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrBloodTransfusion strBloodTransfusion = new StrBloodTransfusion();
         try {
-            AStrBloodTransfusionVO strBloodTransfusionVO=(AStrBloodTransfusionVO) MapUtil.mapToObject(entityMap, AStrBloodTransfusionVO.class);
-            BeanUtils.copyProperties(strBloodTransfusionVO,strBloodTransfusion);
+            AStrBloodTransfusionVO strBloodTransfusionVO = (AStrBloodTransfusionVO) MapUtil.mapToObject(entityMap, AStrBloodTransfusionVO.class);
+            BeanUtils.copyProperties(strBloodTransfusionVO, strBloodTransfusion);
             strBloodTransfusion.setHospitalId(hospitalId);//医院编码
             strBloodTransfusion.setStartTime(DateUtil.parseDateTime(strBloodTransfusionVO.getStartTime()));
             strBloodTransfusion.setEndTime(DateUtil.parseDateTime(strBloodTransfusionVO.getEndTime()));
@@ -127,32 +129,32 @@ public class AStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
             strBloodTransfusion.setWholeData(columnMap);
 
             //判断数据库中是否存在,不存在insert
-            if(isExist(strBloodTransfusion)){
+            if (isExist(strBloodTransfusion)) {
                 strBloodTransfusion.setGmtCreate(new Date());//记录创建时间
                 this.save(strBloodTransfusion);
-            }else{
+            } else {
                 strBloodTransfusion.setGmtModified(new Date());//记录修改时间
-                this.update(strBloodTransfusion,new QueryWrapper<StrBloodTransfusion>()
+                this.update(strBloodTransfusion, new QueryWrapper<StrBloodTransfusion>()
                         .eq("rec_id", strBloodTransfusion.getRecId())
                         .eq("hospital_id", strBloodTransfusion.getHospitalId())
                         .eq("behospital_code", strBloodTransfusion.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("输血记录", strBloodTransfusion.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("输血记录", strBloodTransfusion.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrBloodTransfusion strBloodTransfusion){
-        Boolean flag=true;
+    public Boolean isExist(StrBloodTransfusion strBloodTransfusion) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrBloodTransfusion>()
                 .eq("rec_id", strBloodTransfusion.getRecId())
                 .eq("hospital_id", strBloodTransfusion.getHospitalId())
                 .eq("behospital_code", strBloodTransfusion.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -185,52 +187,54 @@ public class AStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
         }
     }
 
-    public void dealData(StrBloodTransfusion medBloodTransfusion){
+    public void dealData(StrBloodTransfusion medBloodTransfusion) {
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medBloodTransfusion)){
+            if (isExist(medBloodTransfusion)) {
                 medBloodTransfusion.setGmtCreate(new Date());//记录创建时间
                 this.save(medBloodTransfusion);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("输血记录", medBloodTransfusion.getRecId(), JSON.toJSONString(medBloodTransfusion), "", "新增输血记录");
+            } else {
                 medBloodTransfusion.setGmtModified(new Date());//记录修改时间
                 medBloodTransfusion.setIsDeleted("N");
-                this.update(medBloodTransfusion,new QueryWrapper<StrBloodTransfusion>()
+                this.update(medBloodTransfusion, new QueryWrapper<StrBloodTransfusion>()
                         .eq("rec_id", medBloodTransfusion.getRecId())
                         .eq("hospital_id", medBloodTransfusion.getHospitalId())
                         .eq("behospital_code", medBloodTransfusion.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("输血记录", medBloodTransfusion.getRecId(), JSON.toJSONString(medBloodTransfusion), "", "修改输血记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("输血记录", medBloodTransfusion.getRecId(),JSON.toJSONString(medBloodTransfusion),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("输血记录", medBloodTransfusion.getRecId(), JSON.toJSONString(medBloodTransfusion), "", "输血记录出错:" + e.getMessage());
         }
 
     }
 
-    public RespDTO execDealData(List<StrBloodTransfusionVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrBloodTransfusionVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrBloodTransfusionVO strBloodTransfusionVO:list) {
-                if("".equals(strBloodTransfusionVO.getRecId())) {
+            for (StrBloodTransfusionVO strBloodTransfusionVO : list) {
+                if ("".equals(strBloodTransfusionVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strBloodTransfusionVO.getHospitalId()==null){
+                } else if (strBloodTransfusionVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strBloodTransfusionVO.getBehospitalCode())){
+                } else if ("".equals(strBloodTransfusionVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrBloodTransfusion> strBloodTransfusionList= Lists.newArrayList();
-            strBloodTransfusionList= BeanUtil.listCopyTo(list,StrBloodTransfusion.class);
+            List<StrBloodTransfusion> strBloodTransfusionList = Lists.newArrayList();
+            strBloodTransfusionList = BeanUtil.listCopyTo(list, StrBloodTransfusion.class);
             execute(strBloodTransfusionList);
 
             return RespDTO.onSuc(strBloodTransfusionList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrBloodTransfusion> list){
+    public void execute(List<StrBloodTransfusion> list) {
         try {
             List<StrBloodTransfusion> addE = Lists.newLinkedList();
             List<StrBloodTransfusion> updateE = Lists.newLinkedList();
@@ -239,7 +243,7 @@ public class AStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
                     StrBloodTransfusion strBloodTransfusion = this.getOne(new QueryWrapper<StrBloodTransfusion>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strBloodTransfusion != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -249,15 +253,15 @@ public class AStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strBloodTransfusionService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-入院记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-入院记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 60 - 55
src/main/java/com/diagbot/facade/str/AStrConsultationRecordFacade.java

@@ -35,6 +35,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 @Component
 public class AStrConsultationRecordFacade extends StrConsultationRecordServiceImpl {
 
@@ -50,37 +51,39 @@ public class AStrConsultationRecordFacade extends StrConsultationRecordServiceIm
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrConsultationRecord strConsultationRecord =new StrConsultationRecord();
+            StrConsultationRecord strConsultationRecord = new StrConsultationRecord();
             AStrConsultationRecordVO aStrConsultationRecordVO = (AStrConsultationRecordVO) MapUtil.mapToObject(map, AStrConsultationRecordVO.class);
-            BeanUtils.copyProperties(aStrConsultationRecordVO,strConsultationRecord);
-            BeanUtils.copyProperties(hisViewVos.get(0),strConsultationRecord);
+            BeanUtils.copyProperties(aStrConsultationRecordVO, strConsultationRecord);
+            BeanUtils.copyProperties(hisViewVos.get(0), strConsultationRecord);
             strConsultationRecord.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strConsultationRecord);
         } catch (Exception e) {
@@ -89,27 +92,27 @@ public class AStrConsultationRecordFacade extends StrConsultationRecordServiceIm
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strConsultationRecord");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strConsultationRecord");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationRecord");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
     //会诊记录
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrConsultationRecord strConsultationRecord=new StrConsultationRecord();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrConsultationRecord strConsultationRecord = new StrConsultationRecord();
         try {
-            AStrConsultationRecordVO AStrConsultationRecordVO=(AStrConsultationRecordVO) MapUtil.mapToObject(entityMap, AStrConsultationRecordVO.class);
-            BeanUtils.copyProperties(AStrConsultationRecordVO,strConsultationRecord);
+            AStrConsultationRecordVO AStrConsultationRecordVO = (AStrConsultationRecordVO) MapUtil.mapToObject(entityMap, AStrConsultationRecordVO.class);
+            BeanUtils.copyProperties(AStrConsultationRecordVO, strConsultationRecord);
             strConsultationRecord.setHospitalId(hospitalId);//医院编码
 
             strConsultationRecord.setRecordDate(DateUtil.parseDateTime(AStrConsultationRecordVO.getRecordDate()));//病历日期recordDate
@@ -121,32 +124,32 @@ public class AStrConsultationRecordFacade extends StrConsultationRecordServiceIm
 
             strConsultationRecord.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strConsultationRecord)){
+            if (isExist(strConsultationRecord)) {
                 strConsultationRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(strConsultationRecord);
-            }else{
+            } else {
                 strConsultationRecord.setGmtModified(new Date());//记录修改时间
-                this.update(strConsultationRecord,new QueryWrapper<StrConsultationRecord>()
+                this.update(strConsultationRecord, new QueryWrapper<StrConsultationRecord>()
                         .eq("rec_id", strConsultationRecord.getRecId())
                         .eq("hospital_id", strConsultationRecord.getHospitalId())
                         .eq("behospital_code", strConsultationRecord.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊记录)",strConsultationRecord.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊记录)", strConsultationRecord.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrConsultationRecord strConsultationRecord){
-        Boolean flag=true;
+    public Boolean isExist(StrConsultationRecord strConsultationRecord) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrConsultationRecord>()
                 .eq("rec_id", strConsultationRecord.getRecId())
                 .eq("hospital_id", strConsultationRecord.getHospitalId())
                 .eq("behospital_code", strConsultationRecord.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -179,52 +182,54 @@ public class AStrConsultationRecordFacade extends StrConsultationRecordServiceIm
         }
     }
 
-    public void dealData(StrConsultationRecord medConsultationRecord){
+    public void dealData(StrConsultationRecord medConsultationRecord) {
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medConsultationRecord)){
+            if (isExist(medConsultationRecord)) {
                 medConsultationRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(medConsultationRecord);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("会诊记录", medConsultationRecord.getRecId(), JSON.toJSONString(medConsultationRecord), "", "新增会诊记录");
+            } else {
                 medConsultationRecord.setGmtModified(new Date());//记录修改时间
                 medConsultationRecord.setIsDeleted("N");
-                this.update(medConsultationRecord,new QueryWrapper<StrConsultationRecord>()
+                this.update(medConsultationRecord, new QueryWrapper<StrConsultationRecord>()
                         .eq("rec_id", medConsultationRecord.getRecId())
                         .eq("hospital_id", medConsultationRecord.getHospitalId())
                         .eq("behospital_code", medConsultationRecord.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("会诊记录", medConsultationRecord.getRecId(), JSON.toJSONString(medConsultationRecord), "", "修改会诊记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊记录",medConsultationRecord.getRecId(), JSON.toJSONString(medConsultationRecord),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊记录", medConsultationRecord.getRecId(), JSON.toJSONString(medConsultationRecord), "", "会诊记录出错:" + e.getMessage());
         }
 
     }
 
-    public RespDTO execDealData(List<StrConsultationRecordVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrConsultationRecordVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrConsultationRecordVO strConsultationRecordVO:list) {
-                if("".equals(strConsultationRecordVO.getRecId())) {
+            for (StrConsultationRecordVO strConsultationRecordVO : list) {
+                if ("".equals(strConsultationRecordVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strConsultationRecordVO.getHospitalId()==null){
+                } else if (strConsultationRecordVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strConsultationRecordVO.getBehospitalCode())){
+                } else if ("".equals(strConsultationRecordVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrConsultationRecord> strConsultationRecordList= Lists.newArrayList();
-            strConsultationRecordList= BeanUtil.listCopyTo(list,StrConsultationRecord.class);
+            List<StrConsultationRecord> strConsultationRecordList = Lists.newArrayList();
+            strConsultationRecordList = BeanUtil.listCopyTo(list, StrConsultationRecord.class);
             execute(strConsultationRecordList);
 
             return RespDTO.onSuc(strConsultationRecordList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrConsultationRecord> list){
+    public void execute(List<StrConsultationRecord> list) {
         try {
             List<StrConsultationRecord> addE = Lists.newLinkedList();
             List<StrConsultationRecord> updateE = Lists.newLinkedList();
@@ -233,7 +238,7 @@ public class AStrConsultationRecordFacade extends StrConsultationRecordServiceIm
                     StrConsultationRecord strConsultationRecord = this.getOne(new QueryWrapper<StrConsultationRecord>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strConsultationRecord != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -243,15 +248,15 @@ public class AStrConsultationRecordFacade extends StrConsultationRecordServiceIm
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strConsultationRecordService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 64 - 58
src/main/java/com/diagbot/facade/str/AStrConsultationResultFacade.java

@@ -57,70 +57,72 @@ public class AStrConsultationResultFacade extends StrConsultationResultServiceIm
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrConsultationResult strConsultationResult =new StrConsultationResult();
+            StrConsultationResult strConsultationResult = new StrConsultationResult();
             AStrConsultationResultVO strConsultationResult1 = (AStrConsultationResultVO) MapUtil.mapToObject(map, AStrConsultationResultVO.class);
 
 
-            BeanUtils.copyProperties(strConsultationResult1,strConsultationResult);
-            BeanUtils.copyProperties(hisViewVos.get(0),strConsultationResult);
+            BeanUtils.copyProperties(strConsultationResult1, strConsultationResult);
+            BeanUtils.copyProperties(hisViewVos.get(0), strConsultationResult);
 
             strConsultationResult.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),"31");
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), "31");
 
             this.dealData(strConsultationResult);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊结果单多变一", hisViewVos.get(0).getRecId(), JSON.toJSONString(hisViewVos), "", e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单多变一", hisViewVos.get(0).getRecId(), JSON.toJSONString(hisViewVos), "", e.getMessage());
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strConsultationResult");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strConsultationResult");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    //会诊结果
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrConsultationResult strConsultationResult=new StrConsultationResult();
+    //会诊申请
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrConsultationResult strConsultationResult = new StrConsultationResult();
         try {
-            AStrConsultationResultVO strConsultationResultVO=(AStrConsultationResultVO) MapUtil.mapToObject(entityMap, AStrConsultationResultVO.class);
-            BeanUtils.copyProperties(strConsultationResultVO,strConsultationResult);
+            AStrConsultationResultVO strConsultationResultVO = (AStrConsultationResultVO) MapUtil.mapToObject(entityMap, AStrConsultationResultVO.class);
+            BeanUtils.copyProperties(strConsultationResultVO, strConsultationResult);
             strConsultationResult.setHospitalId(hospitalId);//医院编码
 
             strConsultationResult.setAuditDate(DateUtil.parseDateTime(strConsultationResultVO.getAuditDate()));//审核时间
@@ -132,32 +134,32 @@ public class AStrConsultationResultFacade extends StrConsultationResultServiceIm
 
             strConsultationResult.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strConsultationResult)){
+            if (isExist(strConsultationResult)) {
                 strConsultationResult.setGmtCreate(new Date());//记录创建时间
                 this.save(strConsultationResult);
-            }else{
+            } else {
                 strConsultationResult.setGmtModified(new Date());//记录修改时间
-                this.update(strConsultationResult,new QueryWrapper<StrConsultationResult>()
+                this.update(strConsultationResult, new QueryWrapper<StrConsultationResult>()
                         .eq("rec_id", strConsultationResult.getRecId())
                         .eq("hospital_id", strConsultationResult.getHospitalId())
                         .eq("behospital_code", strConsultationResult.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊结果单",strConsultationResult.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单", strConsultationResult.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrConsultationResult strConsultationResult){
-        Boolean flag=true;
+    public Boolean isExist(StrConsultationResult strConsultationResult) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrConsultationResult>()
                 .eq("rec_id", strConsultationResult.getRecId())
                 .eq("hospital_id", strConsultationResult.getHospitalId())
                 .eq("behospital_code", strConsultationResult.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -185,57 +187,61 @@ public class AStrConsultationResultFacade extends StrConsultationResultServiceIm
                 return RespDTO.onSuc(flag);
             }
         } catch (Exception e) {
-            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊结果单-删除", "", JSON.toJSONString(aDeleteFlagVO), "", e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单-删除", "", JSON.toJSONString(aDeleteFlagVO), "", e.getMessage());
             return RespDTO.onError(e.getMessage());
         }
     }
 
-    public void dealData(StrConsultationResult medConsultationResult){
+    public void dealData(StrConsultationResult medConsultationResult) {
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medConsultationResult)){
+            if (isExist(medConsultationResult)) {
                 medConsultationResult.setGmtCreate(new Date());//记录创建时间
                 this.save(medConsultationResult);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单", medConsultationResult.getRecId(), JSON.toJSONString(medConsultationResult), "", "新增会诊申请单");
+
+            } else {
                 medConsultationResult.setGmtModified(new Date());//记录修改时间
                 medConsultationResult.setIsDeleted("N");
-                this.update(medConsultationResult,new QueryWrapper<StrConsultationResult>()
+                this.update(medConsultationResult, new QueryWrapper<StrConsultationResult>()
                         .eq("rec_id", medConsultationResult.getRecId())
                         .eq("hospital_id", medConsultationResult.getHospitalId())
                         .eq("behospital_code", medConsultationResult.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单", medConsultationResult.getRecId(), JSON.toJSONString(medConsultationResult), "", "修改会诊申请单");
+
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊结果单",medConsultationResult.getRecId(), JSON.toJSONString(medConsultationResult),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单", medConsultationResult.getRecId(), JSON.toJSONString(medConsultationResult), "", "会诊申请单出错:" + e.getMessage());
         }
 
     }
 
-    public RespDTO execDealData(List<StrConsultationResultVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrConsultationResultVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrConsultationResultVO strConsultationResultVO:list) {
-                if("".equals(strConsultationResultVO.getRecId())) {
+            for (StrConsultationResultVO strConsultationResultVO : list) {
+                if ("".equals(strConsultationResultVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strConsultationResultVO.getHospitalId()==null){
+                } else if (strConsultationResultVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strConsultationResultVO.getBehospitalCode())){
+                } else if ("".equals(strConsultationResultVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrConsultationResult> strConsultationResultList= Lists.newArrayList();
-            strConsultationResultList= BeanUtil.listCopyTo(list,StrConsultationResult.class);
+            List<StrConsultationResult> strConsultationResultList = Lists.newArrayList();
+            strConsultationResultList = BeanUtil.listCopyTo(list, StrConsultationResult.class);
             execute(strConsultationResultList);
 
             return RespDTO.onSuc(strConsultationResultList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrConsultationResult> list){
+    public void execute(List<StrConsultationResult> list) {
         try {
             List<StrConsultationResult> addE = Lists.newLinkedList();
             List<StrConsultationResult> updateE = Lists.newLinkedList();
@@ -244,7 +250,7 @@ public class AStrConsultationResultFacade extends StrConsultationResultServiceIm
                     StrConsultationResult strConsultationResult = this.getOne(new QueryWrapper<StrConsultationResult>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strConsultationResult != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -254,15 +260,15 @@ public class AStrConsultationResultFacade extends StrConsultationResultServiceIm
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strConsultationResultService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊结果单","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊申请单", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 62 - 58
src/main/java/com/diagbot/facade/str/AStrDeathDiscussionFacade.java

@@ -51,44 +51,46 @@ public class AStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
-                            if (s.getDeValue1()!=null){
+                            if (s.getDeValue1() != null) {
                                 map.put(s.getKeyEn(), s.getDeValue1());
                                 wholeData.put(k, s.getDeValue1());
-                            }else {
+                            } else {
                                 map.put(s.getKeyEn(), s.getDeValue2());
                                 wholeData.put(k, s.getDeValue2());
                             }
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue1());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue1());
                 }
             }
-            StrDeathDiscussion strDeathDiscussion =new StrDeathDiscussion();
+            StrDeathDiscussion strDeathDiscussion = new StrDeathDiscussion();
             AStrDeathDiscussionVO aStrDeathDiscussionVO = (AStrDeathDiscussionVO) MapUtil.mapToObject(map, AStrDeathDiscussionVO.class);
-            BeanUtils.copyProperties(aStrDeathDiscussionVO,strDeathDiscussion);
-            BeanUtils.copyProperties(hisViewVos.get(0),strDeathDiscussion);
+            BeanUtils.copyProperties(aStrDeathDiscussionVO, strDeathDiscussion);
+            BeanUtils.copyProperties(hisViewVos.get(0), strDeathDiscussion);
 
-            strDeathDiscussion.setDiscussDate(DateUtil.parseDate(aStrDeathDiscussionVO.getDiscussDate(),"yyyy-MM-dd HH:mm"));//讨论时间
+            strDeathDiscussion.setDiscussDate(DateUtil.parseDate(aStrDeathDiscussionVO.getDiscussDate(), "yyyy-MM-dd HH:mm"));//讨论时间
             strDeathDiscussion.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strDeathDiscussion);
         } catch (Exception e) {
@@ -97,28 +99,28 @@ public class AStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strDeathDiscussion");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strDeathDiscussion");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
     //死亡病例讨论记录
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrDeathDiscussion strDeathDiscussion=new StrDeathDiscussion();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrDeathDiscussion strDeathDiscussion = new StrDeathDiscussion();
         try {
-            AStrDeathDiscussionVO strDeathDiscussionVO=(AStrDeathDiscussionVO) MapUtil.mapToObject(entityMap, AStrDeathDiscussionVO.class);
-            BeanUtils.copyProperties(strDeathDiscussionVO,strDeathDiscussion);
+            AStrDeathDiscussionVO strDeathDiscussionVO = (AStrDeathDiscussionVO) MapUtil.mapToObject(entityMap, AStrDeathDiscussionVO.class);
+            BeanUtils.copyProperties(strDeathDiscussionVO, strDeathDiscussion);
             strDeathDiscussion.setHospitalId(hospitalId);//医院编码
 
             strDeathDiscussion.setAuditDate(DateUtil.parseDateTime(strDeathDiscussionVO.getAuditDate()));//审核时间
@@ -129,32 +131,32 @@ public class AStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
 
             strDeathDiscussion.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strDeathDiscussion)){
+            if (isExist(strDeathDiscussion)) {
                 strDeathDiscussion.setGmtCreate(new Date());//记录创建时间
                 this.save(strDeathDiscussion);
-            }else{
+            } else {
                 strDeathDiscussion.setGmtModified(new Date());//记录修改时间
-                this.update(strDeathDiscussion,new QueryWrapper<StrDeathDiscussion>()
+                this.update(strDeathDiscussion, new QueryWrapper<StrDeathDiscussion>()
                         .eq("rec_id", strDeathDiscussion.getRecId())
                         .eq("hospital_id", strDeathDiscussion.getHospitalId())
                         .eq("behospital_code", strDeathDiscussion.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡病例讨论记录",strDeathDiscussion.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡病例讨论记录", strDeathDiscussion.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrDeathDiscussion strDeathDiscussion){
-        Boolean flag=true;
+    public Boolean isExist(StrDeathDiscussion strDeathDiscussion) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrDeathDiscussion>()
                 .eq("rec_id", strDeathDiscussion.getRecId())
                 .eq("hospital_id", strDeathDiscussion.getHospitalId())
                 .eq("behospital_code", strDeathDiscussion.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -187,53 +189,55 @@ public class AStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
         }
     }
 
-    public void dealData(StrDeathDiscussion medDeathDiscussion){
+    public void dealData(StrDeathDiscussion medDeathDiscussion) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathDiscussion)){
+            if (isExist(medDeathDiscussion)) {
                 medDeathDiscussion.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathDiscussion);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("死亡病例讨论记录", medDeathDiscussion.getRecId(), JSON.toJSONString(medDeathDiscussion), "", "新增死亡病例讨论记录");
+            } else {
                 medDeathDiscussion.setGmtModified(new Date());//记录修改时间
                 medDeathDiscussion.setIsDeleted("N");
-                this.update(medDeathDiscussion,new QueryWrapper<StrDeathDiscussion>()
+                this.update(medDeathDiscussion, new QueryWrapper<StrDeathDiscussion>()
                         .eq("rec_id", medDeathDiscussion.getRecId())
                         .eq("hospital_id", medDeathDiscussion.getHospitalId())
                         .eq("behospital_code", medDeathDiscussion.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("死亡病例讨论记录", medDeathDiscussion.getRecId(), JSON.toJSONString(medDeathDiscussion), "", "修改死亡病例讨论记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡病例讨论记录",medDeathDiscussion.getRecId(), JSON.toJSONString(medDeathDiscussion),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡病例讨论记录", medDeathDiscussion.getRecId(), JSON.toJSONString(medDeathDiscussion), "", "死亡病例讨论记录出错:" + e.getMessage());
         }
 
     }
 
-    public RespDTO execDealData(List<StrDeathDiscussionVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrDeathDiscussionVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrDeathDiscussionVO strDeathDiscussionVO:list) {
-                if("".equals(strDeathDiscussionVO.getRecId())) {
+            for (StrDeathDiscussionVO strDeathDiscussionVO : list) {
+                if ("".equals(strDeathDiscussionVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strDeathDiscussionVO.getHospitalId()==null){
+                } else if (strDeathDiscussionVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strDeathDiscussionVO.getBehospitalCode())){
+                } else if ("".equals(strDeathDiscussionVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrDeathDiscussion> strDeathDiscussionList= Lists.newArrayList();
-            strDeathDiscussionList= BeanUtil.listCopyTo(list,StrDeathDiscussion.class);
+            List<StrDeathDiscussion> strDeathDiscussionList = Lists.newArrayList();
+            strDeathDiscussionList = BeanUtil.listCopyTo(list, StrDeathDiscussion.class);
             execute(strDeathDiscussionList);
 
             return RespDTO.onSuc(strDeathDiscussionList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrDeathDiscussion> list){
+    public void execute(List<StrDeathDiscussion> list) {
         try {
             List<StrDeathDiscussion> addE = Lists.newLinkedList();
             List<StrDeathDiscussion> updateE = Lists.newLinkedList();
@@ -242,7 +246,7 @@ public class AStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
                     StrDeathDiscussion strDeathDiscussion = this.getOne(new QueryWrapper<StrDeathDiscussion>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strDeathDiscussion != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -252,15 +256,15 @@ public class AStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strDeathDiscussionService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡病例讨论记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡病例讨论记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 61 - 57
src/main/java/com/diagbot/facade/str/AStrDeathNoteFacade.java

@@ -52,40 +52,42 @@ public class AStrDeathNoteFacade extends StrDeathNoteServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrDeathNote strDeathNote =new StrDeathNote();
+            StrDeathNote strDeathNote = new StrDeathNote();
             AStrDeathNoteVO strDeathNoteVO = (AStrDeathNoteVO) MapUtil.mapToObject(map, AStrDeathNoteVO.class);
-            BeanUtils.copyProperties(strDeathNoteVO,strDeathNote);
-            strDeathNote.setDeathDate(DateUtil.parseDate(strDeathNoteVO.getDeathDate(),"yyyy-MM-dd HH:mm:ss"));//结束时间
-            strDeathNote.setBehospitalDate(DateUtil.parseDate(strDeathNoteVO.getBehospitalDate(),"yyyy-MM-dd HH:mm:ss"));//结束时间
+            BeanUtils.copyProperties(strDeathNoteVO, strDeathNote);
+            strDeathNote.setDeathDate(DateUtil.parseDate(strDeathNoteVO.getDeathDate(), "yyyy-MM-dd HH:mm:ss"));//结束时间
+            strDeathNote.setBehospitalDate(DateUtil.parseDate(strDeathNoteVO.getBehospitalDate(), "yyyy-MM-dd HH:mm:ss"));//结束时间
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strDeathNote);
+            BeanUtils.copyProperties(hisViewVos.get(0), strDeathNote);
             strDeathNote.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strDeathNote);
         } catch (Exception e) {
@@ -94,27 +96,27 @@ public class AStrDeathNoteFacade extends StrDeathNoteServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strDeathNote");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strDeathNote");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
     //死亡记录
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrDeathNote strDeathNote=new StrDeathNote();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrDeathNote strDeathNote = new StrDeathNote();
         try {
-            AStrDeathNoteVO strDeathNoteVO=(AStrDeathNoteVO) MapUtil.mapToObject(entityMap, AStrDeathNoteVO.class);
-            BeanUtils.copyProperties(strDeathNoteVO,strDeathNote);
+            AStrDeathNoteVO strDeathNoteVO = (AStrDeathNoteVO) MapUtil.mapToObject(entityMap, AStrDeathNoteVO.class);
+            BeanUtils.copyProperties(strDeathNoteVO, strDeathNote);
             strDeathNote.setHospitalId(hospitalId);//医院编码
 
             strDeathNote.setAuditDate(DateUtil.parseDateTime(strDeathNoteVO.getAuditDate()));//审核时间
@@ -125,32 +127,32 @@ public class AStrDeathNoteFacade extends StrDeathNoteServiceImpl {
 
             strDeathNote.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strDeathNote)){
+            if (isExist(strDeathNote)) {
                 strDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(strDeathNote);
-            }else{
+            } else {
                 strDeathNote.setGmtModified(new Date());//记录修改时间
-                this.update(strDeathNote,new QueryWrapper<StrDeathNote>()
+                this.update(strDeathNote, new QueryWrapper<StrDeathNote>()
                         .eq("rec_id", strDeathNote.getRecId())
                         .eq("hospital_id", strDeathNote.getHospitalId())
                         .eq("behospital_code", strDeathNote.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡记录", strDeathNote.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡记录", strDeathNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrDeathNote strDeathNote){
-        Boolean flag=true;
+    public Boolean isExist(StrDeathNote strDeathNote) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrDeathNote>()
                 .eq("rec_id", strDeathNote.getRecId())
                 .eq("hospital_id", strDeathNote.getHospitalId())
                 .eq("behospital_code", strDeathNote.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -183,53 +185,55 @@ public class AStrDeathNoteFacade extends StrDeathNoteServiceImpl {
         }
     }
 
-    public void dealData(StrDeathNote medDeathNote){
+    public void dealData(StrDeathNote medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("死亡记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增死亡记录");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrDeathNote>()
+                this.update(medDeathNote, new QueryWrapper<StrDeathNote>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("死亡记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改死亡记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡记录", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("死亡记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "死亡记录出错:" + e.getMessage());
         }
 
     }
 
-    public RespDTO execDealData(List<StrDeathNoteVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrDeathNoteVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrDeathNoteVO strDeathNoteVO:list) {
-                if("".equals(strDeathNoteVO.getRecId())) {
+            for (StrDeathNoteVO strDeathNoteVO : list) {
+                if ("".equals(strDeathNoteVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strDeathNoteVO.getHospitalId()==null){
+                } else if (strDeathNoteVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strDeathNoteVO.getBehospitalCode())){
+                } else if ("".equals(strDeathNoteVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrDeathNote> strDeathNoteList= Lists.newArrayList();
-            strDeathNoteList= BeanUtil.listCopyTo(list,StrDeathNote.class);
+            List<StrDeathNote> strDeathNoteList = Lists.newArrayList();
+            strDeathNoteList = BeanUtil.listCopyTo(list, StrDeathNote.class);
             execute(strDeathNoteList);
 
             return RespDTO.onSuc(strDeathNoteList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrDeathNote> list){
+    public void execute(List<StrDeathNote> list) {
         try {
             List<StrDeathNote> addE = Lists.newLinkedList();
             List<StrDeathNote> updateE = Lists.newLinkedList();
@@ -238,7 +242,7 @@ public class AStrDeathNoteFacade extends StrDeathNoteServiceImpl {
                     StrDeathNote strDeathNote = this.getOne(new QueryWrapper<StrDeathNote>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strDeathNote != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -248,15 +252,15 @@ public class AStrDeathNoteFacade extends StrDeathNoteServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strDeathNoteService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 61 - 57
src/main/java/com/diagbot/facade/str/AStrDifficultCaseFacade.java

@@ -38,7 +38,7 @@ import java.util.List;
 import java.util.Map;
 
 @Component
-public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
+public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl {
 
     @Autowired
     @Qualifier("strDifficultCaseServiceImpl")
@@ -52,39 +52,41 @@ public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrDifficultCase strDifficultCase =new StrDifficultCase();
+            StrDifficultCase strDifficultCase = new StrDifficultCase();
             AStrDifficultCaseVO strDifficultCaseVO = (AStrDifficultCaseVO) MapUtil.mapToObject(map, AStrDifficultCaseVO.class);
-            BeanUtils.copyProperties(strDifficultCaseVO,strDifficultCase);
-            strDifficultCase.setDiscussDate(DateUtil.parseDate(strDifficultCaseVO.getDiscussDate(),"yyyy-MM-dd HH:mm"));//结束时间
+            BeanUtils.copyProperties(strDifficultCaseVO, strDifficultCase);
+            strDifficultCase.setDiscussDate(DateUtil.parseDate(strDifficultCaseVO.getDiscussDate(), "yyyy-MM-dd HH:mm"));//结束时间
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strDifficultCase);
+            BeanUtils.copyProperties(hisViewVos.get(0), strDifficultCase);
             strDifficultCase.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strDifficultCase);
         } catch (Exception e) {
@@ -93,27 +95,27 @@ public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strDifficultCase");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strDifficultCase");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrDifficultCase medDifficult=new StrDifficultCase();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrDifficultCase medDifficult = new StrDifficultCase();
         try {
-            AStrDifficultCaseVO medDifficultVO=(AStrDifficultCaseVO) MapUtil.mapToObject(entityMap, AStrDifficultCaseVO.class);
-            BeanUtils.copyProperties(medDifficultVO,medDifficult);
+            AStrDifficultCaseVO medDifficultVO = (AStrDifficultCaseVO) MapUtil.mapToObject(entityMap, AStrDifficultCaseVO.class);
+            BeanUtils.copyProperties(medDifficultVO, medDifficult);
             medDifficult.setHospitalId(hospitalId);//医院编码
             medDifficult.setRecDate(DateUtil.parseDateTime(medDifficultVO.getRecDate()));
             medDifficult.setAuditDate(DateUtil.parseDateTime(medDifficultVO.getAuditDate()));
@@ -122,83 +124,85 @@ public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
 
             medDifficult.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDifficult)){
+            if (isExist(medDifficult)) {
                 medDifficult.setGmtCreate(new Date());//记录创建时间
                 this.save(medDifficult);
-            }else{
+            } else {
                 medDifficult.setGmtModified(new Date());//记录修改时间
-                this.update(medDifficult,new QueryWrapper<StrDifficultCase>()
+                this.update(medDifficult, new QueryWrapper<StrDifficultCase>()
                         .eq("rec_id", medDifficult.getRecId())
                         .eq("hospital_id", medDifficult.getHospitalId())
                         .eq("behospital_code", medDifficult.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("疑难病例讨论记录",medDifficult.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("疑难病例讨论记录", medDifficult.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrDifficultCase medDifficult){
+    public void dealData(StrDifficultCase medDifficult) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDifficult)){
+            if (isExist(medDifficult)) {
                 medDifficult.setGmtCreate(new Date());//记录创建时间
                 this.save(medDifficult);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("疑难病例讨论记录", medDifficult.getRecId(), JSON.toJSONString(medDifficult), "", "新增疑难病例讨论记录");
+            } else {
                 medDifficult.setGmtModified(new Date());//记录修改时间
                 medDifficult.setIsDeleted("N");
-                this.update(medDifficult,new QueryWrapper<StrDifficultCase>()
+                this.update(medDifficult, new QueryWrapper<StrDifficultCase>()
                         .eq("rec_id", medDifficult.getRecId())
                         .eq("hospital_id", medDifficult.getHospitalId())
                         .eq("behospital_code", medDifficult.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("疑难病例讨论记录", medDifficult.getRecId(), JSON.toJSONString(medDifficult), "", "修改疑难病例讨论记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("疑难病例讨论记录",medDifficult.getRecId(), JSON.toJSONString(medDifficult),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("疑难病例讨论记录", medDifficult.getRecId(), JSON.toJSONString(medDifficult), "", "疑难病例讨论记录出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrDifficultCase medDifficult){
-        Boolean flag=true;
+    public Boolean isExist(StrDifficultCase medDifficult) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrDifficultCase>()
                 .eq("rec_id", medDifficult.getRecId())
                 .eq("hospital_id", medDifficult.getHospitalId())
                 .eq("behospital_code", medDifficult.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
 
-    public RespDTO execDealData(List<StrDifficultCaseVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrDifficultCaseVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrDifficultCaseVO strDifficultCaseVO:list) {
-                if("".equals(strDifficultCaseVO.getRecId())) {
+            for (StrDifficultCaseVO strDifficultCaseVO : list) {
+                if ("".equals(strDifficultCaseVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strDifficultCaseVO.getHospitalId()==null){
+                } else if (strDifficultCaseVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strDifficultCaseVO.getBehospitalCode())){
+                } else if ("".equals(strDifficultCaseVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrDifficultCase> strDifficultCaseList= Lists.newArrayList();
-            strDifficultCaseList= BeanUtil.listCopyTo(list,StrDifficultCase.class);
+            List<StrDifficultCase> strDifficultCaseList = Lists.newArrayList();
+            strDifficultCaseList = BeanUtil.listCopyTo(list, StrDifficultCase.class);
             execute(strDifficultCaseList);
 
             return RespDTO.onSuc(strDifficultCaseList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrDifficultCase> list){
+    public void execute(List<StrDifficultCase> list) {
         try {
             List<StrDifficultCase> addE = Lists.newLinkedList();
             List<StrDifficultCase> updateE = Lists.newLinkedList();
@@ -207,7 +211,7 @@ public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
                     StrDifficultCase strDifficultCase = this.getOne(new QueryWrapper<StrDifficultCase>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strDifficultCase != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -217,15 +221,15 @@ public class AStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strDifficultCaseService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 

+ 60 - 55
src/main/java/com/diagbot/facade/str/AStrFirstRecordFacade.java

@@ -58,39 +58,40 @@ public class AStrFirstRecordFacade extends StrFirstRecordServiceImpl {
 
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
 
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
 
 
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrFirstRecord strFirstRecord =new StrFirstRecord();
+            StrFirstRecord strFirstRecord = new StrFirstRecord();
             AStrFirstRecordVO aStrFirstRecordVO = (AStrFirstRecordVO) MapUtil.mapToObject(map, AStrFirstRecordVO.class);
-            BeanUtils.copyProperties(aStrFirstRecordVO,strFirstRecord);
-            BeanUtils.copyProperties(hisViewVos.get(0),strFirstRecord);
+            BeanUtils.copyProperties(aStrFirstRecordVO, strFirstRecord);
+            BeanUtils.copyProperties(hisViewVos.get(0), strFirstRecord);
             strFirstRecord.setWholeData(JSON.toJSONString(wholeData));
 
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strFirstRecord);
         } catch (Exception e) {
@@ -98,27 +99,28 @@ public class AStrFirstRecordFacade extends StrFirstRecordServiceImpl {
             aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录多变一", hisViewVos.get(0).getRecId(), JSON.toJSONString(hisViewVos), "", e.getMessage());
         }
     }
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strFirstRecord");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strFirstRecord");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrFirstRecord strFirstRecord=new StrFirstRecord();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrFirstRecord strFirstRecord = new StrFirstRecord();
         try {
-            AStrFirstRecordVO strFirstRecordVO=(AStrFirstRecordVO) MapUtil.mapToObject(entityMap, AStrFirstRecordVO.class);
-            BeanUtils.copyProperties(strFirstRecordVO,strFirstRecord);
+            AStrFirstRecordVO strFirstRecordVO = (AStrFirstRecordVO) MapUtil.mapToObject(entityMap, AStrFirstRecordVO.class);
+            BeanUtils.copyProperties(strFirstRecordVO, strFirstRecord);
             strFirstRecord.setHospitalId(hospitalId);//医院编码
 
             strFirstRecord.setAuditDate(DateUtil.parseDateTime(strFirstRecordVO.getAuditDate()));//审核时间
@@ -127,81 +129,84 @@ public class AStrFirstRecordFacade extends StrFirstRecordServiceImpl {
 
             strFirstRecord.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strFirstRecord)){
+            if (isExist(strFirstRecord)) {
                 strFirstRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(strFirstRecord);
-            }else{
+            } else {
                 strFirstRecord.setGmtModified(new Date());//记录修改时间
-                this.update(strFirstRecord,new QueryWrapper<StrFirstRecord>()
+                this.update(strFirstRecord, new QueryWrapper<StrFirstRecord>()
                         .eq("rec_id", strFirstRecord.getRecId())
                         .eq("hospital_id", strFirstRecord.getHospitalId())
                         .eq("behospital_code", strFirstRecord.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录", strFirstRecord.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录", strFirstRecord.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrFirstRecord medFirstRecord){
+    public void dealData(StrFirstRecord medFirstRecord) {
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medFirstRecord)){
+            if (isExist(medFirstRecord)) {
                 medFirstRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(medFirstRecord);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录", medFirstRecord.getRecId(), JSON.toJSONString(medFirstRecord), "", "新增首次病程录");
+            } else {
                 medFirstRecord.setGmtModified(new Date());//记录修改时间
                 medFirstRecord.setIsDeleted("N");
-                this.update(medFirstRecord,new QueryWrapper<StrFirstRecord>()
+                this.update(medFirstRecord, new QueryWrapper<StrFirstRecord>()
                         .eq("rec_id", medFirstRecord.getRecId())
                         .eq("hospital_id", medFirstRecord.getHospitalId())
                         .eq("behospital_code", medFirstRecord.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录", medFirstRecord.getRecId(), JSON.toJSONString(medFirstRecord), "", "更新首次病程录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录", medFirstRecord.getRecId(),JSON.toJSONString(medFirstRecord),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("首次病程录", medFirstRecord.getRecId(), JSON.toJSONString(medFirstRecord), "", "首次病程录出错:" + e.getMessage());
         }
 
     }
-    public Boolean isExist(StrFirstRecord strFirstRecord){
-        Boolean flag=true;
+
+    public Boolean isExist(StrFirstRecord strFirstRecord) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrFirstRecord>()
                 .eq("rec_id", strFirstRecord.getRecId())
                 .eq("hospital_id", strFirstRecord.getHospitalId())
                 .eq("behospital_code", strFirstRecord.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
 
-    public RespDTO execDealData(List<StrFirstRecordVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrFirstRecordVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrFirstRecordVO strFirstRecordVO:list) {
-                if(StringUtils.isBlank(strFirstRecordVO.getRecId())) {
+            for (StrFirstRecordVO strFirstRecordVO : list) {
+                if (StringUtils.isBlank(strFirstRecordVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strFirstRecordVO.getHospitalId()==null){
+                } else if (strFirstRecordVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if(StringUtils.isBlank(strFirstRecordVO.getBehospitalCode())){
+                } else if (StringUtils.isBlank(strFirstRecordVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrFirstRecord> strFirstRecordList= Lists.newArrayList();
-            strFirstRecordList= BeanUtil.listCopyTo(list,StrFirstRecord.class);
+            List<StrFirstRecord> strFirstRecordList = Lists.newArrayList();
+            strFirstRecordList = BeanUtil.listCopyTo(list, StrFirstRecord.class);
             execute(strFirstRecordList);
 
             return RespDTO.onSuc(strFirstRecordList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrFirstRecord> list){
+    public void execute(List<StrFirstRecord> list) {
         try {
             List<StrFirstRecord> addE = Lists.newLinkedList();
             List<StrFirstRecord> updateE = Lists.newLinkedList();
@@ -210,7 +215,7 @@ public class AStrFirstRecordFacade extends StrFirstRecordServiceImpl {
                     StrFirstRecord strFirstRecord = this.getOne(new QueryWrapper<StrFirstRecord>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strFirstRecord != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -220,15 +225,15 @@ public class AStrFirstRecordFacade extends StrFirstRecordServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strFirstRecordService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-首次病程录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-首次病程录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 

+ 5 - 1
src/main/java/com/diagbot/facade/str/AStrIllCriticallyFacade.java

@@ -147,6 +147,8 @@ public class AStrIllCriticallyFacade extends StrIllCriticallyServiceImpl {
             if(isExist(medDeathNote)){
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病危通知单", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"","新增病危通知单");
+
             }else{
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
@@ -154,11 +156,13 @@ public class AStrIllCriticallyFacade extends StrIllCriticallyServiceImpl {
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病危通知单", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"","修改病危通知单");
+
             }
 
         }catch (Exception e){
             log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病危通知单", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病危通知单", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"","病危通知单出错"+e.getMessage());
         }
 
     }

+ 60 - 57
src/main/java/com/diagbot/facade/str/AStrIllSeriouslFacade.java

@@ -53,39 +53,41 @@ public class AStrIllSeriouslFacade extends StrIllSeriouslServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrIllSeriousl strIllSeriousl =new StrIllSeriousl();
+            StrIllSeriousl strIllSeriousl = new StrIllSeriousl();
             AStrIllSeriouslVO strIllSeriouslVo = (AStrIllSeriouslVO) MapUtil.mapToObject(map, AStrIllSeriouslVO.class);
-            BeanUtils.copyProperties(strIllSeriouslVo,strIllSeriousl);
-            strIllSeriousl.setDoctorSignDate(DateUtil.parseDate(strIllSeriouslVo.getDoctorSignDate(),"yyyy-MM-dd HH:mm"));//结束时间
+            BeanUtils.copyProperties(strIllSeriouslVo, strIllSeriousl);
+            strIllSeriousl.setDoctorSignDate(DateUtil.parseDate(strIllSeriouslVo.getDoctorSignDate(), "yyyy-MM-dd HH:mm"));//结束时间
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strIllSeriousl);
+            BeanUtils.copyProperties(hisViewVos.get(0), strIllSeriousl);
             strIllSeriousl.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strIllSeriousl);
         } catch (Exception e) {
@@ -94,27 +96,27 @@ public class AStrIllSeriouslFacade extends StrIllSeriouslServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strIllSeriousl");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strIllSeriousl");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrIllSeriousl strIllSeriousl=new StrIllSeriousl();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrIllSeriousl strIllSeriousl = new StrIllSeriousl();
         try {
-            AStrIllSeriouslVO strIllSeriouslVO=(AStrIllSeriouslVO) MapUtil.mapToObject(entityMap, AStrIllSeriouslVO.class);
-            BeanUtils.copyProperties(strIllSeriouslVO,strIllSeriousl);
+            AStrIllSeriouslVO strIllSeriouslVO = (AStrIllSeriouslVO) MapUtil.mapToObject(entityMap, AStrIllSeriouslVO.class);
+            BeanUtils.copyProperties(strIllSeriouslVO, strIllSeriousl);
             strIllSeriousl.setHospitalId(hospitalId);//医院编码
             strIllSeriousl.setPatientSignDate(DateUtil.parseDateTime(strIllSeriouslVO.getPatientSignDate()));
             strIllSeriousl.setDoctorSignDate(DateUtil.parseDateTime(strIllSeriouslVO.getDoctorSignDate()));//审核时间
@@ -122,83 +124,84 @@ public class AStrIllSeriouslFacade extends StrIllSeriouslServiceImpl {
 
             strIllSeriousl.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strIllSeriousl)){
+            if (isExist(strIllSeriousl)) {
                 strIllSeriousl.setGmtCreate(new Date());//记录创建时间
                 this.save(strIllSeriousl);
-            }else{
+            } else {
                 strIllSeriousl.setGmtModified(new Date());//记录修改时间
-                this.update(strIllSeriousl,new QueryWrapper<StrIllSeriousl>()
+                this.update(strIllSeriousl, new QueryWrapper<StrIllSeriousl>()
                         .eq("rec_id", strIllSeriousl.getRecId())
                         .eq("hospital_id", strIllSeriousl.getHospitalId())
                         .eq("behospital_code", strIllSeriousl.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", strIllSeriousl.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", strIllSeriousl.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrIllSeriousl medDeathNote){
+    public void dealData(StrIllSeriousl medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增病重通知单");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrIllSeriousl>()
+                this.update(medDeathNote, new QueryWrapper<StrIllSeriousl>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改病重通知单");
             }
-
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "病重通知单出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrIllSeriousl strIllSeriousl){
-        Boolean flag=true;
+    public Boolean isExist(StrIllSeriousl strIllSeriousl) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrIllSeriousl>()
                 .eq("rec_id", strIllSeriousl.getRecId())
                 .eq("hospital_id", strIllSeriousl.getHospitalId())
                 .eq("behospital_code", strIllSeriousl.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
 
-    public RespDTO execDealData(List<StrIllSeriouslVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrIllSeriouslVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrIllSeriouslVO strIllSeriouslVO:list) {
-                if("".equals(strIllSeriouslVO.getRecId())) {
+            for (StrIllSeriouslVO strIllSeriouslVO : list) {
+                if ("".equals(strIllSeriouslVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strIllSeriouslVO.getHospitalId()==null){
+                } else if (strIllSeriouslVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strIllSeriouslVO.getBehospitalCode())){
+                } else if ("".equals(strIllSeriouslVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrIllSeriousl> strIllSeriouslList= Lists.newArrayList();
-            strIllSeriouslList= BeanUtil.listCopyTo(list,StrIllSeriousl.class);
+            List<StrIllSeriousl> strIllSeriouslList = Lists.newArrayList();
+            strIllSeriouslList = BeanUtil.listCopyTo(list, StrIllSeriousl.class);
             execute(strIllSeriouslList);
 
             return RespDTO.onSuc(strIllSeriouslList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrIllSeriousl> list){
+    public void execute(List<StrIllSeriousl> list) {
         try {
             List<StrIllSeriousl> addE = Lists.newLinkedList();
             List<StrIllSeriousl> updateE = Lists.newLinkedList();
@@ -207,7 +210,7 @@ public class AStrIllSeriouslFacade extends StrIllSeriouslServiceImpl {
                     StrIllSeriousl strIllSeriousl = this.getOne(new QueryWrapper<StrIllSeriousl>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strIllSeriousl != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -217,15 +220,15 @@ public class AStrIllSeriouslFacade extends StrIllSeriouslServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strIllSeriouslService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-病重通知单","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-病重通知单", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 

+ 73 - 74
src/main/java/com/diagbot/facade/str/AStrLeaveHospitalFacade.java

@@ -51,90 +51,87 @@ public class AStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            AStrLeaveHospitalVO strLeaveHospitalVO =new AStrLeaveHospitalVO();
+            AStrLeaveHospitalVO strLeaveHospitalVO = new AStrLeaveHospitalVO();
             StrLeaveHospital strLeaveHospital = new StrLeaveHospital();
             strLeaveHospitalVO = (AStrLeaveHospitalVO) MapUtil.mapToObject(map, AStrLeaveHospitalVO.class);
-            BeanUtils.copyProperties(strLeaveHospitalVO,strLeaveHospital);
+            BeanUtils.copyProperties(strLeaveHospitalVO, strLeaveHospital);
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strLeaveHospital);
+            BeanUtils.copyProperties(hisViewVos.get(0), strLeaveHospital);
 
 
             //时间赋值
             strLeaveHospital.setAuditDate(DateUtil.parseDateTime(strLeaveHospitalVO.getAuditDate()));//审核时间
             strLeaveHospital.setRecDate(DateUtil.parseDateTime(strLeaveHospitalVO.getRecDate()));//记录时间
-            strLeaveHospital.setBehospitalDate(DateUtil.parseDate(strLeaveHospitalVO.getBehospitalDate(),"yyyy/MM/dd HH:mm:ss"));//入院日期
-            strLeaveHospital.setLeaveHospitalDate(DateUtil.parseDate(strLeaveHospitalVO.getLeaveHospitalDate(),"yyyy-MM-dd HH:mm"));//出院时间
+            strLeaveHospital.setBehospitalDate(DateUtil.parseDate(strLeaveHospitalVO.getBehospitalDate(), "yyyy/MM/dd HH:mm:ss"));//入院日期
+            strLeaveHospital.setLeaveHospitalDate(DateUtil.parseDate(strLeaveHospitalVO.getLeaveHospitalDate(), "yyyy-MM-dd HH:mm"));//出院时间
 
             strLeaveHospital.setRecordDate(DateUtil.parseDateTime(strLeaveHospitalVO.getRecordDate()));//病历日期
 
-            if (null ==strLeaveHospital.getLeaveHospitalDate()){
+            if (null == strLeaveHospital.getLeaveHospitalDate()) {
                 strLeaveHospital.setLeaveHospitalDate(DateUtil.parseDate(strLeaveHospitalVO.getLeaveHospitalDate()));//出院时间
             }
 
 
-
-
-            if (strLeaveHospital.getLeaveHospitalDate()!=null && strLeaveHospital.getBehospitalDate()!=null){
+            if (strLeaveHospital.getLeaveHospitalDate() != null && strLeaveHospital.getBehospitalDate() != null) {
                 Integer day;
                 Calendar cal1 = Calendar.getInstance();
                 cal1.setTime(strLeaveHospital.getBehospitalDate());
 
                 Calendar cal2 = Calendar.getInstance();
                 cal2.setTime(strLeaveHospital.getLeaveHospitalDate());
-                int day1= cal1.get(Calendar.DAY_OF_YEAR);
+                int day1 = cal1.get(Calendar.DAY_OF_YEAR);
                 int day2 = cal2.get(Calendar.DAY_OF_YEAR);
 
                 int year1 = cal1.get(Calendar.YEAR);
                 int year2 = cal2.get(Calendar.YEAR);
-                if(year1 != year2)   //同一年
+                if (year1 != year2)   //同一年
                 {
-                    int timeDistance = 0 ;
-                    for(int i = year1 ; i < year2 ; i ++)
-                    {
-                        if(i%4==0 && i%100!=0 || i%400==0)    //闰年
+                    int timeDistance = 0;
+                    for (int i = year1; i < year2; i++) {
+                        if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0)    //闰年
                         {
                             timeDistance += 366;
-                        }
-                        else    //不是闰年
+                        } else    //不是闰年
                         {
                             timeDistance += 365;
                         }
                     }
-                    day= timeDistance + (day2-day1) ;
-                }
-                else    //不同年
+                    day = timeDistance + (day2 - day1);
+                } else    //不同年
                 {
-                    day= day2-day1;
+                    day = day2 - day1;
                 }
                 strLeaveHospital.setBehospitalDayNum(String.valueOf(day));
-                wholeData.put("住院天数",String.valueOf(day));
+                wholeData.put("住院天数", String.valueOf(day));
             }
             strLeaveHospital.setWholeData(JSON.toJSONString(wholeData));
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strLeaveHospital);
         } catch (Exception e) {
@@ -143,28 +140,28 @@ public class AStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strLeaveHospital");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strLeaveHospital");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
     //危急值记录
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrLeaveHospital strLeaveHospital=new StrLeaveHospital();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrLeaveHospital strLeaveHospital = new StrLeaveHospital();
         try {
-            AStrLeaveHospitalVO strLeaveHospitalVO=(AStrLeaveHospitalVO) MapUtil.mapToObject(entityMap, AStrLeaveHospitalVO.class);
-            BeanUtils.copyProperties(strLeaveHospitalVO,strLeaveHospital);
+            AStrLeaveHospitalVO strLeaveHospitalVO = (AStrLeaveHospitalVO) MapUtil.mapToObject(entityMap, AStrLeaveHospitalVO.class);
+            BeanUtils.copyProperties(strLeaveHospitalVO, strLeaveHospital);
             strLeaveHospital.setHospitalId(hospitalId);//医院编码
 
             strLeaveHospital.setAuditDate(DateUtil.parseDateTime(strLeaveHospitalVO.getAuditDate()));//审核时间
@@ -175,55 +172,57 @@ public class AStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
 
             strLeaveHospital.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strLeaveHospital)){
+            if (isExist(strLeaveHospital)) {
                 strLeaveHospital.setGmtCreate(new Date());//记录创建时间
                 this.save(strLeaveHospital);
-            }else{
+            } else {
                 strLeaveHospital.setGmtModified(new Date());//记录修改时间
-                this.update(strLeaveHospital,new QueryWrapper<StrLeaveHospital>()
+                this.update(strLeaveHospital, new QueryWrapper<StrLeaveHospital>()
                         .eq("rec_id", strLeaveHospital.getRecId())
                         .eq("hospital_id", strLeaveHospital.getHospitalId())
                         .eq("behospital_code", strLeaveHospital.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("出院小结",strLeaveHospital.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("出院小结", strLeaveHospital.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrLeaveHospital medDeathNote){
+    public void dealData(StrLeaveHospital medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("出院小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增出院小结");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrLeaveHospital>()
+                this.update(medDeathNote, new QueryWrapper<StrLeaveHospital>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("出院小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改出院小结");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("出院小结", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("出院小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "出院小结出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrLeaveHospital strLeaveHospital){
-        Boolean flag=true;
+    public Boolean isExist(StrLeaveHospital strLeaveHospital) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrLeaveHospital>()
                 .eq("rec_id", strLeaveHospital.getRecId())
                 .eq("hospital_id", strLeaveHospital.getHospitalId())
                 .eq("behospital_code", strLeaveHospital.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -256,30 +255,30 @@ public class AStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
         }
     }
 
-    public RespDTO execDealData(List<StrLeaveHospitalVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrLeaveHospitalVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrLeaveHospitalVO strLeaveHospitalVO:list) {
-                if("".equals(strLeaveHospitalVO.getRecId())) {
+            for (StrLeaveHospitalVO strLeaveHospitalVO : list) {
+                if ("".equals(strLeaveHospitalVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strLeaveHospitalVO.getHospitalId()==null){
+                } else if (strLeaveHospitalVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strLeaveHospitalVO.getBehospitalCode())){
+                } else if ("".equals(strLeaveHospitalVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrLeaveHospital> strLeaveHospitalList= Lists.newArrayList();
-            strLeaveHospitalList= BeanUtil.listCopyTo(list,StrLeaveHospital.class);
+            List<StrLeaveHospital> strLeaveHospitalList = Lists.newArrayList();
+            strLeaveHospitalList = BeanUtil.listCopyTo(list, StrLeaveHospital.class);
             execute(strLeaveHospitalList);
 
             return RespDTO.onSuc(strLeaveHospitalList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrLeaveHospital> list){
+    public void execute(List<StrLeaveHospital> list) {
         try {
             List<StrLeaveHospital> addE = Lists.newLinkedList();
             List<StrLeaveHospital> updateE = Lists.newLinkedList();
@@ -288,7 +287,7 @@ public class AStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
                     StrLeaveHospital strLeaveHospital = this.getOne(new QueryWrapper<StrLeaveHospital>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strLeaveHospital != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -298,15 +297,15 @@ public class AStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strLeaveHospitalService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-出院小结","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-出院小结", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 71 - 66
src/main/java/com/diagbot/facade/str/AStrOperativeFirstRecord.java

@@ -49,57 +49,59 @@ public class AStrOperativeFirstRecord extends StrOperativeFirstRecordServiceImpl
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrOperativeFirstRecord strOperativeFirstRecord =new StrOperativeFirstRecord();
+            StrOperativeFirstRecord strOperativeFirstRecord = new StrOperativeFirstRecord();
             AStrOperativeFirstRecordVO strOperativeFirstRecordVO = (AStrOperativeFirstRecordVO) MapUtil.mapToObject(map, AStrOperativeFirstRecordVO.class);
-            BeanUtils.copyProperties(strOperativeFirstRecordVO,strOperativeFirstRecord);
-            strOperativeFirstRecord.setOperationDate(DateUtil.parseDate(strOperativeFirstRecordVO.getOperationDate(),"yyyy-MM-dd"));//手术时间
+            BeanUtils.copyProperties(strOperativeFirstRecordVO, strOperativeFirstRecord);
+            strOperativeFirstRecord.setOperationDate(DateUtil.parseDate(strOperativeFirstRecordVO.getOperationDate(), "yyyy-MM-dd"));//手术时间
 
-            if (null!=strOperativeFirstRecordVO.getStartTime()){
-                String date = strOperativeFirstRecordVO.getOperationDate()+" "+strOperativeFirstRecordVO.getStartTime();
-                strOperativeFirstRecord.setStartTime(DateUtil.parseDate(date,"yyyy-MM-dd HH:mm"));//开始时间
+            if (null != strOperativeFirstRecordVO.getStartTime()) {
+                String date = strOperativeFirstRecordVO.getOperationDate() + " " + strOperativeFirstRecordVO.getStartTime();
+                strOperativeFirstRecord.setStartTime(DateUtil.parseDate(date, "yyyy-MM-dd HH:mm"));//开始时间
             }
-            if (null!=strOperativeFirstRecordVO.getEndTime()){
-                if (strOperativeFirstRecordVO.getEndTime().length()>5){
+            if (null != strOperativeFirstRecordVO.getEndTime()) {
+                if (strOperativeFirstRecordVO.getEndTime().length() > 5) {
                     Calendar cal1 = Calendar.getInstance();
                     cal1.setTime(strOperativeFirstRecord.getOperationDate());
                     int year = cal1.get(Calendar.YEAR);
-                    String endDate= year+"-"+strOperativeFirstRecordVO.getEndTime();
-                    strOperativeFirstRecord.setEndTime(DateUtil.parseDate(endDate,"yyyy-MM-dd HH:mm"));//结束时间
-                }else {
-                    String endDate =strOperativeFirstRecordVO.getOperationDate()+" "+strOperativeFirstRecordVO.getEndTime();
-                    strOperativeFirstRecord.setEndTime(DateUtil.parseDate(endDate,"yyyy-MM-dd HH:mm"));//结束时间
+                    String endDate = year + "-" + strOperativeFirstRecordVO.getEndTime();
+                    strOperativeFirstRecord.setEndTime(DateUtil.parseDate(endDate, "yyyy-MM-dd HH:mm"));//结束时间
+                } else {
+                    String endDate = strOperativeFirstRecordVO.getOperationDate() + " " + strOperativeFirstRecordVO.getEndTime();
+                    strOperativeFirstRecord.setEndTime(DateUtil.parseDate(endDate, "yyyy-MM-dd HH:mm"));//结束时间
                 }
             }
 
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strOperativeFirstRecord);
+            BeanUtils.copyProperties(hisViewVos.get(0), strOperativeFirstRecord);
             strOperativeFirstRecord.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strOperativeFirstRecord);
         } catch (Exception e) {
@@ -108,28 +110,28 @@ public class AStrOperativeFirstRecord extends StrOperativeFirstRecordServiceImpl
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strOperativeFirstRecord");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strOperativeFirstRecord");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
     //术后首程
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrOperativeFirstRecord strOperativeFirstRecord=new StrOperativeFirstRecord();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrOperativeFirstRecord strOperativeFirstRecord = new StrOperativeFirstRecord();
         try {
-            AStrOperativeFirstRecordVO strOperativeFirstRecordVO=(AStrOperativeFirstRecordVO) MapUtil.mapToObject(entityMap, AStrOperativeFirstRecordVO.class);
-            BeanUtils.copyProperties(strOperativeFirstRecordVO,strOperativeFirstRecord);
+            AStrOperativeFirstRecordVO strOperativeFirstRecordVO = (AStrOperativeFirstRecordVO) MapUtil.mapToObject(entityMap, AStrOperativeFirstRecordVO.class);
+            BeanUtils.copyProperties(strOperativeFirstRecordVO, strOperativeFirstRecord);
             strOperativeFirstRecord.setHospitalId(hospitalId);//医院编码
 
             strOperativeFirstRecord.setAuditDate(DateUtil.parseDateTime(strOperativeFirstRecordVO.getAuditDate()));//审核时间
@@ -141,58 +143,61 @@ public class AStrOperativeFirstRecord extends StrOperativeFirstRecordServiceImpl
 
             strOperativeFirstRecord.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strOperativeFirstRecord)){
+            if (isExist(strOperativeFirstRecord)) {
                 strOperativeFirstRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(strOperativeFirstRecord);
-            }else{
+            } else {
                 strOperativeFirstRecord.setGmtModified(new Date());//记录修改时间
-                this.update(strOperativeFirstRecord,new QueryWrapper<StrOperativeFirstRecord>()
+                this.update(strOperativeFirstRecord, new QueryWrapper<StrOperativeFirstRecord>()
                         .eq("rec_id", strOperativeFirstRecord.getRecId())
                         .eq("hospital_id", strOperativeFirstRecord.getHospitalId())
                         .eq("behospital_code", strOperativeFirstRecord.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("术后首程",strOperativeFirstRecord.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("术后首程", strOperativeFirstRecord.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrOperativeFirstRecord medDeathNote){
+    public void dealData(StrOperativeFirstRecord medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("术后首程", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增术后首程");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrOperativeFirstRecord>()
+                this.update(medDeathNote, new QueryWrapper<StrOperativeFirstRecord>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("术后首程", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改术后首程");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("术后首程", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("术后首程", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "术后首程出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrOperativeFirstRecord strOperativeFirstRecord){
-        Boolean flag=true;
+    public Boolean isExist(StrOperativeFirstRecord strOperativeFirstRecord) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrOperativeFirstRecord>()
                 .eq("rec_id", strOperativeFirstRecord.getRecId())
                 .eq("hospital_id", strOperativeFirstRecord.getHospitalId())
                 .eq("behospital_code", strOperativeFirstRecord.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
+
     public RespDTO deleteFlag(ADeleteFlagVO aDeleteFlagVO) {
         try {
             //验证数据是否存在
@@ -221,30 +226,30 @@ public class AStrOperativeFirstRecord extends StrOperativeFirstRecordServiceImpl
         }
     }
 
-    public RespDTO execDealData(List<StrOperativeFirstRecordVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrOperativeFirstRecordVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrOperativeFirstRecordVO strOperativeFirstRecordVO:list) {
-                if("".equals(strOperativeFirstRecordVO.getRecId())) {
+            for (StrOperativeFirstRecordVO strOperativeFirstRecordVO : list) {
+                if ("".equals(strOperativeFirstRecordVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strOperativeFirstRecordVO.getHospitalId()==null){
+                } else if (strOperativeFirstRecordVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strOperativeFirstRecordVO.getBehospitalCode())){
+                } else if ("".equals(strOperativeFirstRecordVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrOperativeFirstRecord> strOperativeFirstRecordList= Lists.newArrayList();
-            strOperativeFirstRecordList= BeanUtil.listCopyTo(list,StrOperativeFirstRecord.class);
+            List<StrOperativeFirstRecord> strOperativeFirstRecordList = Lists.newArrayList();
+            strOperativeFirstRecordList = BeanUtil.listCopyTo(list, StrOperativeFirstRecord.class);
             execute(strOperativeFirstRecordList);
 
             return RespDTO.onSuc(strOperativeFirstRecordList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrOperativeFirstRecord> list){
+    public void execute(List<StrOperativeFirstRecord> list) {
         try {
             List<StrOperativeFirstRecord> addE = Lists.newLinkedList();
             List<StrOperativeFirstRecord> updateE = Lists.newLinkedList();
@@ -253,7 +258,7 @@ public class AStrOperativeFirstRecord extends StrOperativeFirstRecordServiceImpl
                     StrOperativeFirstRecord strOperativeFirstRecord = this.getOne(new QueryWrapper<StrOperativeFirstRecord>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strOperativeFirstRecord != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -263,15 +268,15 @@ public class AStrOperativeFirstRecord extends StrOperativeFirstRecordServiceImpl
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strOperativeFirstRecordService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术后首程","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术后首程", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 6 - 3
src/main/java/com/diagbot/facade/str/AStrOperativeNoteFacade.java

@@ -128,8 +128,8 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
                 if (is) {
                     System.out.println("有创保存---------------------");
                     aMedicalRecordFacade.executeByView(hisViewVos.get(0), "59");
-                    StrInvasiveOperativeNote strInvasiveOperativeNote =new StrInvasiveOperativeNote();
-                    BeanUtil.copyProperties(strOperativeNote,strInvasiveOperativeNote);
+                    StrInvasiveOperativeNote strInvasiveOperativeNote = new StrInvasiveOperativeNote();
+                    BeanUtil.copyProperties(strOperativeNote, strInvasiveOperativeNote);
                     System.out.println(JSON.toJSONString(strInvasiveOperativeNote));
                     aStrInvasiveOperativeNoteFacade.dealData(strInvasiveOperativeNote);
                 } else {
@@ -202,6 +202,8 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
             if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
+                aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增手术记录");
+
             } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
@@ -209,11 +211,12 @@ public class AStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改手术记录");
             }
 
         } catch (Exception e) {
             log.error(e.getMessage(), e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "手术记录出错" + e.getMessage());
         }
 
     }

+ 62 - 56
src/main/java/com/diagbot/facade/str/AStrPeriodConclusionFacade.java

@@ -50,37 +50,39 @@ public class AStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrPeriodConclusion strPeriodConclusion =new StrPeriodConclusion();
-            AStrPeriodConclusionVO  aStrPeriodConclusionVO = (AStrPeriodConclusionVO) MapUtil.mapToObject(map, AStrPeriodConclusionVO.class);
-            BeanUtils.copyProperties(aStrPeriodConclusionVO,strPeriodConclusion);
-            BeanUtils.copyProperties(hisViewVos.get(0),strPeriodConclusion);
+            StrPeriodConclusion strPeriodConclusion = new StrPeriodConclusion();
+            AStrPeriodConclusionVO aStrPeriodConclusionVO = (AStrPeriodConclusionVO) MapUtil.mapToObject(map, AStrPeriodConclusionVO.class);
+            BeanUtils.copyProperties(aStrPeriodConclusionVO, strPeriodConclusion);
+            BeanUtils.copyProperties(hisViewVos.get(0), strPeriodConclusion);
             strPeriodConclusion.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strPeriodConclusion);
         } catch (Exception e) {
@@ -89,27 +91,27 @@ public class AStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strPeriodConclusion");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strPeriodConclusion");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrPeriodConclusion strPeriodConclusion=new StrPeriodConclusion();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrPeriodConclusion strPeriodConclusion = new StrPeriodConclusion();
         try {
-            AStrPeriodConclusionVO strPeriodConclusionVO=(AStrPeriodConclusionVO) MapUtil.mapToObject(entityMap, AStrPeriodConclusionVO.class);
-            BeanUtils.copyProperties(strPeriodConclusionVO,strPeriodConclusion);
+            AStrPeriodConclusionVO strPeriodConclusionVO = (AStrPeriodConclusionVO) MapUtil.mapToObject(entityMap, AStrPeriodConclusionVO.class);
+            BeanUtils.copyProperties(strPeriodConclusionVO, strPeriodConclusion);
             strPeriodConclusion.setHospitalId(hospitalId);//医院编码
 
             strPeriodConclusion.setAuditDate(DateUtil.parseDateTime(strPeriodConclusionVO.getAuditDate()));//审核时间
@@ -118,55 +120,59 @@ public class AStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
 
             strPeriodConclusion.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strPeriodConclusion)){
+            if (isExist(strPeriodConclusion)) {
                 strPeriodConclusion.setGmtCreate(new Date());//记录创建时间
                 this.save(strPeriodConclusion);
-            }else{
+            } else {
                 strPeriodConclusion.setGmtModified(new Date());//记录修改时间
-                this.update(strPeriodConclusion,new QueryWrapper<StrPeriodConclusion>()
+                this.update(strPeriodConclusion, new QueryWrapper<StrPeriodConclusion>()
                         .eq("rec_id", strPeriodConclusion.getRecId())
                         .eq("hospital_id", strPeriodConclusion.getHospitalId())
                         .eq("behospital_code", strPeriodConclusion.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("阶段小结",strPeriodConclusion.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("阶段小结", strPeriodConclusion.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrPeriodConclusion medDeathNote){
+    public void dealData(StrPeriodConclusion medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("阶段小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增阶段小结");
+
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrPeriodConclusion>()
+                this.update(medDeathNote, new QueryWrapper<StrPeriodConclusion>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("阶段小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改阶段小结");
+
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("阶段小结", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("阶段小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "阶段小结出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrPeriodConclusion strPeriodConclusion){
-        Boolean flag=true;
+    public Boolean isExist(StrPeriodConclusion strPeriodConclusion) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrPeriodConclusion>()
                 .eq("rec_id", strPeriodConclusion.getRecId())
                 .eq("hospital_id", strPeriodConclusion.getHospitalId())
                 .eq("behospital_code", strPeriodConclusion.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -199,30 +205,30 @@ public class AStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
         }
     }
 
-    public RespDTO execDealData(List<StrPeriodConclusionVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrPeriodConclusionVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrPeriodConclusionVO strPeriodConclusionVO:list) {
-                if("".equals(strPeriodConclusionVO.getRecId())) {
+            for (StrPeriodConclusionVO strPeriodConclusionVO : list) {
+                if ("".equals(strPeriodConclusionVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strPeriodConclusionVO.getHospitalId()==null){
+                } else if (strPeriodConclusionVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strPeriodConclusionVO.getBehospitalCode())){
+                } else if ("".equals(strPeriodConclusionVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrPeriodConclusion> strPeriodConclusionList= Lists.newArrayList();
-            strPeriodConclusionList= BeanUtil.listCopyTo(list,StrPeriodConclusion.class);
+            List<StrPeriodConclusion> strPeriodConclusionList = Lists.newArrayList();
+            strPeriodConclusionList = BeanUtil.listCopyTo(list, StrPeriodConclusion.class);
             execute(strPeriodConclusionList);
 
             return RespDTO.onSuc(strPeriodConclusionList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrPeriodConclusion> list){
+    public void execute(List<StrPeriodConclusion> list) {
         try {
             List<StrPeriodConclusion> addE = Lists.newLinkedList();
             List<StrPeriodConclusion> updateE = Lists.newLinkedList();
@@ -231,7 +237,7 @@ public class AStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
                     StrPeriodConclusion strPeriodConclusion = this.getOne(new QueryWrapper<StrPeriodConclusion>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strPeriodConclusion != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -241,15 +247,15 @@ public class AStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strPeriodConclusionService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-阶段小结","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-阶段小结", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 

+ 61 - 57
src/main/java/com/diagbot/facade/str/AStrPreoperativeDiscussionFacade.java

@@ -52,41 +52,43 @@ public class AStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionS
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrPreoperativeDiscussion strPreoperativeDiscussion =new StrPreoperativeDiscussion();
+            StrPreoperativeDiscussion strPreoperativeDiscussion = new StrPreoperativeDiscussion();
             AStrPreoperativeDiscussionVO strPreoperativeDiscussionVo = (AStrPreoperativeDiscussionVO) MapUtil.mapToObject(map, AStrPreoperativeDiscussionVO.class);
-            BeanUtils.copyProperties(strPreoperativeDiscussionVo,strPreoperativeDiscussion);
+            BeanUtils.copyProperties(strPreoperativeDiscussionVo, strPreoperativeDiscussion);
 
-            strPreoperativeDiscussion.setAuditDate(DateUtil.parseDate(strPreoperativeDiscussionVo.getAuditDate(),"yyyy-MM-dd HH:mm"));//开始时间
-            strPreoperativeDiscussion.setDiscussTime(DateUtil.parseDate(strPreoperativeDiscussionVo.getDiscussTime(),"yyyy-MM-dd HH:mm"));
+            strPreoperativeDiscussion.setAuditDate(DateUtil.parseDate(strPreoperativeDiscussionVo.getAuditDate(), "yyyy-MM-dd HH:mm"));//开始时间
+            strPreoperativeDiscussion.setDiscussTime(DateUtil.parseDate(strPreoperativeDiscussionVo.getDiscussTime(), "yyyy-MM-dd HH:mm"));
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strPreoperativeDiscussion);
+            BeanUtils.copyProperties(hisViewVos.get(0), strPreoperativeDiscussion);
             strPreoperativeDiscussion.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strPreoperativeDiscussion);
         } catch (Exception e) {
@@ -95,28 +97,28 @@ public class AStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionS
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strPreoperativeDiscussion");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strPreoperativeDiscussion");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
     //入院记录
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrPreoperativeDiscussion strPreoperativeDiscussion=new StrPreoperativeDiscussion();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrPreoperativeDiscussion strPreoperativeDiscussion = new StrPreoperativeDiscussion();
         try {
-            AStrPreoperativeDiscussionVO strPreoperativeDiscussionVO=(AStrPreoperativeDiscussionVO) MapUtil.mapToObject(entityMap, AStrPreoperativeDiscussionVO.class);
-            BeanUtils.copyProperties(strPreoperativeDiscussionVO,strPreoperativeDiscussion);
+            AStrPreoperativeDiscussionVO strPreoperativeDiscussionVO = (AStrPreoperativeDiscussionVO) MapUtil.mapToObject(entityMap, AStrPreoperativeDiscussionVO.class);
+            BeanUtils.copyProperties(strPreoperativeDiscussionVO, strPreoperativeDiscussion);
             strPreoperativeDiscussion.setHospitalId(hospitalId);//医院编码
 
             strPreoperativeDiscussion.setAuditDate(DateUtil.parseDateTime(strPreoperativeDiscussionVO.getAuditDate()));//审核时间
@@ -126,55 +128,57 @@ public class AStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionS
 
             strPreoperativeDiscussion.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strPreoperativeDiscussion)){
+            if (isExist(strPreoperativeDiscussion)) {
                 strPreoperativeDiscussion.setGmtCreate(new Date());//记录创建时间
                 this.save(strPreoperativeDiscussion);
-            }else{
+            } else {
                 strPreoperativeDiscussion.setGmtModified(new Date());//记录修改时间
-                this.update(strPreoperativeDiscussion,new QueryWrapper<StrPreoperativeDiscussion>()
+                this.update(strPreoperativeDiscussion, new QueryWrapper<StrPreoperativeDiscussion>()
                         .eq("rec_id", strPreoperativeDiscussion.getRecId())
                         .eq("hospital_id", strPreoperativeDiscussion.getHospitalId())
                         .eq("behospital_code", strPreoperativeDiscussion.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("术前讨论小结",strPreoperativeDiscussion.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("术前讨论小结", strPreoperativeDiscussion.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrPreoperativeDiscussion medDeathNote){
+    public void dealData(StrPreoperativeDiscussion medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("术前讨论小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增术前讨论小结");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrPreoperativeDiscussion>()
+                this.update(medDeathNote, new QueryWrapper<StrPreoperativeDiscussion>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("术前讨论小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改术前讨论小结");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("术前讨论小结", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("术前讨论小结", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "术前讨论小结出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrPreoperativeDiscussion strPreoperativeDiscussion){
-        Boolean flag=true;
+    public Boolean isExist(StrPreoperativeDiscussion strPreoperativeDiscussion) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrPreoperativeDiscussion>()
                 .eq("rec_id", strPreoperativeDiscussion.getRecId())
                 .eq("hospital_id", strPreoperativeDiscussion.getHospitalId())
                 .eq("behospital_code", strPreoperativeDiscussion.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -207,30 +211,30 @@ public class AStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionS
         }
     }
 
-    public RespDTO execDealData(List<StrPreoperativeDiscussionVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrPreoperativeDiscussionVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrPreoperativeDiscussionVO strPreoperativeDiscussionVO:list) {
-                if("".equals(strPreoperativeDiscussionVO.getRecId())) {
+            for (StrPreoperativeDiscussionVO strPreoperativeDiscussionVO : list) {
+                if ("".equals(strPreoperativeDiscussionVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strPreoperativeDiscussionVO.getHospitalId()==null){
+                } else if (strPreoperativeDiscussionVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strPreoperativeDiscussionVO.getBehospitalCode())){
+                } else if ("".equals(strPreoperativeDiscussionVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrPreoperativeDiscussion> strPreoperativeDiscussionList= Lists.newArrayList();
-            strPreoperativeDiscussionList= BeanUtil.listCopyTo(list,StrPreoperativeDiscussion.class);
+            List<StrPreoperativeDiscussion> strPreoperativeDiscussionList = Lists.newArrayList();
+            strPreoperativeDiscussionList = BeanUtil.listCopyTo(list, StrPreoperativeDiscussion.class);
             execute(strPreoperativeDiscussionList);
 
             return RespDTO.onSuc(strPreoperativeDiscussionList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrPreoperativeDiscussion> list){
+    public void execute(List<StrPreoperativeDiscussion> list) {
         try {
             List<StrPreoperativeDiscussion> addE = Lists.newLinkedList();
             List<StrPreoperativeDiscussion> updateE = Lists.newLinkedList();
@@ -239,7 +243,7 @@ public class AStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionS
                     StrPreoperativeDiscussion strPreoperativeDiscussion = this.getOne(new QueryWrapper<StrPreoperativeDiscussion>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strPreoperativeDiscussion != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -249,15 +253,15 @@ public class AStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionS
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strPreoperativeDiscussionService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术前讨论小结","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术前讨论小结", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 62 - 57
src/main/java/com/diagbot/facade/str/AStrRescueNoteFacade.java

@@ -53,41 +53,43 @@ public class AStrRescueNoteFacade extends StrRescueNoteServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
 
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrRescueNote strRescueNote =new StrRescueNote();
+            StrRescueNote strRescueNote = new StrRescueNote();
             AStrRescueNoteVO strRescueNoteVo = (AStrRescueNoteVO) MapUtil.mapToObject(map, AStrRescueNoteVO.class);
-            BeanUtils.copyProperties(strRescueNoteVo,strRescueNote);
+            BeanUtils.copyProperties(strRescueNoteVo, strRescueNote);
 
-            strRescueNote.setStartTime(DateUtil.parseDate(strRescueNoteVo.getStartTime(),"yyyy-MM-dd HH:mm"));//结束时间
-            strRescueNote.setEndTime(DateUtil.parseDate(strRescueNoteVo.getEndTime(),"yyyy-MM-dd HH:mm"));//结束时间
+            strRescueNote.setStartTime(DateUtil.parseDate(strRescueNoteVo.getStartTime(), "yyyy-MM-dd HH:mm"));//结束时间
+            strRescueNote.setEndTime(DateUtil.parseDate(strRescueNoteVo.getEndTime(), "yyyy-MM-dd HH:mm"));//结束时间
 
-            BeanUtils.copyProperties(hisViewVos.get(0),strRescueNote);
+            BeanUtils.copyProperties(hisViewVos.get(0), strRescueNote);
             strRescueNote.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strRescueNote);
         } catch (Exception e) {
@@ -96,27 +98,27 @@ public class AStrRescueNoteFacade extends StrRescueNoteServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strRescueNote");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strRescueNote");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrRescueNote strRescueNote=new StrRescueNote();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrRescueNote strRescueNote = new StrRescueNote();
         try {
-            AStrRescueNoteVO strRescueNoteVO=(AStrRescueNoteVO) MapUtil.mapToObject(entityMap, AStrRescueNoteVO.class);
-            BeanUtils.copyProperties(strRescueNoteVO,strRescueNote);
+            AStrRescueNoteVO strRescueNoteVO = (AStrRescueNoteVO) MapUtil.mapToObject(entityMap, AStrRescueNoteVO.class);
+            BeanUtils.copyProperties(strRescueNoteVO, strRescueNote);
             strRescueNote.setHospitalId(hospitalId);//医院编码
 
             strRescueNote.setAuditDate(DateUtil.parseDateTime(strRescueNoteVO.getAuditDate()));//审核时间
@@ -127,83 +129,86 @@ public class AStrRescueNoteFacade extends StrRescueNoteServiceImpl {
 
             strRescueNote.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strRescueNote)){
+            if (isExist(strRescueNote)) {
                 strRescueNote.setGmtCreate(new Date());//记录创建时间
                 this.save(strRescueNote);
-            }else{
+            } else {
                 strRescueNote.setGmtModified(new Date());//记录修改时间
-                this.update(strRescueNote,new QueryWrapper<StrRescueNote>()
+                this.update(strRescueNote, new QueryWrapper<StrRescueNote>()
                         .eq("rec_id", strRescueNote.getRecId())
                         .eq("hospital_id", strRescueNote.getHospitalId())
                         .eq("behospital_code", strRescueNote.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("抢救记录", strRescueNote.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("抢救记录", strRescueNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrRescueNote medDeathNote){
+    public void dealData(StrRescueNote medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("抢救记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增抢救记录");
+
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrRescueNote>()
+                this.update(medDeathNote, new QueryWrapper<StrRescueNote>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("抢救记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改抢救记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("抢救记录", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("抢救记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "抢救记录出错:" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrRescueNote strRescueNote){
-        Boolean flag=true;
+    public Boolean isExist(StrRescueNote strRescueNote) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrRescueNote>()
                 .eq("rec_id", strRescueNote.getRecId())
                 .eq("hospital_id", strRescueNote.getHospitalId())
                 .eq("behospital_code", strRescueNote.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
 
-    public RespDTO execDealData(List<StrRescueNoteVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrRescueNoteVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrRescueNoteVO strRescueNoteVO:list) {
-                if("".equals(strRescueNoteVO.getRecId())) {
+            for (StrRescueNoteVO strRescueNoteVO : list) {
+                if ("".equals(strRescueNoteVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strRescueNoteVO.getHospitalId()==null){
+                } else if (strRescueNoteVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strRescueNoteVO.getBehospitalCode())){
+                } else if ("".equals(strRescueNoteVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrRescueNote> strRescueNoteList= Lists.newArrayList();
-            strRescueNoteList= BeanUtil.listCopyTo(list,StrRescueNote.class);
+            List<StrRescueNote> strRescueNoteList = Lists.newArrayList();
+            strRescueNoteList = BeanUtil.listCopyTo(list, StrRescueNote.class);
             execute(strRescueNoteList);
 
             return RespDTO.onSuc(strRescueNoteList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrRescueNote> list){
+    public void execute(List<StrRescueNote> list) {
         try {
             List<StrRescueNote> addE = Lists.newLinkedList();
             List<StrRescueNote> updateE = Lists.newLinkedList();
@@ -212,7 +217,7 @@ public class AStrRescueNoteFacade extends StrRescueNoteServiceImpl {
                     StrRescueNote strRescueNote = this.getOne(new QueryWrapper<StrRescueNote>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strRescueNote != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -222,15 +227,15 @@ public class AStrRescueNoteFacade extends StrRescueNoteServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strRescueNoteService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-抢救记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-抢救记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 

+ 60 - 55
src/main/java/com/diagbot/facade/str/AStrTransferInNoteFacade.java

@@ -53,39 +53,41 @@ public class AStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
 
-            StrTransferInNote strTransferInNote =new StrTransferInNote();
+            StrTransferInNote strTransferInNote = new StrTransferInNote();
             AStrTransferInNoteVO aStrTransferInNoteVO = (AStrTransferInNoteVO) MapUtil.mapToObject(map, AStrTransferInNoteVO.class);
-            BeanUtils.copyProperties(aStrTransferInNoteVO,strTransferInNote);
-            BeanUtils.copyProperties(hisViewVos.get(0),strTransferInNote);
+            BeanUtils.copyProperties(aStrTransferInNoteVO, strTransferInNote);
+            BeanUtils.copyProperties(hisViewVos.get(0), strTransferInNote);
             strTransferInNote.setWholeData(JSON.toJSONString(wholeData));
 
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strTransferInNote);
         } catch (Exception e) {
@@ -93,27 +95,28 @@ public class AStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
             aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录多变一", hisViewVos.get(0).getRecId(), JSON.toJSONString(hisViewVos), "", e.getMessage());
         }
     }
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strTransferInNote");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strTransferInNote");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrTransferInNote strTransferInNote=new StrTransferInNote();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrTransferInNote strTransferInNote = new StrTransferInNote();
         try {
-            AStrTransferInNoteVO strTransferInNoteVO=(AStrTransferInNoteVO) MapUtil.mapToObject(entityMap, AStrTransferInNoteVO.class);
-            BeanUtils.copyProperties(strTransferInNoteVO,strTransferInNote);
+            AStrTransferInNoteVO strTransferInNoteVO = (AStrTransferInNoteVO) MapUtil.mapToObject(entityMap, AStrTransferInNoteVO.class);
+            BeanUtils.copyProperties(strTransferInNoteVO, strTransferInNote);
             strTransferInNote.setHospitalId(hospitalId);//医院编码
             strTransferInNote.setTransferInDate(DateUtil.parseDateTime(strTransferInNoteVO.getTransferInDate()));
             strTransferInNote.setAuditDate(DateUtil.parseDateTime(strTransferInNoteVO.getAuditDate()));//审核时间
@@ -122,55 +125,57 @@ public class AStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
 
             strTransferInNote.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strTransferInNote)){
+            if (isExist(strTransferInNote)) {
                 strTransferInNote.setGmtCreate(new Date());//记录创建时间
                 this.save(strTransferInNote);
-            }else{
+            } else {
                 strTransferInNote.setGmtModified(new Date());//记录修改时间
-                this.update(strTransferInNote,new QueryWrapper<StrTransferInNote>()
+                this.update(strTransferInNote, new QueryWrapper<StrTransferInNote>()
                         .eq("rec_id", strTransferInNote.getRecId())
                         .eq("hospital_id", strTransferInNote.getHospitalId())
                         .eq("behospital_code", strTransferInNote.getBehospitalCode()));
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录",strTransferInNote.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录", strTransferInNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-    public void dealData(StrTransferInNote medDeathNote){
+    public void dealData(StrTransferInNote medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增转入记录");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrTransferInNote>()
+                this.update(medDeathNote, new QueryWrapper<StrTransferInNote>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改转入记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("转入记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "转入记录出错" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrTransferInNote strTransferInNote){
-        Boolean flag=true;
+    public Boolean isExist(StrTransferInNote strTransferInNote) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrTransferInNote>()
                 .eq("rec_id", strTransferInNote.getRecId())
                 .eq("hospital_id", strTransferInNote.getHospitalId())
                 .eq("behospital_code", strTransferInNote.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -203,30 +208,30 @@ public class AStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
         }
     }
 
-    public RespDTO execDealData(List<StrTransferInNoteVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrTransferInNoteVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrTransferInNoteVO strTransferInNoteVO:list) {
-                if("".equals(strTransferInNoteVO.getRecId())) {
+            for (StrTransferInNoteVO strTransferInNoteVO : list) {
+                if ("".equals(strTransferInNoteVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strTransferInNoteVO.getHospitalId()==null){
+                } else if (strTransferInNoteVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strTransferInNoteVO.getBehospitalCode())){
+                } else if ("".equals(strTransferInNoteVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrTransferInNote> strTransferInNoteList= Lists.newArrayList();
-            strTransferInNoteList= BeanUtil.listCopyTo(list,StrTransferInNote.class);
+            List<StrTransferInNote> strTransferInNoteList = Lists.newArrayList();
+            strTransferInNoteList = BeanUtil.listCopyTo(list, StrTransferInNote.class);
             execute(strTransferInNoteList);
 
             return RespDTO.onSuc(strTransferInNoteList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrTransferInNote> list){
+    public void execute(List<StrTransferInNote> list) {
         try {
             List<StrTransferInNote> addE = Lists.newLinkedList();
             List<StrTransferInNote> updateE = Lists.newLinkedList();
@@ -235,7 +240,7 @@ public class AStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
                     StrTransferInNote strTransferInNote = this.getOne(new QueryWrapper<StrTransferInNote>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strTransferInNote != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -245,15 +250,15 @@ public class AStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strTransferInNoteService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转入记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转入记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 

+ 61 - 56
src/main/java/com/diagbot/facade/str/AStrTransferOutNoteFacade.java

@@ -53,37 +53,39 @@ public class AStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
     private AMedicalRecordContentFacade aMedicalRecordContentFacade;
     @Autowired
     private AMedicalRecordFacade aMedicalRecordFacade;
+
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrTransferOutNote strTransferOutNote =new StrTransferOutNote();
-            AStrTransferOutNoteVO  aStrTransferOutNoteVO = (AStrTransferOutNoteVO) MapUtil.mapToObject(map, AStrTransferOutNoteVO.class);
-            BeanUtils.copyProperties(aStrTransferOutNoteVO,strTransferOutNote);
-            BeanUtils.copyProperties(hisViewVos.get(0),strTransferOutNote);
+            StrTransferOutNote strTransferOutNote = new StrTransferOutNote();
+            AStrTransferOutNoteVO aStrTransferOutNoteVO = (AStrTransferOutNoteVO) MapUtil.mapToObject(map, AStrTransferOutNoteVO.class);
+            BeanUtils.copyProperties(aStrTransferOutNoteVO, strTransferOutNote);
+            BeanUtils.copyProperties(hisViewVos.get(0), strTransferOutNote);
             strTransferOutNote.setWholeData(JSON.toJSONString(wholeData));
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
             this.dealData(strTransferOutNote);
         } catch (Exception e) {
@@ -91,26 +93,27 @@ public class AStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
             aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录多变一", hisViewVos.get(0).getRecId(), JSON.toJSONString(hisViewVos), "", e.getMessage());
         }
     }
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strTransferOutNote");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strTransferOutNote");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrTransferOutNote strTransferOutNote=new StrTransferOutNote();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrTransferOutNote strTransferOutNote = new StrTransferOutNote();
         try {
-            AStrTransferOutNoteVO strTransferOutNoteVO=(AStrTransferOutNoteVO) MapUtil.mapToObject(entityMap, AStrTransferOutNoteVO.class);
-            BeanUtils.copyProperties(strTransferOutNoteVO,strTransferOutNote);
+            AStrTransferOutNoteVO strTransferOutNoteVO = (AStrTransferOutNoteVO) MapUtil.mapToObject(entityMap, AStrTransferOutNoteVO.class);
+            BeanUtils.copyProperties(strTransferOutNoteVO, strTransferOutNote);
             strTransferOutNote.setHospitalId(hospitalId);//医院编码
             strTransferOutNote.setTransferInDate(DateUtil.parseDateTime(strTransferOutNoteVO.getTransferInDate()));
             strTransferOutNote.setAuditDate(DateUtil.parseDateTime(strTransferOutNoteVO.getAuditDate()));//审核时间
@@ -119,54 +122,56 @@ public class AStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
 
             strTransferOutNote.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strTransferOutNote)){
+            if (isExist(strTransferOutNote)) {
                 strTransferOutNote.setGmtCreate(new Date());//记录创建时间
                 this.save(strTransferOutNote);
-            }else{
+            } else {
                 strTransferOutNote.setGmtModified(new Date());//记录修改时间
-                this.update(strTransferOutNote,new QueryWrapper<StrTransferOutNote>()
+                this.update(strTransferOutNote, new QueryWrapper<StrTransferOutNote>()
                         .eq("rec_id", strTransferOutNote.getRecId())
                         .eq("hospital_id", strTransferOutNote.getHospitalId())
                         .eq("behospital_code", strTransferOutNote.getBehospitalCode()));
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录",strTransferOutNote.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录", strTransferOutNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
         }
 
     }
 
-     public void dealData(StrTransferOutNote medDeathNote){
+    public void dealData(StrTransferOutNote medDeathNote) {
 
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medDeathNote)){
+            if (isExist(medDeathNote)) {
                 medDeathNote.setGmtCreate(new Date());//记录创建时间
                 this.save(medDeathNote);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "新增转出记录");
+            } else {
                 medDeathNote.setGmtModified(new Date());//记录修改时间
                 medDeathNote.setIsDeleted("N");
-                this.update(medDeathNote,new QueryWrapper<StrTransferOutNote>()
+                this.update(medDeathNote, new QueryWrapper<StrTransferOutNote>()
                         .eq("rec_id", medDeathNote.getRecId())
                         .eq("hospital_id", medDeathNote.getHospitalId())
                         .eq("behospital_code", medDeathNote.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "修改转出记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录", medDeathNote.getRecId(),JSON.toJSONString(medDeathNote),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("转出记录", medDeathNote.getRecId(), JSON.toJSONString(medDeathNote), "", "转出记录出错" + e.getMessage());
         }
 
     }
 
-    public Boolean isExist(StrTransferOutNote strTransferOutNote){
-        Boolean flag=true;
+    public Boolean isExist(StrTransferOutNote strTransferOutNote) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrTransferOutNote>()
                 .eq("rec_id", strTransferOutNote.getRecId())
                 .eq("hospital_id", strTransferOutNote.getHospitalId())
                 .eq("behospital_code", strTransferOutNote.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -199,30 +204,30 @@ public class AStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
         }
     }
 
-    public RespDTO execDealData(List<StrTransferOutNoteVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrTransferOutNoteVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrTransferOutNoteVO strTransferOutNoteVO:list) {
-                if("".equals(strTransferOutNoteVO.getRecId())) {
+            for (StrTransferOutNoteVO strTransferOutNoteVO : list) {
+                if ("".equals(strTransferOutNoteVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strTransferOutNoteVO.getHospitalId()==null){
+                } else if (strTransferOutNoteVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strTransferOutNoteVO.getBehospitalCode())){
+                } else if ("".equals(strTransferOutNoteVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrTransferOutNote> strTransferOutNoteList= Lists.newArrayList();
-            strTransferOutNoteList= BeanUtil.listCopyTo(list,StrTransferOutNote.class);
+            List<StrTransferOutNote> strTransferOutNoteList = Lists.newArrayList();
+            strTransferOutNoteList = BeanUtil.listCopyTo(list, StrTransferOutNote.class);
             execute(strTransferOutNoteList);
 
             return RespDTO.onSuc(strTransferOutNoteList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrTransferOutNote> list){
+    public void execute(List<StrTransferOutNote> list) {
         try {
             List<StrTransferOutNote> addE = Lists.newLinkedList();
             List<StrTransferOutNote> updateE = Lists.newLinkedList();
@@ -231,7 +236,7 @@ public class AStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
                     StrTransferOutNote strTransferOutNote = this.getOne(new QueryWrapper<StrTransferOutNote>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strTransferOutNote != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -241,15 +246,15 @@ public class AStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strTransferOutNoteService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转出记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转出记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 67 - 62
src/main/java/com/diagbot/facade/str/AStrWardRecordFacade.java

@@ -54,34 +54,34 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
 
     /**
      * 把得到的list变成一个对象
+     *
      * @param
      */
-    public  void getOneList(List<HisViewVo> hisViewVos,String modeId) {
+    public void getOneList(List<HisViewVo> hisViewVos, String modeId) {
         try {
-            Map<String,Object> map =new HashMap<>();
-            Map<String,Object> wholeData =new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
+            Map<String, Object> wholeData = new HashMap<>();
             String modelName = ModeIdEnum.getName(Integer.parseInt(modeId));
-            Map<String,String> tableKey=columnFacade.getColumn(CacheKeyEnum.getName(modelName));
+            Map<String, String> tableKey = columnFacade.getColumn(CacheKeyEnum.getName(modelName));
 
             //循环list根据咱字段的名称来跟得到的数据来做比较
-            for (HisViewVo s: hisViewVos) {
-                if (s.getKeyEn()!=null) {
+            for (HisViewVo s : hisViewVos) {
+                if (s.getKeyEn() != null) {
                     tableKey.forEach((k, v) -> {
                         if (s.getKeyEn().equals(v)) {
                             map.put(s.getKeyEn(), s.getDeValue());
                             wholeData.put(k, s.getDeValue());
                         }
                     });
-                }else {
-                    wholeData.put(s.getKeyCN(),s.getDeValue());
+                } else {
+                    wholeData.put(s.getKeyCN(), s.getDeValue());
                 }
             }
-            StrWardRecord strWardRecord =new StrWardRecord();
+            StrWardRecord strWardRecord = new StrWardRecord();
             AStrWardRecordVO strWardRecordVO = (AStrWardRecordVO) MapUtil.mapToObject(map, AStrWardRecordVO.class);
-            BeanUtils.copyProperties(strWardRecordVO,strWardRecord);
+            BeanUtils.copyProperties(strWardRecordVO, strWardRecord);
             strWardRecord.setWholeData(JSON.toJSONString(wholeData));
-            BeanUtils.copyProperties(hisViewVos.get(0),strWardRecord);
-
+            BeanUtils.copyProperties(hisViewVos.get(0), strWardRecord);
 
 
             strWardRecord.setAuditDate(DateUtil.parseDateTime(strWardRecordVO.getAuditDate()));//审核时间
@@ -90,8 +90,7 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
             strWardRecord.setRecDate(DateUtil.parseDate(strWardRecordVO.getRecDate()));//病例时间
 
             aMedicalRecordContentFacade.executeByView(hisViewVos.get(0));
-            aMedicalRecordFacade.executeByView(hisViewVos.get(0),modeId);
-
+            aMedicalRecordFacade.executeByView(hisViewVos.get(0), modeId);
 
 
             this.dealData(strWardRecord);
@@ -103,28 +102,28 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
         }
     }
 
-    public void getColumnZhAndCh(){
-        List<ColumnZhAndChDTO> list=this.baseMapper.getColumnZhAndCh();
-        list.forEach(s->{
+    public void getColumnZhAndCh() {
+        List<ColumnZhAndChDTO> list = this.baseMapper.getColumnZhAndCh();
+        list.forEach(s -> {
             s.setEn(NamingStrategy.underlineToCamel(s.getEn()));
         });
 
-        Map<String, String> columnMap= EntityUtil.makeMapWithKeyValue(list,"ch","en");
-        Boolean flag=columnFacade.createColumn(columnMap,"strWardRecord");
+        Map<String, String> columnMap = EntityUtil.makeMapWithKeyValue(list, "ch", "en");
+        Boolean flag = columnFacade.createColumn(columnMap, "strWardRecord");
 
         //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
-        if(!flag){
+        if (!flag) {
             return;
         }
     }
 
 
     //查房记录
-    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
-        StrWardRecord strWardRecord=new StrWardRecord();
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrWardRecord strWardRecord = new StrWardRecord();
         try {
-            AStrWardRecordVO strWardRecordVO=(AStrWardRecordVO) MapUtil.mapToObject(entityMap, AStrWardRecordVO.class);
-            BeanUtils.copyProperties(strWardRecordVO,strWardRecord);
+            AStrWardRecordVO strWardRecordVO = (AStrWardRecordVO) MapUtil.mapToObject(entityMap, AStrWardRecordVO.class);
+            BeanUtils.copyProperties(strWardRecordVO, strWardRecord);
             strWardRecord.setHospitalId(hospitalId);//医院编码
 
             strWardRecord.setAuditDate(DateUtil.parseDateTime(strWardRecordVO.getAuditDate()));//审核时间
@@ -134,55 +133,61 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
 
             strWardRecord.setWholeData(columnMap);
             //判断数据库中是否存在,不存在insert
-            if(isExist(strWardRecord)){
+            if (isExist(strWardRecord)) {
                 strWardRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(strWardRecord);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", strWardRecord.getRecId(), JSON.toJSONString(entityMap), "", "新增查房记录");
+            } else {
                 strWardRecord.setGmtModified(new Date());//记录修改时间
-                this.update(strWardRecord,new QueryWrapper<StrWardRecord>()
+                this.update(strWardRecord, new QueryWrapper<StrWardRecord>()
                         .eq("rec_id", strWardRecord.getRecId())
                         .eq("hospital_id", strWardRecord.getHospitalId())
                         .eq("behospital_code", strWardRecord.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", strWardRecord.getRecId(), JSON.toJSONString(entityMap), "", "修改查房记录");
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", strWardRecord.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", strWardRecord.getRecId(), JSON.toJSONString(entityMap), "", "查房记录出错:" + e.getMessage());
         }
 
     }
 
-    public void dealData(StrWardRecord medWardRecord){
+    public void dealData(StrWardRecord medWardRecord) {
         try {
             //判断数据库中是否存在,不存在insert
-            if(isExist(medWardRecord)){
+            if (isExist(medWardRecord)) {
                 medWardRecord.setGmtCreate(new Date());//记录创建时间
                 this.save(medWardRecord);
-            }else{
+                aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", medWardRecord.getRecId(), JSON.toJSONString(medWardRecord), "", "新增查房记录");
+
+            } else {
                 medWardRecord.setGmtModified(new Date());//记录修改时间
                 medWardRecord.setIsDeleted("N");
-                this.update(medWardRecord,new QueryWrapper<StrWardRecord>()
+                this.update(medWardRecord, new QueryWrapper<StrWardRecord>()
                         .eq("rec_id", medWardRecord.getRecId())
                         .eq("hospital_id", medWardRecord.getHospitalId())
                         .eq("behospital_code", medWardRecord.getBehospitalCode()));
+                aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", medWardRecord.getRecId(), JSON.toJSONString(medWardRecord), "", "修改查房记录");
+
             }
 
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", medWardRecord.getRecId(),JSON.toJSONString(medWardRecord),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", medWardRecord.getRecId(), JSON.toJSONString(medWardRecord), "", "查房记录出错:" + e.getMessage());
         }
 
     }
 
 
-    public Boolean isExist(StrWardRecord strWardRecord){
-        Boolean flag=true;
+    public Boolean isExist(StrWardRecord strWardRecord) {
+        Boolean flag = true;
         int count = this.baseMapper.selectCount(new QueryWrapper<StrWardRecord>()
                 .eq("rec_id", strWardRecord.getRecId())
                 .eq("hospital_id", strWardRecord.getHospitalId())
                 .eq("behospital_code", strWardRecord.getBehospitalCode()));
-        if(count>0){
-            flag=false;
+        if (count > 0) {
+            flag = false;
         }
         return flag;
     }
@@ -215,44 +220,44 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
         }
     }
 
-    private  Map<String,Object> objectToMap(Object o) throws IllegalAccessException {
-        if(null == o){
+    private Map<String, Object> objectToMap(Object o) throws IllegalAccessException {
+        if (null == o) {
             return null;
         }
-        Map<String,Object> map = new HashMap<>();
+        Map<String, Object> map = new HashMap<>();
         Field[] declaredFields = o.getClass().getDeclaredFields();
-        for (Field field :declaredFields) {
+        for (Field field : declaredFields) {
             // (此处如果不设置 无法获取对象的私有属性)
             field.setAccessible(true);
-            map.put(field.getName(),field.get(o));
+            map.put(field.getName(), field.get(o));
         }
         return map;
     }
 
-    public RespDTO execDealData(List<StrWardRecordVO> list){
-        if(list!=null && list.size()>0){
+    public RespDTO execDealData(List<StrWardRecordVO> list) {
+        if (list != null && list.size() > 0) {
             //循环验证数据有效性
-            for (StrWardRecordVO strWardRecordVO:list) {
-                if("".equals(strWardRecordVO.getRecId())) {
+            for (StrWardRecordVO strWardRecordVO : list) {
+                if ("".equals(strWardRecordVO.getRecId())) {
                     return RespDTO.onError("请输入记录编号!");
-                }else if(strWardRecordVO.getHospitalId()==null){
+                } else if (strWardRecordVO.getHospitalId() == null) {
                     return RespDTO.onError("请输入医院编码!");
-                }else if("".equals(strWardRecordVO.getBehospitalCode())){
+                } else if ("".equals(strWardRecordVO.getBehospitalCode())) {
                     return RespDTO.onError("请输入病人住院编码!");
                 }
             }
             //初始、格式化数据
-            List<StrWardRecord> strWardRecordList= Lists.newArrayList();
-            strWardRecordList= BeanUtil.listCopyTo(list,StrWardRecord.class);
+            List<StrWardRecord> strWardRecordList = Lists.newArrayList();
+            strWardRecordList = BeanUtil.listCopyTo(list, StrWardRecord.class);
             execute(strWardRecordList);
 
             return RespDTO.onSuc(strWardRecordList);
-        }else{
+        } else {
             return RespDTO.onError("未接收到数据!");
         }
     }
 
-    public void execute(List<StrWardRecord> list){
+    public void execute(List<StrWardRecord> list) {
         try {
             List<StrWardRecord> addE = Lists.newLinkedList();
             List<StrWardRecord> updateE = Lists.newLinkedList();
@@ -261,7 +266,7 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
                     StrWardRecord strWardRecord = this.getOne(new QueryWrapper<StrWardRecord>()
                             .eq("rec_id", s.getRecId())
                             .eq("hospital_id", s.getHospitalId())
-                            .eq("behospital_code",s.getBehospitalCode()), false);
+                            .eq("behospital_code", s.getBehospitalCode()), false);
                     if (strWardRecord != null) {
                         s.setGmtModified(new Date());
                         updateE.add(s);
@@ -271,15 +276,15 @@ public class AStrWardRecordFacade extends StrWardRecordServiceImpl {
                     }
                 });
             }
-            if(addE.size()>0){
+            if (addE.size() > 0) {
                 strWardRecordService.saveBatch(addE);
             }
-            if(updateE.size()>0){
+            if (updateE.size() > 0) {
                 this.baseMapper.updateBatchByKey(updateE);
             }
-        }catch (Exception e){
-            log.error(e.getMessage(),e);
-            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-查房记录","", JSON.toJSONString(list),"",e.getMessage());
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-查房记录", "", JSON.toJSONString(list), "", e.getMessage());
         }
     }
 }

+ 1 - 1
src/main/java/com/diagbot/task/PullDataTask.java

@@ -66,7 +66,7 @@ public class PullDataTask implements SchedulingConfigurer {
                     Calendar yesterday = new GregorianCalendar();
                     yesterday.setTime(new Date());
                     structuralDataVo.setStopDate(sdf.format(yesterday.getTime()));
-                    yesterday.add(yesterday.DATE, -3);
+                    yesterday.add(yesterday.DATE, -30);
                     structuralDataVo.setStartDate(sdf.format(yesterday.getTime()));
 
                     structuralOldDataFacade.sendStructuralDataOld(structuralDataVo);

+ 5 - 0
src/main/java/com/diagbot/util/FJTZDBConnHarp.java

@@ -1,9 +1,12 @@
 package com.diagbot.util;
 
+import com.alibaba.fastjson.JSON;
 import com.diagbot.entity.*;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
 import com.diagbot.vo.data.*;
 import com.diagbot.vo.str.StrCrisisNoteVO;
 import com.google.common.collect.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.sql.*;
 import java.util.ArrayList;
@@ -22,6 +25,8 @@ public class FJTZDBConnHarp {
     private static PreparedStatement sta = null;
 	private static ResultSet rs = null;
 
+	@Autowired
+	private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
 	/**
      * 读取属性文件中的信息
      *

+ 23 - 0
src/main/java/com/diagbot/web/DataController.java

@@ -3,6 +3,7 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.data.*;
 import com.diagbot.facade.data.*;
+import com.diagbot.facade.str.AStrOperativeNoteFacade;
 import com.diagbot.vo.data.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -49,6 +50,8 @@ public class DataController {
     private DeleteFlagFacade deleteFlagFacade;
     @Autowired
     private StructuralOldDataFacade sendOnebehospitalCode;
+    @Autowired
+    private AStrOperativeNoteFacade aStrOperativeNoteFacade;
 //
 //    @ApiOperation(value = "数据引擎-获取医院所有在职医生的基本信息")
 //    @PostMapping("/sendDoctorInfos")
@@ -96,6 +99,16 @@ public class DataController {
     public void sendStructuralOneOld(@Valid @RequestBody StructuralDataVo structuralDataVo){
         sendOnebehospitalCode.sendOnebehospitalCode(structuralDataVo.getBehospitalCode(),structuralDataVo.getPatientId());
     }
+
+    @ApiOperation(value = "{历史病例导入多个病人}")
+    @PostMapping("/sendStructuralMoreOld")
+    @SysLogger("sendStructuralMoreOld")
+    public void sendStructuralMoreOld(@Valid @RequestBody List<StructuralDataVo> structuralDataVo){
+        for (StructuralDataVo structuralDataVo1: structuralDataVo) {
+            sendOnebehospitalCode.sendOnebehospitalCode(structuralDataVo1.getBehospitalCode(), structuralDataVo1.getPatientId());
+        }
+    }
+
     @ApiOperation(value = "{历史病例导入时间格式}")
     @PostMapping("/sendStructuralDateOld")
     @SysLogger("sendStructuralDateOld")
@@ -229,4 +242,14 @@ public class DataController {
 //        columnFacade.analyseRec(aColumnVO.getHospitalId(),aColumnVO.getModeId(),aColumnVO.getContent());
 //        return RespDTO.onSuc(true);
 //    }
+
+    @ApiOperation(value = "测试1")
+    @PostMapping("/getColumnZhAndCh1")
+    @SysLogger("getColumnZhAndCh1")
+    public void getColumnZhAndCh1(){
+//        aStrConsultationNoteFacade.getColumnZhAndCh();
+//        return RespDTO.onSuc(true);
+        aStrOperativeNoteFacade.getOneList(null,"17");
+    }
+
 }

+ 1 - 1
src/main/resources/application-test.yml

@@ -59,7 +59,7 @@ spring:
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       platform: mysql
-      url: jdbc:mysql://192.168.2.241:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+      url: jdbc:mysql://192.168.2.237:3307/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
       username: root
       password: lantone
       # 连接池的配置信息