Jelajahi Sumber

Merge branch 'dev/20201224_2.0.0' into debug

chengyao 4 tahun lalu
induk
melakukan
1291c27690
36 mengubah file dengan 5486 tambahan dan 101 penghapusan
  1. 25 0
      src/main/java/com/diagbot/config/ResourceServerConfigurer.java
  2. 25 0
      src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java
  3. 1 1
      src/main/java/com/diagbot/facade/ConsoleExportFacade.java
  4. 0 5
      src/main/java/com/diagbot/facade/FilterFacade.java
  5. 208 0
      src/main/java/com/diagbot/facade/str/BStrAdmissionNoteFacade.java
  6. 200 0
      src/main/java/com/diagbot/facade/str/BStrBloodResultFacade.java
  7. 211 0
      src/main/java/com/diagbot/facade/str/BStrBloodTransfusionFacade.java
  8. 206 0
      src/main/java/com/diagbot/facade/str/BStrConsultationApplyFacade.java
  9. 207 0
      src/main/java/com/diagbot/facade/str/BStrConsultationNoteFacade.java
  10. 205 0
      src/main/java/com/diagbot/facade/str/BStrConsultationRecordFacade.java
  11. 211 0
      src/main/java/com/diagbot/facade/str/BStrConsultationResultFacade.java
  12. 197 0
      src/main/java/com/diagbot/facade/str/BStrCrisisNoteFacade.java
  13. 201 0
      src/main/java/com/diagbot/facade/str/BStrDeathDiscussionFacade.java
  14. 199 0
      src/main/java/com/diagbot/facade/str/BStrDeathNoteFacade.java
  15. 196 0
      src/main/java/com/diagbot/facade/str/BStrDifficultCaseFacade.java
  16. 193 0
      src/main/java/com/diagbot/facade/str/BStrFirstRecordFacade.java
  17. 192 0
      src/main/java/com/diagbot/facade/str/BStrIllCriticallyFacade.java
  18. 192 0
      src/main/java/com/diagbot/facade/str/BStrIllSeriouslFacade.java
  19. 167 0
      src/main/java/com/diagbot/facade/str/BStrInformedConsentFacade.java
  20. 202 0
      src/main/java/com/diagbot/facade/str/BStrLeaveHospitalFacade.java
  21. 205 0
      src/main/java/com/diagbot/facade/str/BStrOperativeFirstRecordFacade.java
  22. 206 0
      src/main/java/com/diagbot/facade/str/BStrOperativeNoteFacade.java
  23. 194 0
      src/main/java/com/diagbot/facade/str/BStrPeriodConclusionFacade.java
  24. 198 0
      src/main/java/com/diagbot/facade/str/BStrPreoperativeDiscussionFacade.java
  25. 201 0
      src/main/java/com/diagbot/facade/str/BStrRescueNoteFacade.java
  26. 168 0
      src/main/java/com/diagbot/facade/str/BStrTalkInformFacade.java
  27. 197 0
      src/main/java/com/diagbot/facade/str/BStrTransferInNoteFacade.java
  28. 194 0
      src/main/java/com/diagbot/facade/str/BStrTransferOutNoteFacade.java
  29. 198 0
      src/main/java/com/diagbot/facade/str/BStrWardRecordFacade.java
  30. 272 0
      src/main/java/com/diagbot/web/DataStrController.java
  31. 4 0
      src/main/resources/application-dev.yml
  32. 4 0
      src/main/resources/application-local.yml
  33. 4 0
      src/main/resources/application-pre.yml
  34. 4 0
      src/main/resources/application-pro.yml
  35. 4 0
      src/main/resources/application-test.yml
  36. 195 95
      src/main/resources/mapper/BehospitalInfoMapper.xml

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

@@ -164,6 +164,31 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/data/getColumnZhAndCh").permitAll()
                 .antMatchers("/qc/data/analyseRec").permitAll()
                 .antMatchers("/qc/data/hisDataDeal").permitAll()
+                .antMatchers("/qc/data_str/sendAdmissionNote").permitAll()
+                .antMatchers("/qc/data_str/sendBloodResult").permitAll()
+                .antMatchers("/qc/data_str/sendBloodTransfusion").permitAll()
+                .antMatchers("/qc/data_str/sendConsultationApply").permitAll()
+                .antMatchers("/qc/data_str/sendConsultationNote").permitAll()
+                .antMatchers("/qc/data_str/sendConsultationRecord").permitAll()
+                .antMatchers("/qc/data_str/sendConsultationResult").permitAll()
+                .antMatchers("/qc/data_str/sendCrisisNote").permitAll()
+                .antMatchers("/qc/data_str/sendDeathDiscussion").permitAll()
+                .antMatchers("/qc/data_str/sendDeathNote").permitAll()
+                .antMatchers("/qc/data_str/sendDifficultCase").permitAll()
+                .antMatchers("/qc/data_str/sendFirstRecord").permitAll()
+                .antMatchers("/qc/data_str/sendIllCritically").permitAll()
+                .antMatchers("/qc/data_str/sendIllSeriousl").permitAll()
+                .antMatchers("/qc/data_str/sendLeaveHospital").permitAll()
+                .antMatchers("/qc/data_str/sendOperativeFirstRecord").permitAll()
+                .antMatchers("/qc/data_str/sendOperativeNote").permitAll()
+                .antMatchers("/qc/data_str/sendWardRecord").permitAll()
+                .antMatchers("/qc/data_str/sendTransferOutNote").permitAll()
+                .antMatchers("/qc/data_str/sendTransferInNote").permitAll()
+                .antMatchers("/qc/data_str/sendRescueNote").permitAll()
+                .antMatchers("/qc/data_str/sendPeriodConclusion").permitAll()
+                .antMatchers("/qc/data_str/sendPreoperativeDiscussion").permitAll()
+                .antMatchers("/qc/data_str/sendTalkInform").permitAll()
+                .antMatchers("/qc/data_str/sendInformedConsent").permitAll()
                 .antMatchers("/qc/doctoradvice/getPage").permitAll()
                 .antMatchers("/qc/medPacsInfo/getCheckPage").permitAll()
                 .antMatchers("/qc/medLisInfo/getExaminePage").permitAll()

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

@@ -208,6 +208,31 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/data/getColumnZhAndCh", request)
                 || matchers("/qc/data/analyseRec", request)
                 || matchers("/qc/data/hisDataDeal", request)
+                || matchers("/qc/data_str/sendAdmissionNote", request)
+                || matchers("/qc/data_str/sendBloodResult", request)
+                || matchers("/qc/data_str/sendBloodTransfusion", request)
+                || matchers("/qc/data_str/sendConsultationApply", request)
+                || matchers("/qc/data_str/sendConsultationNote", request)
+                || matchers("/qc/data_str/sendConsultationRecord", request)
+                || matchers("/qc/data_str/sendConsultationResult", request)
+                || matchers("/qc/data_str/sendCrisisNote", request)
+                || matchers("/qc/data_str/sendDeathDiscussion", request)
+                || matchers("/qc/data_str/sendDeathNote", request)
+                || matchers("/qc/data_str/sendDifficultCase", request)
+                || matchers("/qc/data_str/sendFirstRecord", request)
+                || matchers("/qc/data_str/sendIllCritically", request)
+                || matchers("/qc/data_str/sendIllSeriousl", request)
+                || matchers("/qc/data_str/sendLeaveHospital", request)
+                || matchers("/qc/data_str/sendOperativeFirstRecord", request)
+                || matchers("/qc/data_str/sendOperativeNote", request)
+                || matchers("/qc/data_str/sendWardRecord", request)
+                || matchers("/qc/data_str/sendTransferOutNote", request)
+                || matchers("/qc/data_str/sendTransferInNote", request)
+                || matchers("/qc/data_str/sendRescueNote", request)
+                || matchers("/qc/data_str/sendPeriodConclusion", request)
+                || matchers("/qc/data_str/sendPreoperativeDiscussion", request)
+                || matchers("/qc/data_str/sendTalkInform", request)
+                || matchers("/qc/data_str/sendInformedConsent", request)
                 || matchers("/qc/doctoradvice/getPage", request)
                 || matchers("/qc/medPacsInfo/getCheckPage", request)
                 || matchers("/qc/medLisInfo/getExaminePage", request)

+ 1 - 1
src/main/java/com/diagbot/facade/ConsoleExportFacade.java

@@ -230,7 +230,7 @@ public class ConsoleExportFacade {
         Date startDate = qcResultShortPageVO.getStartDate();
         Date endDate = qcResultShortPageVO.getEndDate();
         //时间间隔90天
-        long interval = 90 * 24l * 60l * 60l * 100l;
+        long interval = 90 * 24l * 60l * 60l * 1000l;
         if (endDate.getTime() < startDate.getTime()) {
             throw new CommonException(CommonErrorCode.PARAM_ERROR, "截止时间不能小于起始时间");
         }

+ 0 - 5
src/main/java/com/diagbot/facade/FilterFacade.java

@@ -403,11 +403,6 @@ public class FilterFacade {
         String userId = SysUserUtils.getCurrentPrincipleID();
         qcResultPageVO.setHospitalId(hospitalId);
         qcResultPageVO.setUserId(Long.valueOf(userId));
-        if (StringUtils.isEmpty(qcResultPageVO.getDoctorId())) {
-            qcResultPageVO.setDoctorName("");
-        }
-        /*long interval = qcResultShortPageVO.getEndDate().getTime() + 1000;
-        qcResultShortPageVO.setEndDate(new Date(Long.valueOf(interval)));*/
     }
 
 

+ 208 - 0
src/main/java/com/diagbot/facade/str/BStrAdmissionNoteFacade.java

@@ -0,0 +1,208 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrAdmissionNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrAdmissionNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrAdmissionNoteVO;
+import com.diagbot.vo.str.StrAdmissionNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrAdmissionNoteFacade extends StrAdmissionNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strAdmissionNoteServiceImpl")
+    private StrAdmissionNoteServiceImpl strAdmissionNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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, "strAdmissionNote");
+
+        //Map<String, String> map=columnFacade.getColumn("strAdmissionNote");
+        if (!flag) {
+            return;
+        }
+    }
+
+    //入院记录
+    public void dealData(String columnMap, Map<String, Object> entityMap, Long hospitalId) {
+        StrAdmissionNote strAdmissionNote = new StrAdmissionNote();
+        try {
+            AStrAdmissionNoteVO strAdmissionNoteVO = (AStrAdmissionNoteVO) MapUtil.mapToObject(entityMap, AStrAdmissionNoteVO.class);
+            BeanUtils.copyProperties(strAdmissionNoteVO, strAdmissionNote);
+            strAdmissionNote.setHospitalId(hospitalId);//医院编码
+
+            strAdmissionNote.setAuditDate(DateUtil.parseDateTime(strAdmissionNoteVO.getAuditDate()));//审核时间
+            strAdmissionNote.setRecDate(DateUtil.parseDateTime(strAdmissionNoteVO.getRecDate()));//记录时间
+            strAdmissionNote.setBehospitalDate(DateUtil.parseDateTime(strAdmissionNoteVO.getBehospitalDate()));//入院日期
+            strAdmissionNote.setBirthday(DateUtil.parseDate(strAdmissionNoteVO.getBirthday()));//出生日期
+            strAdmissionNote.setRecordDate(DateUtil.parseDateTime(strAdmissionNoteVO.getRecordDate()));//病历日期
+
+            strAdmissionNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if (isExist(strAdmissionNote)) {
+                strAdmissionNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strAdmissionNote);
+            } else {
+                strAdmissionNote.setGmtModified(new Date());//记录修改时间
+                this.update(strAdmissionNote, new QueryWrapper<StrAdmissionNote>()
+                        .eq("rec_id", strAdmissionNote.getRecId())
+                        .eq("hospital_id", strAdmissionNote.getHospitalId())
+                        .eq("behospital_code", strAdmissionNote.getBehospitalCode()));
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("入院记录", strAdmissionNote.getRecId(), JSON.toJSONString(entityMap), "", e.getMessage());
+        }
+    }
+
+    public Boolean isExist(StrAdmissionNote strAdmissionNote) {
+        Boolean flag = true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrAdmissionNote>()
+                .eq("rec_id", strAdmissionNote.getRecId())
+                .eq("hospital_id", strAdmissionNote.getHospitalId())
+                .eq("behospital_code", strAdmissionNote.getBehospitalCode()));
+        if (count > 0) {
+            flag = false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:入院记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrAdmissionNoteVO> list) {
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrAdmissionNoteVO strAdmissionNoteVO:list) {
+                    if("".equals(strAdmissionNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strAdmissionNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strAdmissionNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrAdmissionNote> strAdmissionNoteList=initData(list);
+                execute(strAdmissionNoteList);
+
+                if(logSwitch){
+                    strAdmissionNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-入院记录-正常", s.getRecId(), JSON.toJSONString(list), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-入院记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+
+    }
+
+    /**
+     * @Description:入库前,初始化数据库
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    private List<StrAdmissionNote> initData(List<StrAdmissionNoteVO> list) throws Exception{
+        List<StrAdmissionNote> strAdmissionNoteList=Lists.newArrayList();
+        for (StrAdmissionNoteVO s:list) {
+            StrAdmissionNote t=new StrAdmissionNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getBirthday())){
+                t.setBirthday(DateUtil.parseDate(s.getBirthday()));//出生日期
+            }
+            if(StringUtil.isNotEmpty(s.getBehospitalDate())){
+                t.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));//入院日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.BEHOSPITAL_INFO.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            t.setWholeData(JSON.toJSONString(wholeMap));
+            strAdmissionNoteList.add(t);
+        }
+        return strAdmissionNoteList;
+    }
+
+    public void execute(List<StrAdmissionNote> list) throws Exception{
+        List<StrAdmissionNote> addE = Lists.newLinkedList();
+        List<StrAdmissionNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.forEach(s -> {
+                StrAdmissionNote strAdmissionNote = this.getOne(new QueryWrapper<StrAdmissionNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strAdmissionNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strAdmissionNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+
+}

+ 200 - 0
src/main/java/com/diagbot/facade/str/BStrBloodResultFacade.java

@@ -0,0 +1,200 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrBloodResult;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrBloodResultServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrBloodResultVO;
+import com.diagbot.vo.str.StrBloodResultVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:输血后效果评价-业务类
+ * @Author:liuqq
+ * @time: ${DATE} ${TIME}
+ **/
+@Component
+public class BStrBloodResultFacade extends StrBloodResultServiceImpl {
+
+    @Autowired
+    @Qualifier("strBloodResultServiceImpl")
+    private StrBloodResultServiceImpl strBloodResultService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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){
+            return;
+        }
+        //Map<String, String> map=columnFacade.getColumn("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);
+            strBloodResult.setHospitalId(hospitalId);//医院编码
+            strBloodResult.setAuditDate(DateUtil.parseDateTime(strBloodResultVO.getAuditDate()));//审核时间
+            strBloodResult.setRecDate(DateUtil.parseDateTime(strBloodResultVO.getRecDate()));//记录时间
+            strBloodResult.setRecordDate(DateUtil.parseDateTime(strBloodResultVO.getRecordDate()));//病历日期
+
+            strBloodResult.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strBloodResult)){
+                strBloodResult.setGmtCreate(new Date());//记录创建时间
+                this.save(strBloodResult);
+            }else{
+                strBloodResult.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    /**
+     * @Description: 是否存在
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:输血后效果评价-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrBloodResultVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrBloodResultVO strBloodResultVO:list) {
+                    if("".equals(strBloodResultVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strBloodResultVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strBloodResultVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrBloodResult> strBloodResultList= initData(list);
+                execute(strBloodResultList);
+
+                if(logSwitch){
+                    strBloodResultList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-输血后效果评价-正常", s.getRecId(), JSON.toJSONString(list), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-输血后效果评价-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrBloodResult> initData(List<StrBloodResultVO> list) throws Exception{
+        List<StrBloodResult> tList=Lists.newArrayList();
+        for (StrBloodResultVO s:list) {
+            StrBloodResult t=new StrBloodResult();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.BLOOD_RESULT.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrBloodResult> list) throws Exception{
+        List<StrBloodResult> addE = Lists.newLinkedList();
+        List<StrBloodResult> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrBloodResult strBloodResult = this.getOne(new QueryWrapper<StrBloodResult>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strBloodResult != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strBloodResultService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 211 - 0
src/main/java/com/diagbot/facade/str/BStrBloodTransfusionFacade.java

@@ -0,0 +1,211 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrBloodTransfusion;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrBloodTransfusionServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrBloodTransfusionVO;
+import com.diagbot.vo.str.StrBloodTransfusionVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:输血/血制品病程记录-业务类
+ * @Author:liuqq
+ * @time: ${DATE} ${TIME}
+ **/
+@Component
+public class BStrBloodTransfusionFacade extends StrBloodTransfusionServiceImpl {
+
+    @Autowired
+    @Qualifier("strBloodTransfusionServiceImpl")
+    private StrBloodTransfusionServiceImpl strBloodTransfusionService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strBloodTransfusion.setHospitalId(hospitalId);//医院编码
+            strBloodTransfusion.setStartTime(DateUtil.parseDateTime(strBloodTransfusionVO.getStartTime()));
+            strBloodTransfusion.setEndTime(DateUtil.parseDateTime(strBloodTransfusionVO.getEndTime()));
+            strBloodTransfusion.setAuditDate(DateUtil.parseDateTime(strBloodTransfusionVO.getAuditDate()));//审核时间
+            strBloodTransfusion.setRecDate(DateUtil.parseDateTime(strBloodTransfusionVO.getRecDate()));//记录时间
+            strBloodTransfusion.setRecordDate(DateUtil.parseDateTime(strBloodTransfusionVO.getRecordDate()));//病历日期
+
+            strBloodTransfusion.setWholeData(columnMap);
+
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strBloodTransfusion)){
+                strBloodTransfusion.setGmtCreate(new Date());//记录创建时间
+                this.save(strBloodTransfusion);
+            }else{
+                strBloodTransfusion.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:输血/血制品病程记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrBloodTransfusionVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrBloodTransfusionVO strBloodTransfusionVO:list) {
+                    if("".equals(strBloodTransfusionVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strBloodTransfusionVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strBloodTransfusionVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrBloodTransfusion> strBloodTransfusionList= initData(list);
+                execute(strBloodTransfusionList);
+
+                if(logSwitch){
+                    strBloodTransfusionList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-输血后效果评价-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-输血后效果评价-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrBloodTransfusion> initData(List<StrBloodTransfusionVO> list) throws Exception{
+        List<StrBloodTransfusion> tList=Lists.newArrayList();
+        for (StrBloodTransfusionVO s:list) {
+            StrBloodTransfusion t=new StrBloodTransfusion();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getStartTime())){
+                t.setStartTime(DateUtil.parseDateTime(s.getStartTime()));//开始日期
+            }
+            if(StringUtil.isNotEmpty(s.getEndTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getEndTime()));//结束日期
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.BLOOD_TRANSFUSION.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrBloodTransfusion> list){
+        try {
+            List<StrBloodTransfusion> addE = Lists.newLinkedList();
+            List<StrBloodTransfusion> updateE = Lists.newLinkedList();
+            if (list != null && list.size() > 0) {
+                list.stream().forEach(s -> {
+                    StrBloodTransfusion strBloodTransfusion = this.getOne(new QueryWrapper<StrBloodTransfusion>()
+                            .eq("is_deleted", IsDeleteEnum.N.getKey())
+                            .eq("rec_id", s.getRecId())
+                            .eq("hospital_id", s.getHospitalId())
+                            .eq("behospital_code",s.getBehospitalCode()), false);
+                    if (strBloodTransfusion != null) {
+                        s.setGmtModified(new Date());
+                        updateE.add(s);
+                    } else {
+                        s.setGmtCreate(new Date());
+                        addE.add(s);
+                    }
+                });
+            }
+            if(addE.size()>0){
+                strBloodTransfusionService.saveBatch(addE);
+            }
+            if(updateE.size()>0){
+                this.baseMapper.updateBatchByKey(updateE);
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-入院记录","", JSON.toJSONString(list),"",e.getMessage());
+        }
+    }
+}

+ 206 - 0
src/main/java/com/diagbot/facade/str/BStrConsultationApplyFacade.java

@@ -0,0 +1,206 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrConsultationApply;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrConsultationApplyServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrConsultationApplyVO;
+import com.diagbot.vo.str.StrConsultationApplyVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrConsultationApplyFacade extends StrConsultationApplyServiceImpl {
+
+    @Autowired
+    @Qualifier("strConsultationApplyServiceImpl")
+    private StrConsultationApplyServiceImpl strConsultationApplyService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strConsultationApply");
+
+        //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //会诊申请单
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrConsultationApply strConsultationApply=new StrConsultationApply();
+        try {
+            AStrConsultationApplyVO strConsultationApplyVO=(AStrConsultationApplyVO) MapUtil.mapToObject(entityMap, AStrConsultationApplyVO.class);
+            BeanUtils.copyProperties(strConsultationApplyVO,strConsultationApply);
+            strConsultationApply.setHospitalId(hospitalId);//医院编码
+
+            strConsultationApply.setAuditDate(DateUtil.parseDateTime(strConsultationApplyVO.getAuditDate()));//审核时间
+            strConsultationApply.setRecDate(DateUtil.parseDateTime(strConsultationApplyVO.getRecDate()));//记录时间
+            strConsultationApply.setBehospitalDate(DateUtil.parseDateTime(strConsultationApplyVO.getBehospitalDate()));//入院日期
+            strConsultationApply.setRecordDate(DateUtil.parseDateTime(strConsultationApplyVO.getRecordDate()));//病历日期
+            strConsultationApply.setApplyDate(DateUtil.parseDateTime(strConsultationApplyVO.getApplyDate()));//申请日期
+            strConsultationApply.setConsultationDate(DateUtil.parseDateTime(strConsultationApplyVO.getConsultationDate()));//会诊时间
+            strConsultationApply.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strConsultationApply)){
+                strConsultationApply.setGmtCreate(new Date());//记录创建时间
+                this.save(strConsultationApply);
+            }else{
+                strConsultationApply.setGmtModified(new Date());//记录修改时间
+                this.update(strConsultationApply,new QueryWrapper<StrConsultationApply>()
+                        .eq("rec_id", strConsultationApply.getRecId())
+                        .eq("hospital_id", strConsultationApply.getHospitalId())
+                        .eq("behospital_code", strConsultationApply.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊申请单",strConsultationApply.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrConsultationApply strConsultationApply){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrConsultationApply>()
+                .eq("rec_id", strConsultationApply.getRecId())
+                .eq("hospital_id", strConsultationApply.getHospitalId())
+                .eq("behospital_code", strConsultationApply.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:会诊申请单-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrConsultationApplyVO> list){
+        try {
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrConsultationApplyVO strConsultationApplyVO:list) {
+                    if("".equals(strConsultationApplyVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strConsultationApplyVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strConsultationApplyVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrConsultationApply> strConsultationApplyList= initData(list);
+                execute(strConsultationApplyList);
+
+                if(logSwitch){
+                    strConsultationApplyList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊申请单-正常", s.getRecId(), JSON.toJSONString(list), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊申请单-异常", s.getRecId(), JSON.toJSONString(s), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrConsultationApply> initData(List<StrConsultationApplyVO> list) throws Exception{
+        List<StrConsultationApply> tList=Lists.newArrayList();
+        for (StrConsultationApplyVO s:list) {
+            StrConsultationApply t=new StrConsultationApply();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getBehospitalDate())){
+                t.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));//入院日期
+            }
+            if(StringUtil.isNotEmpty(s.getApplyDate())){
+                t.setApplyDate(DateUtil.parseDateTime(s.getApplyDate()));//申请日期
+            }
+            if(StringUtil.isNotEmpty(s.getConsultationDate())){
+                t.setConsultationDate(DateUtil.parseDateTime(s.getConsultationDate()));//会诊时间
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.CONSULTATION_APPLY.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrConsultationApply> list) throws Exception{
+        List<StrConsultationApply> addE = Lists.newLinkedList();
+        List<StrConsultationApply> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrConsultationApply strConsultationApply = this.getOne(new QueryWrapper<StrConsultationApply>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strConsultationApply != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strConsultationApplyService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+
+}

+ 207 - 0
src/main/java/com/diagbot/facade/str/BStrConsultationNoteFacade.java

@@ -0,0 +1,207 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrConsultationNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrConsultationNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrConsultationNoteVO;
+import com.diagbot.vo.str.StrConsultationNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrConsultationNoteFacade extends StrConsultationNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strConsultationNoteServiceImpl")
+    private StrConsultationNoteServiceImpl strConsultationNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strConsultationNote");
+
+        //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //会诊单(申请和结果)
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrConsultationNote strConsultationNote=new StrConsultationNote();
+        try {
+            AStrConsultationNoteVO strConsultationNoteVO=(AStrConsultationNoteVO) MapUtil.mapToObject(entityMap, AStrConsultationNoteVO.class);
+            BeanUtils.copyProperties(strConsultationNoteVO,strConsultationNote);
+            strConsultationNote.setHospitalId(hospitalId);//医院编码
+
+            strConsultationNote.setAuditDate(DateUtil.parseDateTime(strConsultationNoteVO.getAuditDate()));//审核时间
+            strConsultationNote.setRecDate(DateUtil.parseDateTime(strConsultationNoteVO.getRecDate()));//记录时间
+            strConsultationNote.setBehospitalDate(DateUtil.parseDateTime(strConsultationNoteVO.getBehospitalDate()));//入院日期
+            strConsultationNote.setApplyDate(DateUtil.parseDate(strConsultationNoteVO.getApplyDate()));//申请日期
+            strConsultationNote.setRecordDate(DateUtil.parseDateTime(strConsultationNoteVO.getRecordDate()));//病历日期
+            strConsultationNote.setConsultationDate(DateUtil.parseDateTime(strConsultationNoteVO.getConsultationDate()));//会诊时间
+
+            strConsultationNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strConsultationNote)){
+                strConsultationNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strConsultationNote);
+            }else{
+                strConsultationNote.setGmtModified(new Date());//记录修改时间
+                this.update(strConsultationNote,new QueryWrapper<StrConsultationNote>()
+                        .eq("rec_id", strConsultationNote.getRecId())
+                        .eq("hospital_id", strConsultationNote.getHospitalId())
+                        .eq("behospital_code", strConsultationNote.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("会诊单(申请和结果)",strConsultationNote.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrConsultationNote strConsultationNote){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrConsultationNote>()
+                .eq("rec_id", strConsultationNote.getRecId())
+                .eq("hospital_id", strConsultationNote.getHospitalId())
+                .eq("behospital_code", strConsultationNote.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:会诊单(申请和结果)-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrConsultationNoteVO> list){
+        try {
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrConsultationNoteVO strConsultationNoteVO:list) {
+                    if("".equals(strConsultationNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strConsultationNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strConsultationNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrConsultationNote> strConsultationNoteList= initData(list);
+                execute(strConsultationNoteList);
+
+                if(logSwitch){
+                    strConsultationNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊单(申请和结果)-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+            list.forEach(s->{
+            aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊单(申请和结果)-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+            });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrConsultationNote> initData(List<StrConsultationNoteVO> list) throws Exception{
+        List<StrConsultationNote> tList=Lists.newArrayList();
+        for (StrConsultationNoteVO s:list) {
+            StrConsultationNote t=new StrConsultationNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getBehospitalDate())){
+                t.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));//入院日期
+            }
+            if(StringUtil.isNotEmpty(s.getApplyDate())){
+                t.setApplyDate(DateUtil.parseDateTime(s.getApplyDate()));//申请日期
+            }
+            if(StringUtil.isNotEmpty(s.getConsultationDate())){
+                t.setConsultationDate(DateUtil.parseDateTime(s.getConsultationDate()));//会诊时间
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.CONSULTATION_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrConsultationNote> list) throws Exception{
+        List<StrConsultationNote> addE = Lists.newLinkedList();
+        List<StrConsultationNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrConsultationNote strConsultationNote = this.getOne(new QueryWrapper<StrConsultationNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strConsultationNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strConsultationNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+
+}

+ 205 - 0
src/main/java/com/diagbot/facade/str/BStrConsultationRecordFacade.java

@@ -0,0 +1,205 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrConsultationRecord;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrConsultationRecordServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.AStrConsultationRecordVO;
+import com.diagbot.vo.str.StrConsultationRecordVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+@Component
+public class BStrConsultationRecordFacade extends StrConsultationRecordServiceImpl {
+
+    @Autowired
+    @Qualifier("strConsultationRecordServiceImpl")
+    private StrConsultationRecordServiceImpl strConsultationRecordService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationRecord");
+        if(!flag){
+            return;
+        }
+    }
+
+    //会诊记录
+    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);
+            strConsultationRecord.setHospitalId(hospitalId);//医院编码
+
+            strConsultationRecord.setRecordDate(DateUtil.parseDateTime(AStrConsultationRecordVO.getRecordDate()));//病历日期recordDate
+            strConsultationRecord.setBehospitalDate(DateUtil.parseDateTime(AStrConsultationRecordVO.getBehospitalDate()));//入院日期behospital_date
+            strConsultationRecord.setApplyDate(DateUtil.parseDateTime(AStrConsultationRecordVO.getApplyDate()));//申请日期apply_date
+            strConsultationRecord.setConsultationDate(DateUtil.parseDate(AStrConsultationRecordVO.getConsultationArriveDate()));//会诊时间consultation_date
+            strConsultationRecord.setRecDate(DateUtil.parseDateTime(AStrConsultationRecordVO.getRecDate()));//记录时间rec_date
+            strConsultationRecord.setAuditDate(DateUtil.parseDateTime(AStrConsultationRecordVO.getAuditDate()));//审核时间audit_date
+
+            strConsultationRecord.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strConsultationRecord)){
+                strConsultationRecord.setGmtCreate(new Date());//记录创建时间
+                this.save(strConsultationRecord);
+            }else{
+                strConsultationRecord.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:会诊记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrConsultationRecordVO> list){
+        try {
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrConsultationRecordVO strConsultationRecordVO:list) {
+                    if("".equals(strConsultationRecordVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strConsultationRecordVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strConsultationRecordVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrConsultationRecord> strConsultationRecordList= initData(list);
+                execute(strConsultationRecordList);
+
+                if(logSwitch){
+                    strConsultationRecordList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrConsultationRecord> initData(List<StrConsultationRecordVO> list) throws Exception{
+        List<StrConsultationRecord> tList=Lists.newArrayList();
+        for (StrConsultationRecordVO s:list) {
+            StrConsultationRecord t=new StrConsultationRecord();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getBehospitalDate())){
+                t.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));//入院日期
+            }
+            if(StringUtil.isNotEmpty(s.getApplyDate())){
+                t.setApplyDate(DateUtil.parseDateTime(s.getApplyDate()));//申请日期
+            }
+            if(StringUtil.isNotEmpty(s.getConsultationDate())){
+                t.setConsultationDate(DateUtil.parseDateTime(s.getConsultationDate()));//会诊时间
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.CONSULTATION_RECORD.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrConsultationRecord> list){
+        List<StrConsultationRecord> addE = Lists.newLinkedList();
+        List<StrConsultationRecord> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrConsultationRecord strConsultationRecord = this.getOne(new QueryWrapper<StrConsultationRecord>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strConsultationRecord != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strConsultationRecordService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 211 - 0
src/main/java/com/diagbot/facade/str/BStrConsultationResultFacade.java

@@ -0,0 +1,211 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrConsultationResult;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrConsultationResultServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrConsultationResultVO;
+import com.diagbot.vo.str.StrConsultationResultVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:会诊结果单-业务类
+ * @Author:liuqq
+ * @time: ${DATE} ${TIME}
+ **/
+@Component
+public class BStrConsultationResultFacade extends StrConsultationResultServiceImpl {
+
+    @Autowired
+    @Qualifier("strConsultationResultServiceImpl")
+    private StrConsultationResultServiceImpl strConsultationResultService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //会诊结果单
+    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);
+            strConsultationResult.setHospitalId(hospitalId);//医院编码
+
+            strConsultationResult.setAuditDate(DateUtil.parseDateTime(strConsultationResultVO.getAuditDate()));//审核时间
+            strConsultationResult.setRecDate(DateUtil.parseDateTime(strConsultationResultVO.getRecDate()));//记录时间
+            strConsultationResult.setBehospitalDate(DateUtil.parseDateTime(strConsultationResultVO.getBehospitalDate()));//入院日期
+            strConsultationResult.setApplyDate(DateUtil.parseDate(strConsultationResultVO.getApplyDate()));//申请时间
+            strConsultationResult.setRecordDate(DateUtil.parseDateTime(strConsultationResultVO.getRecordDate()));//病历日期
+            strConsultationResult.setConsultationArriveDate(DateUtil.parseDateTime(strConsultationResultVO.getConsultationArriveDate()));//会诊到达时间
+
+            strConsultationResult.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strConsultationResult)){
+                strConsultationResult.setGmtCreate(new Date());//记录创建时间
+                this.save(strConsultationResult);
+            }else{
+                strConsultationResult.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:会诊结果单-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrConsultationResultVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrConsultationResultVO strConsultationResultVO:list) {
+                    if("".equals(strConsultationResultVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strConsultationResultVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strConsultationResultVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrConsultationResult> strConsultationResultList= initData(list);
+                execute(strConsultationResultList);
+
+                if(logSwitch){
+                    strConsultationResultList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊结果单-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-会诊结果单-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrConsultationResult> initData(List<StrConsultationResultVO> list) throws Exception{
+        List<StrConsultationResult> tList=Lists.newArrayList();
+        for (StrConsultationResultVO s:list) {
+            StrConsultationResult t=new StrConsultationResult();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getBehospitalDate())){
+                t.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));//入院日期
+            }
+            if(StringUtil.isNotEmpty(s.getApplyDate())){
+                t.setApplyDate(DateUtil.parseDateTime(s.getApplyDate()));//申请日期
+            }
+            if(StringUtil.isNotEmpty(s.getConsultationArriveDate())){
+                t.setConsultationArriveDate(DateUtil.parseDateTime(s.getConsultationArriveDate()));//会诊到达时间
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.CONSULTATION_RESULT.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrConsultationResult> list){
+        List<StrConsultationResult> addE = Lists.newLinkedList();
+        List<StrConsultationResult> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrConsultationResult strConsultationResult = this.getOne(new QueryWrapper<StrConsultationResult>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strConsultationResult != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strConsultationResultService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 197 - 0
src/main/java/com/diagbot/facade/str/BStrCrisisNoteFacade.java

@@ -0,0 +1,197 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrCrisisNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrCrisisNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrCrisisNoteVO;
+import com.diagbot.vo.str.StrCrisisNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrCrisisNoteFacade extends StrCrisisNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strCrisisNoteServiceImpl")
+    private StrCrisisNoteServiceImpl strCrisisNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strCrisisNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrCrisisNote strCrisisNote=new StrCrisisNote();
+        try {
+            AStrCrisisNoteVO strCrisisNoteVO=(AStrCrisisNoteVO) MapUtil.mapToObject(entityMap, AStrCrisisNoteVO.class);
+            BeanUtils.copyProperties(strCrisisNoteVO,strCrisisNote);
+            strCrisisNote.setHospitalId(hospitalId);//医院编码
+
+            strCrisisNote.setAuditDate(DateUtil.parseDateTime(strCrisisNoteVO.getAuditDate()));//审核时间
+            strCrisisNote.setRecDate(DateUtil.parseDateTime(strCrisisNoteVO.getRecDate()));//记录时间
+            strCrisisNote.setRecieveDate(DateUtil.parseDateTime(strCrisisNoteVO.getRecieveDate()));//开始时间
+            strCrisisNote.setAuditDate(DateUtil.parseDate(strCrisisNoteVO.getAuditDate()));//结束时间
+            strCrisisNote.setRecordDate(DateUtil.parseDateTime(strCrisisNoteVO.getRecordDate()));//病历日期
+
+            strCrisisNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strCrisisNote)){
+                strCrisisNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strCrisisNote);
+            }else{
+                strCrisisNote.setGmtModified(new Date());//记录修改时间
+                this.update(strCrisisNote,new QueryWrapper<StrCrisisNote>()
+                        .eq("rec_id", strCrisisNote.getRecId())
+                        .eq("hospital_id", strCrisisNote.getHospitalId())
+                        .eq("behospital_code", strCrisisNote.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("危急值记录",strCrisisNote.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrCrisisNote strCrisisNote){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrCrisisNote>()
+                .eq("rec_id", strCrisisNote.getRecId())
+                .eq("hospital_id", strCrisisNote.getHospitalId())
+                .eq("behospital_code", strCrisisNote.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:危急值记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrCrisisNoteVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrCrisisNoteVO strCrisisNoteVO:list) {
+                    if("".equals(strCrisisNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strCrisisNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strCrisisNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrCrisisNote> strCrisisNoteList= initData(list);
+                execute(strCrisisNoteList);
+
+                if(logSwitch){
+                    strCrisisNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-危急值记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-危急值记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrCrisisNote> initData(List<StrCrisisNoteVO> list) throws Exception{
+        List<StrCrisisNote> tList=Lists.newArrayList();
+        for (StrCrisisNoteVO s:list) {
+            StrCrisisNote t=new StrCrisisNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecieveDate())){
+                t.setRecieveDate(DateUtil.parseDateTime(s.getRecieveDate()));//接收日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.CRISIS_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrCrisisNote> list){
+        List<StrCrisisNote> addE = Lists.newLinkedList();
+        List<StrCrisisNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrCrisisNote strCrisisNote = this.getOne(new QueryWrapper<StrCrisisNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strCrisisNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strCrisisNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 201 - 0
src/main/java/com/diagbot/facade/str/BStrDeathDiscussionFacade.java

@@ -0,0 +1,201 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrDeathDiscussion;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrDeathDiscussionServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrDeathDiscussionVO;
+import com.diagbot.vo.str.StrDeathDiscussionVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrDeathDiscussionFacade extends StrDeathDiscussionServiceImpl {
+    @Autowired
+    @Qualifier("strDeathDiscussionServiceImpl")
+    private StrDeathDiscussionServiceImpl strDeathDiscussionService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //死亡病例讨论记录
+    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);
+            strDeathDiscussion.setHospitalId(hospitalId);//医院编码
+
+            strDeathDiscussion.setAuditDate(DateUtil.parseDateTime(strDeathDiscussionVO.getAuditDate()));//审核时间
+            strDeathDiscussion.setRecDate(DateUtil.parseDateTime(strDeathDiscussionVO.getRecDate()));//记录时间
+            strDeathDiscussion.setDeathDate(DateUtil.parseDateTime(strDeathDiscussionVO.getDeathDate()));//死亡时间
+            strDeathDiscussion.setDiscussDate(DateUtil.parseDate(strDeathDiscussionVO.getDiscussDate()));//讨论时间
+            strDeathDiscussion.setRecordDate(DateUtil.parseDateTime(strDeathDiscussionVO.getRecordDate()));//病历日期
+
+            strDeathDiscussion.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strDeathDiscussion)){
+                strDeathDiscussion.setGmtCreate(new Date());//记录创建时间
+                this.save(strDeathDiscussion);
+            }else{
+                strDeathDiscussion.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:死亡病例讨论记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrDeathDiscussionVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrDeathDiscussionVO strDeathDiscussionVO:list) {
+                    if("".equals(strDeathDiscussionVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strDeathDiscussionVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strDeathDiscussionVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrDeathDiscussion> strDeathDiscussionList= Lists.newArrayList();
+                execute(strDeathDiscussionList);
+
+                if(logSwitch){
+                    strDeathDiscussionList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡病例讨论记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡病例讨论记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrDeathDiscussion> initData(List<StrDeathDiscussionVO> list) throws Exception{
+        List<StrDeathDiscussion> tList=Lists.newArrayList();
+        for (StrDeathDiscussionVO s:list) {
+            StrDeathDiscussion t=new StrDeathDiscussion();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getDeathDate())){
+                t.setDeathDate(DateUtil.parseDateTime(s.getDeathDate()));//死亡日期
+            }
+            if(StringUtil.isNotEmpty(s.getDiscussDate())){
+                t.setDiscussDate(DateUtil.parseDateTime(s.getDiscussDate()));//讨论时间
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.DEATH_DISCUSSION.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrDeathDiscussion> list){
+        List<StrDeathDiscussion> addE = Lists.newLinkedList();
+        List<StrDeathDiscussion> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrDeathDiscussion strDeathDiscussion = this.getOne(new QueryWrapper<StrDeathDiscussion>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strDeathDiscussion != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strDeathDiscussionService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 199 - 0
src/main/java/com/diagbot/facade/str/BStrDeathNoteFacade.java

@@ -0,0 +1,199 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrDeathNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrDeathNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrDeathNoteVO;
+import com.diagbot.vo.str.StrDeathNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrDeathNoteFacade extends StrDeathNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strDeathNoteServiceImpl")
+    private StrDeathNoteServiceImpl strDeathNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //死亡记录
+    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);
+            strDeathNote.setHospitalId(hospitalId);//医院编码
+
+            strDeathNote.setAuditDate(DateUtil.parseDateTime(strDeathNoteVO.getAuditDate()));//审核时间
+            strDeathNote.setRecDate(DateUtil.parseDateTime(strDeathNoteVO.getRecDate()));//记录时间
+            strDeathNote.setBehospitalDate(DateUtil.parseDateTime(strDeathNoteVO.getBehospitalDate()));//入院日期
+            strDeathNote.setDeathDate(DateUtil.parseDate(strDeathNoteVO.getDeathDate()));//死亡日期
+            strDeathNote.setRecordDate(DateUtil.parseDateTime(strDeathNoteVO.getRecordDate()));//病历日期
+
+            strDeathNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strDeathNote)){
+                strDeathNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strDeathNote);
+            }else{
+                strDeathNote.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:死亡记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrDeathNoteVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrDeathNoteVO strDeathNoteVO:list) {
+                    if("".equals(strDeathNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strDeathNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strDeathNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrDeathNote> strDeathNoteList= initData(list);
+                execute(strDeathNoteList);
+
+                if(logSwitch){
+                    strDeathNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-死亡记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrDeathNote> initData(List<StrDeathNoteVO> list) throws Exception{
+        List<StrDeathNote> tList=Lists.newArrayList();
+        for (StrDeathNoteVO s:list) {
+            StrDeathNote t=new StrDeathNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getDeathDate())){
+                t.setDeathDate(DateUtil.parseDateTime(s.getDeathDate()));//死亡日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.DEATH_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrDeathNote> list){
+        List<StrDeathNote> addE = Lists.newLinkedList();
+        List<StrDeathNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrDeathNote strDeathNote = this.getOne(new QueryWrapper<StrDeathNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strDeathNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strDeathNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 196 - 0
src/main/java/com/diagbot/facade/str/BStrDifficultCaseFacade.java

@@ -0,0 +1,196 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrDifficultCase;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrDifficultCaseServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrDifficultCaseVO;
+import com.diagbot.vo.str.StrDifficultCaseVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrDifficultCaseFacade extends StrDifficultCaseServiceImpl{
+
+    @Autowired
+    @Qualifier("strDifficultCaseServiceImpl")
+    private StrDifficultCaseServiceImpl strDifficultCaseService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            medDifficult.setHospitalId(hospitalId);//医院编码
+            medDifficult.setRecDate(DateUtil.parseDateTime(medDifficultVO.getRecDate()));
+            medDifficult.setAuditDate(DateUtil.parseDateTime(medDifficultVO.getAuditDate()));
+            medDifficult.setDiscussDate(DateUtil.parseDateTime(medDifficultVO.getDiscussDate()));
+            medDifficult.setRecordDate(DateUtil.parseDateTime(medDifficultVO.getRecordDate()));//病历日期
+
+            medDifficult.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(medDifficult)){
+                medDifficult.setGmtCreate(new Date());//记录创建时间
+                this.save(medDifficult);
+            }else{
+                medDifficult.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:疑难病例讨论记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrDifficultCaseVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrDifficultCaseVO strDifficultCaseVO:list) {
+                    if("".equals(strDifficultCaseVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strDifficultCaseVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strDifficultCaseVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrDifficultCase> strDifficultCaseList= initData(list);
+                execute(strDifficultCaseList);
+
+                if(logSwitch){
+                    strDifficultCaseList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-疑难病例讨论记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-疑难病例讨论记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrDifficultCase> initData(List<StrDifficultCaseVO> list) throws Exception{
+        List<StrDifficultCase> tList=Lists.newArrayList();
+        for (StrDifficultCaseVO s:list) {
+            StrDifficultCase t=new StrDifficultCase();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getDiscussDate())){
+                t.setDiscussDate(DateUtil.parseDateTime(s.getDiscussDate()));//讨论日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.DIFFICULT_CASE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrDifficultCase> list){
+        List<StrDifficultCase> addE = Lists.newLinkedList();
+        List<StrDifficultCase> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrDifficultCase strDifficultCase = this.getOne(new QueryWrapper<StrDifficultCase>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strDifficultCase != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strDifficultCaseService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 193 - 0
src/main/java/com/diagbot/facade/str/BStrFirstRecordFacade.java

@@ -0,0 +1,193 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrFirstRecord;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrFirstRecordServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrFirstRecordVO;
+import com.diagbot.vo.str.StrFirstRecordVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrFirstRecordFacade extends StrFirstRecordServiceImpl {
+
+    @Autowired
+    @Qualifier("strFirstRecordServiceImpl")
+    private StrFirstRecordServiceImpl strFirstRecordService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strFirstRecord.setHospitalId(hospitalId);//医院编码
+
+            strFirstRecord.setAuditDate(DateUtil.parseDateTime(strFirstRecordVO.getAuditDate()));//审核时间
+            strFirstRecord.setRecDate(DateUtil.parseDateTime(strFirstRecordVO.getRecDate()));//记录时间
+            strFirstRecord.setRecordDate(DateUtil.parseDateTime(strFirstRecordVO.getRecordDate()));//病历日期
+
+            strFirstRecord.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strFirstRecord)){
+                strFirstRecord.setGmtCreate(new Date());//记录创建时间
+                this.save(strFirstRecord);
+            }else{
+                strFirstRecord.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:首次病程录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrFirstRecordVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrFirstRecordVO strFirstRecordVO:list) {
+                    if("".equals(strFirstRecordVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strFirstRecordVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strFirstRecordVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrFirstRecord> strFirstRecordList= initData(list);
+                execute(strFirstRecordList);
+
+                if(logSwitch){
+                    strFirstRecordList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-首次病程录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-首次病程录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrFirstRecord> initData(List<StrFirstRecordVO> list) throws Exception{
+        List<StrFirstRecord> tList=Lists.newArrayList();
+        for (StrFirstRecordVO s:list) {
+            StrFirstRecord t=new StrFirstRecord();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.FIRST_RECORD.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrFirstRecord> list){
+        List<StrFirstRecord> addE = Lists.newLinkedList();
+        List<StrFirstRecord> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrFirstRecord strFirstRecord = this.getOne(new QueryWrapper<StrFirstRecord>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strFirstRecord != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strFirstRecordService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 192 - 0
src/main/java/com/diagbot/facade/str/BStrIllCriticallyFacade.java

@@ -0,0 +1,192 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrIllCritically;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrIllCriticallyServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrIllCriticallyVO;
+import com.diagbot.vo.str.StrIllCriticallyVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrIllCriticallyFacade extends StrIllCriticallyServiceImpl {
+
+    @Autowired
+    @Qualifier("strIllCriticallyServiceImpl")
+    private StrIllCriticallyServiceImpl strIllCriticallyService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strIllCritically");
+
+        //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrIllCritically strIllCritically=new StrIllCritically();
+        try {
+            AStrIllCriticallyVO strIllCriticallyVO=(AStrIllCriticallyVO) MapUtil.mapToObject(entityMap, AStrIllCriticallyVO.class);
+            BeanUtils.copyProperties(strIllCriticallyVO,strIllCritically);
+            strIllCritically.setHospitalId(hospitalId);//医院编码
+            strIllCritically.setPatientSignDate(DateUtil.parseDateTime(strIllCriticallyVO.getPatientSignDate()));
+            strIllCritically.setDoctorSignDate(DateUtil.parseDateTime(strIllCriticallyVO.getDoctorSignDate()));//审核时间
+            strIllCritically.setRecordDate(DateUtil.parseDateTime(strIllCriticallyVO.getRecordDate()));//病历日期
+
+            strIllCritically.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strIllCritically)){
+                strIllCritically.setGmtCreate(new Date());//记录创建时间
+                this.save(strIllCritically);
+            }else{
+                strIllCritically.setGmtModified(new Date());//记录修改时间
+                this.update(strIllCritically,new QueryWrapper<StrIllCritically>()
+                        .eq("rec_id", strIllCritically.getRecId())
+                        .eq("hospital_id", strIllCritically.getHospitalId())
+                        .eq("behospital_code", strIllCritically.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病危通知单",strIllCritically.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrIllCritically strIllCritically){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrIllCritically>()
+                .eq("rec_id", strIllCritically.getRecId())
+                .eq("hospital_id", strIllCritically.getHospitalId())
+                .eq("behospital_code", strIllCritically.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:病危通知单-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrIllCriticallyVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrIllCriticallyVO strIllCriticallyVO:list) {
+                    if("".equals(strIllCriticallyVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strIllCriticallyVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strIllCriticallyVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrIllCritically> strIllCriticallyList= initData(list);
+                execute(strIllCriticallyList);
+
+                if(logSwitch){
+                    strIllCriticallyList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-病危通知单-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-病危通知单-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrIllCritically> initData(List<StrIllCriticallyVO> list) throws Exception{
+        List<StrIllCritically> tList=Lists.newArrayList();
+        for (StrIllCriticallyVO s:list) {
+            StrIllCritically t=new StrIllCritically();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getPatientSignDate())){
+                t.setPatientSignDate(DateUtil.parseDateTime(s.getPatientSignDate()));//病人签名日期
+            }
+            if(StringUtil.isNotEmpty(s.getDoctorSignDate())){
+                t.setDoctorSignDate(DateUtil.parseDateTime(s.getDoctorSignDate()));//医生签名日期
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.ILL_CRITICALLY.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrIllCritically> list){
+        List<StrIllCritically> addE = Lists.newLinkedList();
+        List<StrIllCritically> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrIllCritically strIllCritically = this.getOne(new QueryWrapper<StrIllCritically>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strIllCritically != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strIllCriticallyService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 192 - 0
src/main/java/com/diagbot/facade/str/BStrIllSeriouslFacade.java

@@ -0,0 +1,192 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrIllSeriousl;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrIllSeriouslServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrIllSeriouslVO;
+import com.diagbot.vo.str.StrIllSeriouslVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrIllSeriouslFacade extends StrIllSeriouslServiceImpl {
+
+    @Autowired
+    @Qualifier("strIllSeriouslServiceImpl")
+    private StrIllSeriouslServiceImpl strIllSeriouslService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strIllSeriousl.setHospitalId(hospitalId);//医院编码
+            strIllSeriousl.setPatientSignDate(DateUtil.parseDateTime(strIllSeriouslVO.getPatientSignDate()));
+            strIllSeriousl.setDoctorSignDate(DateUtil.parseDateTime(strIllSeriouslVO.getDoctorSignDate()));//审核时间
+            strIllSeriousl.setRecordDate(DateUtil.parseDateTime(strIllSeriouslVO.getRecordDate()));//病历日期
+
+            strIllSeriousl.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strIllSeriousl)){
+                strIllSeriousl.setGmtCreate(new Date());//记录创建时间
+                this.save(strIllSeriousl);
+            }else{
+                strIllSeriousl.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:病危通知单-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrIllSeriouslVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrIllSeriouslVO strIllSeriouslVO:list) {
+                    if("".equals(strIllSeriouslVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strIllSeriouslVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strIllSeriouslVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrIllSeriousl> strIllSeriouslList= initData(list);
+                execute(strIllSeriouslList);
+
+                if(logSwitch){
+                    strIllSeriouslList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-病危通知单-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-病危通知单-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrIllSeriousl> initData(List<StrIllSeriouslVO> list) throws Exception{
+        List<StrIllSeriousl> tList=Lists.newArrayList();
+        for (StrIllSeriouslVO s:list) {
+            StrIllSeriousl t=new StrIllSeriousl();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getPatientSignDate())){
+                t.setPatientSignDate(DateUtil.parseDateTime(s.getPatientSignDate()));//病人签名日期
+            }
+            if(StringUtil.isNotEmpty(s.getDoctorSignDate())){
+                t.setDoctorSignDate(DateUtil.parseDateTime(s.getDoctorSignDate()));//医生签名日期
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.ILL_SERIOUSL.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrIllSeriousl> list){
+        List<StrIllSeriousl> addE = Lists.newLinkedList();
+        List<StrIllSeriousl> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrIllSeriousl strIllSeriousl = this.getOne(new QueryWrapper<StrIllSeriousl>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strIllSeriousl != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strIllSeriouslService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 167 - 0
src/main/java/com/diagbot/facade/str/BStrInformedConsentFacade.java

@@ -0,0 +1,167 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrInformedConsent;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrInformedConsentServiceImpl;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.vo.str.StrInformedConsentVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrInformedConsentFacade extends StrInformedConsentServiceImpl {
+
+    @Autowired
+    @Qualifier("strInformedConsentServiceImpl")
+    private StrInformedConsentServiceImpl strInformedConsentService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strInformedConsent");
+        if(!flag){
+            return;
+        }
+    }
+
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrInformedConsent strInformedConsent=new StrInformedConsent();
+        try {
+            StrInformedConsentVO strInformedConsentVO=(StrInformedConsentVO) MapUtil.mapToObject(entityMap, StrInformedConsentVO.class);
+            BeanUtils.copyProperties(strInformedConsentVO,strInformedConsent);
+            strInformedConsent.setHospitalId(hospitalId);//医院编码
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strInformedConsent)){
+                strInformedConsent.setGmtCreate(new Date());//记录创建时间
+                this.save(strInformedConsent);
+            }else{
+                strInformedConsent.setGmtModified(new Date());//记录修改时间
+                this.update(strInformedConsent,new QueryWrapper<StrInformedConsent>()
+                        .eq("rec_id", strInformedConsent.getRecId())
+                        .eq("hospital_id", strInformedConsent.getHospitalId())
+                        .eq("behospital_code", strInformedConsent.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", strInformedConsent.getRecId(), JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrInformedConsent strInformedConsent){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrInformedConsent>()
+                .eq("rec_id", strInformedConsent.getRecId())
+                .eq("hospital_id", strInformedConsent.getHospitalId())
+                .eq("behospital_code", strInformedConsent.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:知情同意书-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrInformedConsentVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrInformedConsentVO strInformedConsentVO:list) {
+                    if("".equals(strInformedConsentVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strInformedConsentVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strInformedConsentVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrInformedConsent> strInformedConsentList= initData(list);
+                execute(strInformedConsentList);
+
+                if(logSwitch){
+                    strInformedConsentList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-知情同意书-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-知情同意书-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrInformedConsent> initData(List<StrInformedConsentVO> list) throws Exception{
+        List<StrInformedConsent> tList= Lists.newArrayList();
+        for (StrInformedConsentVO s:list) {
+            StrInformedConsent t=new StrInformedConsent();
+            BeanUtils.copyProperties(s,t);
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrInformedConsent> list){
+        List<StrInformedConsent> addE = Lists.newLinkedList();
+        List<StrInformedConsent> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrInformedConsent strInformedConsent = this.getOne(new QueryWrapper<StrInformedConsent>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strInformedConsent != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strInformedConsentService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 202 - 0
src/main/java/com/diagbot/facade/str/BStrLeaveHospitalFacade.java

@@ -0,0 +1,202 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrLeaveHospital;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrLeaveHospitalServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrLeaveHospitalVO;
+import com.diagbot.vo.str.StrLeaveHospitalVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrLeaveHospitalFacade extends StrLeaveHospitalServiceImpl {
+
+    @Autowired
+    @Qualifier("strLeaveHospitalServiceImpl")
+    private StrLeaveHospitalServiceImpl strLeaveHospitalService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //危急值记录
+    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);
+            strLeaveHospital.setHospitalId(hospitalId);//医院编码
+
+            strLeaveHospital.setAuditDate(DateUtil.parseDateTime(strLeaveHospitalVO.getAuditDate()));//审核时间
+            strLeaveHospital.setRecDate(DateUtil.parseDateTime(strLeaveHospitalVO.getRecDate()));//记录时间
+            strLeaveHospital.setBehospitalDate(DateUtil.parseDateTime(strLeaveHospitalVO.getBehospitalDate()));//入院日期
+            strLeaveHospital.setLeaveHospitalDate(DateUtil.parseDateTime(strLeaveHospitalVO.getLeaveHospitalDate()));//出院时间
+            strLeaveHospital.setRecordDate(DateUtil.parseDateTime(strLeaveHospitalVO.getRecordDate()));//病历日期
+
+            strLeaveHospital.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strLeaveHospital)){
+                strLeaveHospital.setGmtCreate(new Date());//记录创建时间
+                this.save(strLeaveHospital);
+            }else{
+                strLeaveHospital.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:出院小结-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrLeaveHospitalVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrLeaveHospitalVO strLeaveHospitalVO:list) {
+                    if("".equals(strLeaveHospitalVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strLeaveHospitalVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strLeaveHospitalVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrLeaveHospital> strLeaveHospitalList= initData(list);
+                execute(strLeaveHospitalList);
+
+                if(logSwitch){
+                    strLeaveHospitalList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-出院小结-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-出院小结-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrLeaveHospital> initData(List<StrLeaveHospitalVO> list) throws Exception{
+        List<StrLeaveHospital> tList=Lists.newArrayList();
+        for (StrLeaveHospitalVO s:list) {
+            StrLeaveHospital t=new StrLeaveHospital();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getBehospitalDate())){
+                t.setBehospitalDate(DateUtil.parseDateTime(s.getBehospitalDate()));//入院日期
+            }
+            if(StringUtil.isNotEmpty(s.getLeaveHospitalDate())){
+                t.setLeaveHospitalDate(DateUtil.parseDateTime(s.getLeaveHospitalDate()));//出院日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.LEAVE_HOSPITAL.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrLeaveHospital> list){
+        List<StrLeaveHospital> addE = Lists.newLinkedList();
+        List<StrLeaveHospital> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrLeaveHospital strLeaveHospital = this.getOne(new QueryWrapper<StrLeaveHospital>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strLeaveHospital != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strLeaveHospitalService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 205 - 0
src/main/java/com/diagbot/facade/str/BStrOperativeFirstRecordFacade.java

@@ -0,0 +1,205 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrOperativeFirstRecord;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrOperativeFirstRecordServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrOperativeFirstRecordVO;
+import com.diagbot.vo.str.StrOperativeFirstRecordVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrOperativeFirstRecordFacade extends StrOperativeFirstRecordServiceImpl {
+
+    @Autowired
+    @Qualifier("strOperativeFirstRecordServiceImpl")
+    private StrOperativeFirstRecordServiceImpl strOperativeFirstRecordService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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");
+
+        if(!flag){
+            return;
+        }
+    }
+
+    //术后首程
+    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);
+            strOperativeFirstRecord.setHospitalId(hospitalId);//医院编码
+
+            strOperativeFirstRecord.setAuditDate(DateUtil.parseDateTime(strOperativeFirstRecordVO.getAuditDate()));//审核时间
+            strOperativeFirstRecord.setRecDate(DateUtil.parseDateTime(strOperativeFirstRecordVO.getRecDate()));//记录时间
+            strOperativeFirstRecord.setOperationDate(DateUtil.parseDateTime(strOperativeFirstRecordVO.getOperationDate()));//手术日期
+            strOperativeFirstRecord.setStartTime(DateUtil.parseDate(strOperativeFirstRecordVO.getStartTime()));//开始时间
+            strOperativeFirstRecord.setEndTime(DateUtil.parseDate(strOperativeFirstRecordVO.getEndTime()));//结束时间
+            strOperativeFirstRecord.setRecordDate(DateUtil.parseDateTime(strOperativeFirstRecordVO.getRecordDate()));//病历日期
+
+            strOperativeFirstRecord.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strOperativeFirstRecord)){
+                strOperativeFirstRecord.setGmtCreate(new Date());//记录创建时间
+                this.save(strOperativeFirstRecord);
+            }else{
+                strOperativeFirstRecord.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:术后首程-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrOperativeFirstRecordVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrOperativeFirstRecordVO strOperativeFirstRecordVO:list) {
+                    if("".equals(strOperativeFirstRecordVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strOperativeFirstRecordVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strOperativeFirstRecordVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrOperativeFirstRecord> strOperativeFirstRecordList= initData(list);
+                execute(strOperativeFirstRecordList);
+
+                if(logSwitch){
+                    strOperativeFirstRecordList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术后首程-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术后首程-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrOperativeFirstRecord> initData(List<StrOperativeFirstRecordVO> list) throws Exception{
+        List<StrOperativeFirstRecord> tList=Lists.newArrayList();
+        for (StrOperativeFirstRecordVO s:list) {
+            StrOperativeFirstRecord t=new StrOperativeFirstRecord();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            if(StringUtil.isNotEmpty(s.getOperationDate())){
+                t.setOperationDate(DateUtil.parseDateTime(s.getOperationDate()));//手术日期
+            }
+            if(StringUtil.isNotEmpty(s.getStartTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getStartTime()));//开始时间
+            }
+            if(StringUtil.isNotEmpty(s.getEndTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getEndTime()));//结束时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.OPERATIVE_FIRST_RECORD.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrOperativeFirstRecord> list){
+        List<StrOperativeFirstRecord> addE = Lists.newLinkedList();
+        List<StrOperativeFirstRecord> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrOperativeFirstRecord strOperativeFirstRecord = this.getOne(new QueryWrapper<StrOperativeFirstRecord>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strOperativeFirstRecord != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strOperativeFirstRecordService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 206 - 0
src/main/java/com/diagbot/facade/str/BStrOperativeNoteFacade.java

@@ -0,0 +1,206 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrOperativeNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrOperativeNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrOperativeNoteVO;
+import com.diagbot.vo.str.StrOperativeNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrOperativeNoteFacade extends StrOperativeNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strOperativeNoteServiceImpl")
+    private StrOperativeNoteServiceImpl strOperativeNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strOperativeNote");
+
+        //Map<String, String> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //手术记录
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrOperativeNote strOperativeNote=new StrOperativeNote();
+        try {
+            AStrOperativeNoteVO strOperativeNoteVO=(AStrOperativeNoteVO) MapUtil.mapToObject(entityMap, AStrOperativeNoteVO.class);
+            BeanUtils.copyProperties(strOperativeNoteVO,strOperativeNote);
+            strOperativeNote.setHospitalId(hospitalId);//医院编码
+
+            strOperativeNote.setAuditDate(DateUtil.parseDateTime(strOperativeNoteVO.getAuditDate()));//审核时间
+            strOperativeNote.setRecDate(DateUtil.parseDateTime(strOperativeNoteVO.getRecDate()));//记录时间
+            strOperativeNote.setOperationDate(DateUtil.parseDateTime(strOperativeNoteVO.getOperationDate()));//手术日期
+            strOperativeNote.setStartTime(DateUtil.parseDate(strOperativeNoteVO.getStartTime()));//开始时间
+            strOperativeNote.setEndTime(DateUtil.parseDate(strOperativeNoteVO.getEndTime()));//结束时间
+            strOperativeNote.setRecordDate(DateUtil.parseDateTime(strOperativeNoteVO.getRecordDate()));//病历日期
+
+            strOperativeNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strOperativeNote)){
+                strOperativeNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strOperativeNote);
+            }else{
+                strOperativeNote.setGmtModified(new Date());//记录修改时间
+                this.update(strOperativeNote,new QueryWrapper<StrOperativeNote>()
+                        .eq("rec_id", strOperativeNote.getRecId())
+                        .eq("hospital_id", strOperativeNote.getHospitalId())
+                        .eq("behospital_code", strOperativeNote.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("手术记录", strOperativeNote.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrOperativeNote strOperativeNote){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrOperativeNote>()
+                .eq("rec_id", strOperativeNote.getRecId())
+                .eq("hospital_id", strOperativeNote.getHospitalId())
+                .eq("behospital_code", strOperativeNote.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:手术记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrOperativeNoteVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrOperativeNoteVO strOperativeNoteVO:list) {
+                    if("".equals(strOperativeNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strOperativeNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strOperativeNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrOperativeNote> strOperativeNoteList= initData(list);
+                execute(strOperativeNoteList);
+
+                if(logSwitch){
+                    strOperativeNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-手术记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-手术记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrOperativeNote> initData(List<StrOperativeNoteVO> list) throws Exception{
+        List<StrOperativeNote> tList=Lists.newArrayList();
+        for (StrOperativeNoteVO s:list) {
+            StrOperativeNote t=new StrOperativeNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getOperationDate())){
+                t.setOperationDate(DateUtil.parseDateTime(s.getOperationDate()));//手术日期
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            if(StringUtil.isNotEmpty(s.getStartTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getStartTime()));//开始时间
+            }
+            if(StringUtil.isNotEmpty(s.getEndTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getEndTime()));//结束时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.OPERATIVE_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrOperativeNote> list){
+        List<StrOperativeNote> addE = Lists.newLinkedList();
+        List<StrOperativeNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrOperativeNote strOperativeNote = this.getOne(new QueryWrapper<StrOperativeNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strOperativeNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strOperativeNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 194 - 0
src/main/java/com/diagbot/facade/str/BStrPeriodConclusionFacade.java

@@ -0,0 +1,194 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrPeriodConclusion;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrPeriodConclusionServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrPeriodConclusionVO;
+import com.diagbot.vo.str.StrPeriodConclusionVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrPeriodConclusionFacade extends StrPeriodConclusionServiceImpl {
+
+    @Autowired
+    @Qualifier("strPeriodConclusionServiceImpl")
+    private StrPeriodConclusionServiceImpl strPeriodConclusionService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strPeriodConclusion.setHospitalId(hospitalId);//医院编码
+
+            strPeriodConclusion.setAuditDate(DateUtil.parseDateTime(strPeriodConclusionVO.getAuditDate()));//审核时间
+            strPeriodConclusion.setRecDate(DateUtil.parseDateTime(strPeriodConclusionVO.getRecDate()));//记录时间
+            strPeriodConclusion.setRecordDate(DateUtil.parseDateTime(strPeriodConclusionVO.getRecordDate()));//病历日期
+
+            strPeriodConclusion.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strPeriodConclusion)){
+                strPeriodConclusion.setGmtCreate(new Date());//记录创建时间
+                this.save(strPeriodConclusion);
+            }else{
+                strPeriodConclusion.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:阶段小结-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrPeriodConclusionVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrPeriodConclusionVO strPeriodConclusionVO:list) {
+                    if("".equals(strPeriodConclusionVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strPeriodConclusionVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strPeriodConclusionVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrPeriodConclusion> strPeriodConclusionList= initData(list);
+                execute(strPeriodConclusionList);
+
+                if(logSwitch){
+                    strPeriodConclusionList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-阶段小结-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-阶段小结-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrPeriodConclusion> initData(List<StrPeriodConclusionVO> list) throws Exception{
+        List<StrPeriodConclusion> tList=Lists.newArrayList();
+        for (StrPeriodConclusionVO s:list) {
+            StrPeriodConclusion t=new StrPeriodConclusion();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.PERIOD_CONCLUSION.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrPeriodConclusion> list){
+        List<StrPeriodConclusion> addE = Lists.newLinkedList();
+        List<StrPeriodConclusion> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrPeriodConclusion strPeriodConclusion = this.getOne(new QueryWrapper<StrPeriodConclusion>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strPeriodConclusion != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strPeriodConclusionService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+
+}

+ 198 - 0
src/main/java/com/diagbot/facade/str/BStrPreoperativeDiscussionFacade.java

@@ -0,0 +1,198 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrPreoperativeDiscussion;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrPreoperativeDiscussionServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrPreoperativeDiscussionVO;
+import com.diagbot.vo.str.StrPreoperativeDiscussionVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrPreoperativeDiscussionFacade extends StrPreoperativeDiscussionServiceImpl {
+
+    @Autowired
+    @Qualifier("strPreoperativeDiscussionServiceImpl")
+    private StrPreoperativeDiscussionServiceImpl strPreoperativeDiscussionService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //入院记录
+    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);
+            strPreoperativeDiscussion.setHospitalId(hospitalId);//医院编码
+
+            strPreoperativeDiscussion.setAuditDate(DateUtil.parseDateTime(strPreoperativeDiscussionVO.getAuditDate()));//审核时间
+            strPreoperativeDiscussion.setRecDate(DateUtil.parseDateTime(strPreoperativeDiscussionVO.getRecDate()));//记录时间
+            strPreoperativeDiscussion.setDiscussTime(DateUtil.parseDateTime(strPreoperativeDiscussionVO.getDiscussTime()));//讨论时间
+            strPreoperativeDiscussion.setRecordDate(DateUtil.parseDateTime(strPreoperativeDiscussionVO.getRecordDate()));//病历日期
+
+            strPreoperativeDiscussion.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strPreoperativeDiscussion)){
+                strPreoperativeDiscussion.setGmtCreate(new Date());//记录创建时间
+                this.save(strPreoperativeDiscussion);
+            }else{
+                strPreoperativeDiscussion.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:术前讨论小结-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrPreoperativeDiscussionVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrPreoperativeDiscussionVO strPreoperativeDiscussionVO:list) {
+                    if("".equals(strPreoperativeDiscussionVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strPreoperativeDiscussionVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strPreoperativeDiscussionVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrPreoperativeDiscussion> strPreoperativeDiscussionList= initData(list);
+                execute(strPreoperativeDiscussionList);
+
+                if(logSwitch){
+                    strPreoperativeDiscussionList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术前讨论小结-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-术前讨论小结-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrPreoperativeDiscussion> initData(List<StrPreoperativeDiscussionVO> list) throws Exception{
+        List<StrPreoperativeDiscussion> tList=Lists.newArrayList();
+        for (StrPreoperativeDiscussionVO s:list) {
+            StrPreoperativeDiscussion t=new StrPreoperativeDiscussion();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            if(StringUtil.isNotEmpty(s.getDiscussTime())){
+                t.setDiscussTime(DateUtil.parseDateTime(s.getDiscussTime()));//讨论时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.PREOPERATIVE_DISCUSSION.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrPreoperativeDiscussion> list){
+        List<StrPreoperativeDiscussion> addE = Lists.newLinkedList();
+        List<StrPreoperativeDiscussion> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrPreoperativeDiscussion strPreoperativeDiscussion = this.getOne(new QueryWrapper<StrPreoperativeDiscussion>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strPreoperativeDiscussion != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strPreoperativeDiscussionService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 201 - 0
src/main/java/com/diagbot/facade/str/BStrRescueNoteFacade.java

@@ -0,0 +1,201 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrRescueNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrRescueNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrRescueNoteVO;
+import com.diagbot.vo.str.StrRescueNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrRescueNoteFacade extends StrRescueNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strRescueNoteServiceImpl")
+    private StrRescueNoteServiceImpl strRescueNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strRescueNote.setHospitalId(hospitalId);//医院编码
+
+            strRescueNote.setAuditDate(DateUtil.parseDateTime(strRescueNoteVO.getAuditDate()));//审核时间
+            strRescueNote.setRecDate(DateUtil.parseDateTime(strRescueNoteVO.getRecDate()));//记录时间
+            strRescueNote.setStartTime(DateUtil.parseDateTime(strRescueNoteVO.getStartTime()));//开始时间
+            strRescueNote.setEndTime(DateUtil.parseDate(strRescueNoteVO.getEndTime()));//结束时间
+            strRescueNote.setRecordDate(DateUtil.parseDateTime(strRescueNoteVO.getRecordDate()));//病历日期
+
+            strRescueNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strRescueNote)){
+                strRescueNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strRescueNote);
+            }else{
+                strRescueNote.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:抢救记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrRescueNoteVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrRescueNoteVO strRescueNoteVO:list) {
+                    if("".equals(strRescueNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strRescueNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strRescueNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrRescueNote> strRescueNoteList= initData(list);
+                execute(strRescueNoteList);
+
+                if(logSwitch){
+                    strRescueNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-抢救记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-抢救记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrRescueNote> initData(List<StrRescueNoteVO> list) throws Exception{
+        List<StrRescueNote> tList=Lists.newArrayList();
+        for (StrRescueNoteVO s:list) {
+            StrRescueNote t=new StrRescueNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            if(StringUtil.isNotEmpty(s.getStartTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getStartTime()));//开始时间
+            }
+            if(StringUtil.isNotEmpty(s.getEndTime())){
+                t.setEndTime(DateUtil.parseDateTime(s.getEndTime()));//结束时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.RESCUE_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrRescueNote> list){
+        List<StrRescueNote> addE = Lists.newLinkedList();
+        List<StrRescueNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrRescueNote strRescueNote = this.getOne(new QueryWrapper<StrRescueNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strRescueNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strRescueNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 168 - 0
src/main/java/com/diagbot/facade/str/BStrTalkInformFacade.java

@@ -0,0 +1,168 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrTalkInform;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrTalkInformServiceImpl;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.vo.str.StrTalkInformVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrTalkInformFacade extends StrTalkInformServiceImpl {
+    @Autowired
+    @Qualifier("strTalkInformServiceImpl")
+    private StrTalkInformServiceImpl strTalkInformService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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,"strTalkInform");
+        if(!flag){
+            return;
+        }
+    }
+
+    public void dealData(String columnMap,Map<String, Object> entityMap,Long hospitalId){
+        StrTalkInform strTalkInform=new StrTalkInform();
+        try {
+            StrTalkInformVO strTalkInformVO=(StrTalkInformVO) MapUtil.mapToObject(entityMap, StrTalkInformVO.class);
+            BeanUtils.copyProperties(strTalkInformVO,strTalkInform);
+            strTalkInform.setHospitalId(hospitalId);//医院编码
+
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strTalkInform)){
+                strTalkInform.setGmtCreate(new Date());//记录创建时间
+                this.save(strTalkInform);
+            }else{
+                strTalkInform.setGmtModified(new Date());//记录修改时间
+                this.update(strTalkInform,new QueryWrapper<StrTalkInform>()
+                        .eq("rec_id", strTalkInform.getRecId())
+                        .eq("hospital_id", strTalkInform.getHospitalId())
+                        .eq("behospital_code", strTalkInform.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("病重通知单", strTalkInform.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    public Boolean isExist(StrTalkInform strTalkInform){
+        Boolean flag=true;
+        int count = this.baseMapper.selectCount(new QueryWrapper<StrTalkInform>()
+                .eq("rec_id", strTalkInform.getRecId())
+                .eq("hospital_id", strTalkInform.getHospitalId())
+                .eq("behospital_code", strTalkInform.getBehospitalCode()));
+        if(count>0){
+            flag=false;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:告知书记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrTalkInformVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrTalkInformVO strTalkInformVO:list) {
+                    if("".equals(strTalkInformVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strTalkInformVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strTalkInformVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrTalkInform> strTalkInformList= initData(list);
+                execute(strTalkInformList);
+
+                if(logSwitch){
+                    strTalkInformList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-告知书记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-告知书记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrTalkInform> initData(List<StrTalkInformVO> list) throws Exception{
+        List<StrTalkInform> tList= Lists.newArrayList();
+        for (StrTalkInformVO s:list) {
+            StrTalkInform t=new StrTalkInform();
+            BeanUtils.copyProperties(s,t);
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrTalkInform> list){
+        List<StrTalkInform> addE = Lists.newLinkedList();
+        List<StrTalkInform> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrTalkInform strTalkInform = this.getOne(new QueryWrapper<StrTalkInform>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strTalkInform != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strTalkInformService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 197 - 0
src/main/java/com/diagbot/facade/str/BStrTransferInNoteFacade.java

@@ -0,0 +1,197 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrTransferInNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrTransferInNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrTransferInNoteVO;
+import com.diagbot.vo.str.StrTransferInNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrTransferInNoteFacade extends StrTransferInNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strTransferInNoteServiceImpl")
+    private StrTransferInNoteServiceImpl strTransferInNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strTransferInNote.setHospitalId(hospitalId);//医院编码
+            strTransferInNote.setTransferInDate(DateUtil.parseDateTime(strTransferInNoteVO.getTransferInDate()));
+            strTransferInNote.setAuditDate(DateUtil.parseDateTime(strTransferInNoteVO.getAuditDate()));//审核时间
+            strTransferInNote.setRecDate(DateUtil.parseDateTime(strTransferInNoteVO.getRecDate()));//记录时间
+            strTransferInNote.setRecordDate(DateUtil.parseDateTime(strTransferInNoteVO.getRecordDate()));//病历日期
+
+            strTransferInNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strTransferInNote)){
+                strTransferInNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strTransferInNote);
+            }else{
+                strTransferInNote.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:转入记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrTransferInNoteVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrTransferInNoteVO strTransferInNoteVO:list) {
+                    if("".equals(strTransferInNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strTransferInNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strTransferInNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrTransferInNote> strTransferInNoteList= initData(list);
+                execute(strTransferInNoteList);
+
+                if(logSwitch){
+                    strTransferInNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转入记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转入记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrTransferInNote> initData(List<StrTransferInNoteVO> list) throws Exception{
+        List<StrTransferInNote> tList=Lists.newArrayList();
+        for (StrTransferInNoteVO s:list) {
+            StrTransferInNote t=new StrTransferInNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getTransferInDate())){
+                t.setTransferInDate(DateUtil.parseDateTime(s.getTransferInDate()));//转入日期
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.TRANSFER_IN_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrTransferInNote> list){
+        List<StrTransferInNote> addE = Lists.newLinkedList();
+        List<StrTransferInNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrTransferInNote strTransferInNote = this.getOne(new QueryWrapper<StrTransferInNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strTransferInNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strTransferInNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+
+}

+ 194 - 0
src/main/java/com/diagbot/facade/str/BStrTransferOutNoteFacade.java

@@ -0,0 +1,194 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrTransferOutNote;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrTransferOutNoteServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrTransferOutNoteVO;
+import com.diagbot.vo.str.StrTransferOutNoteVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrTransferOutNoteFacade extends StrTransferOutNoteServiceImpl {
+
+    @Autowired
+    @Qualifier("strTransferOutNoteServiceImpl")
+    private StrTransferOutNoteServiceImpl strTransferOutNoteService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    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);
+            strTransferOutNote.setHospitalId(hospitalId);//医院编码
+            strTransferOutNote.setTransferInDate(DateUtil.parseDateTime(strTransferOutNoteVO.getTransferInDate()));
+            strTransferOutNote.setAuditDate(DateUtil.parseDateTime(strTransferOutNoteVO.getAuditDate()));//审核时间
+            strTransferOutNote.setRecDate(DateUtil.parseDateTime(strTransferOutNoteVO.getRecDate()));//记录时间
+            strTransferOutNote.setRecordDate(DateUtil.parseDateTime(strTransferOutNoteVO.getRecordDate()));//病历日期
+
+            strTransferOutNote.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strTransferOutNote)){
+                strTransferOutNote.setGmtCreate(new Date());//记录创建时间
+                this.save(strTransferOutNote);
+            }else{
+                strTransferOutNote.setGmtModified(new Date());//记录修改时间
+                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());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:转出记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrTransferOutNoteVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrTransferOutNoteVO strTransferOutNoteVO:list) {
+                    if("".equals(strTransferOutNoteVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strTransferOutNoteVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strTransferOutNoteVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrTransferOutNote> strTransferOutNoteList= initData(list);
+                execute(strTransferOutNoteList);
+                if(logSwitch){
+                    strTransferOutNoteList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转出记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-转出记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrTransferOutNote> initData(List<StrTransferOutNoteVO> list) throws Exception{
+        List<StrTransferOutNote> tList=Lists.newArrayList();
+        for (StrTransferOutNoteVO s:list) {
+            StrTransferOutNote t=new StrTransferOutNote();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getTransferInDate())){
+                t.setTransferInDate(DateUtil.parseDateTime(s.getTransferInDate()));//转入日期
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.TRANSFER_OUT_NOTE.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            //t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrTransferOutNote> list){
+        List<StrTransferOutNote> addE = Lists.newLinkedList();
+        List<StrTransferOutNote> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrTransferOutNote strTransferOutNote = this.getOne(new QueryWrapper<StrTransferOutNote>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strTransferOutNote != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strTransferOutNoteService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 198 - 0
src/main/java/com/diagbot/facade/str/BStrWardRecordFacade.java

@@ -0,0 +1,198 @@
+package com.diagbot.facade.str;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.data.ColumnZhAndChDTO;
+import com.diagbot.entity.StrWardRecord;
+import com.diagbot.enums.CacheKeyEnum;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.data.AMedAbnormalInfoFacade;
+import com.diagbot.facade.data.ColumnFacade;
+import com.diagbot.service.impl.StrWardRecordServiceImpl;
+import com.diagbot.util.DateUtil;
+import com.diagbot.util.EntityUtil;
+import com.diagbot.util.MapUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.data.AStrWardRecordVO;
+import com.diagbot.vo.str.StrWardRecordVO;
+import com.google.common.collect.Lists;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class BStrWardRecordFacade extends StrWardRecordServiceImpl {
+
+    @Autowired
+    @Qualifier("strWardRecordServiceImpl")
+    private StrWardRecordServiceImpl strWardRecordService;
+    @Autowired
+    private ColumnFacade columnFacade;
+    @Autowired
+    private AMedAbnormalInfoFacade aMedAbnormalInfoFacade;
+    @Value("${log_switch.enable}")
+    private boolean logSwitch;
+
+    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> map=columnFacade.getColumn("strConsultationNote");
+        if(!flag){
+            return;
+        }
+    }
+
+    //查房记录
+    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);
+            strWardRecord.setHospitalId(hospitalId);//医院编码
+
+            strWardRecord.setAuditDate(DateUtil.parseDateTime(strWardRecordVO.getAuditDate()));//审核时间
+            strWardRecord.setRecDate(DateUtil.parseDateTime(strWardRecordVO.getRecDate()));//记录时间
+            strWardRecord.setWardDate(DateUtil.parseDateTime(strWardRecordVO.getWardDate()));//查房日期
+            strWardRecord.setRecordDate(DateUtil.parseDateTime(strWardRecordVO.getRecordDate()));//病历日期
+
+            strWardRecord.setWholeData(columnMap);
+            //判断数据库中是否存在,不存在insert
+            if(isExist(strWardRecord)){
+                strWardRecord.setGmtCreate(new Date());//记录创建时间
+                this.save(strWardRecord);
+            }else{
+                strWardRecord.setGmtModified(new Date());//记录修改时间
+                this.update(strWardRecord,new QueryWrapper<StrWardRecord>()
+                        .eq("rec_id", strWardRecord.getRecId())
+                        .eq("hospital_id", strWardRecord.getHospitalId())
+                        .eq("behospital_code", strWardRecord.getBehospitalCode()));
+            }
+
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            aMedAbnormalInfoFacade.saveAbnormalInfo("查房记录", strWardRecord.getRecId(),JSON.toJSONString(entityMap),"",e.getMessage());
+        }
+
+    }
+
+    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;
+        }
+        return flag;
+    }
+
+    /**
+     * @Description:查房记录-结构化-独立入口
+     * @Author:liuqq
+     * @time: ${DATE} ${TIME}
+     **/
+    public RespDTO execDealData(List<StrWardRecordVO> list){
+        try{
+            if(list!=null && list.size()>0){
+                //循环验证数据有效性
+                for (StrWardRecordVO strWardRecordVO:list) {
+                    if("".equals(strWardRecordVO.getRecId())) {
+                        return RespDTO.onError("请输入记录编号!");
+                    }else if(strWardRecordVO.getHospitalId()==null){
+                        return RespDTO.onError("请输入医院编码!");
+                    }else if("".equals(strWardRecordVO.getBehospitalCode())){
+                        return RespDTO.onError("请输入病人住院编码!");
+                    }
+                }
+                //初始、格式化数据
+                List<StrWardRecord> strWardRecordList= initData(list);
+                execute(strWardRecordList);
+
+                if(logSwitch){
+                    strWardRecordList.forEach(s->{
+                        aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-查房记录-正常", s.getRecId(), JSON.toJSONString(s), "", "");
+                    });
+                }
+                return RespDTO.onSuc("操作正常!");
+            }else{
+                return RespDTO.onError("未接收到数据!");
+            }
+        }catch (Exception e){
+            log.error(e.getMessage(),e);
+            if(list!=null && list.size()>0) {
+                list.forEach(s->{
+                    aMedAbnormalInfoFacade.saveAbnormalInfo("结构化-查房记录-异常", s.getRecId(), JSON.toJSONString(list), "", e.getMessage());
+                });
+            }
+            return RespDTO.onError("数据处理异常,详情查看日志表");
+        }
+    }
+
+    private List<StrWardRecord> initData(List<StrWardRecordVO> list) throws Exception{
+        List<StrWardRecord> tList=Lists.newArrayList();
+        for (StrWardRecordVO s:list) {
+            StrWardRecord t=new StrWardRecord();
+            BeanUtils.copyProperties(s,t);
+            if(StringUtil.isNotEmpty(s.getRecordDate())){
+                t.setRecordDate(DateUtil.parseDateTime(s.getRecordDate()));//病历日期
+            }
+            if(StringUtil.isNotEmpty(s.getRecDate())){
+                t.setRecDate(DateUtil.parseDateTime(s.getRecDate()));//记录时间
+            }
+            if(StringUtil.isNotEmpty(s.getWardDate())){
+                t.setWardDate(DateUtil.parseDateTime(s.getWardDate()));//查房日期
+            }
+            if(StringUtil.isNotEmpty(s.getAuditDate())){
+                t.setAuditDate(DateUtil.parseDateTime(s.getAuditDate()));//审核时间
+            }
+            Map<String, String> columnMap=columnFacade.getColumn(CacheKeyEnum.WARD_RECORD.getName());
+            Map<String, Object> entityMap=MapUtil.objectToMap(s);
+            Map<String, Object> wholeMap=MapUtil.objcetKeyConvert(columnMap,entityMap);
+            t.setWholeData(JSON.toJSONString(wholeMap));
+            tList.add(t);
+        }
+        return tList;
+    }
+
+    public void execute(List<StrWardRecord> list){
+        List<StrWardRecord> addE = Lists.newLinkedList();
+        List<StrWardRecord> updateE = Lists.newLinkedList();
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(s -> {
+                StrWardRecord strWardRecord = this.getOne(new QueryWrapper<StrWardRecord>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("rec_id", s.getRecId())
+                        .eq("hospital_id", s.getHospitalId())
+                        .eq("behospital_code",s.getBehospitalCode()), false);
+                if (strWardRecord != null) {
+                    s.setGmtModified(new Date());
+                    updateE.add(s);
+                } else {
+                    s.setGmtCreate(new Date());
+                    addE.add(s);
+                }
+            });
+        }
+        if(addE.size()>0){
+            strWardRecordService.saveBatch(addE);
+        }
+        if(updateE.size()>0){
+            this.baseMapper.updateBatchByKey(updateE);
+        }
+    }
+}

+ 272 - 0
src/main/java/com/diagbot/web/DataStrController.java

@@ -0,0 +1,272 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.str.*;
+import com.diagbot.vo.str.*;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/qc/data_str")
+@Api(value = "对接接口API-结构化", tags = { "对接接口API-结构化" })
+public class DataStrController {
+
+    @Autowired
+    private BStrAdmissionNoteFacade bStrAdmissionNoteFacade;
+
+    @Autowired
+    private BStrBloodResultFacade bStrBloodResultFacade;
+
+    @Autowired
+    private BStrBloodTransfusionFacade bStrBloodTransfusionFacade;
+
+    @Autowired
+    private BStrConsultationApplyFacade bStrConsultationApplyFacade;
+
+    @Autowired
+    private BStrCrisisNoteFacade bStrCrisisNoteFacade;
+
+    @Autowired
+    private BStrConsultationRecordFacade bStrConsultationRecordFacade;
+
+    @Autowired
+    private BStrConsultationResultFacade bStrConsultationResultFacade;
+
+    @Autowired
+    private BStrConsultationNoteFacade bStrConsultationNoteFacade;
+
+    @Autowired
+    private BStrFirstRecordFacade bStrFirstRecordFacade;
+
+    @Autowired
+    private BStrDifficultCaseFacade bStrDifficultCaseFacade;
+
+    @Autowired
+    private BStrDeathDiscussionFacade bStrDeathDiscussionFacade;
+
+    @Autowired
+    private BStrDeathNoteFacade bStrDeathNoteFacade;
+
+    @Autowired
+    private BStrOperativeFirstRecordFacade bStrOperativeFirstRecordFacade;
+
+    @Autowired
+    private BStrLeaveHospitalFacade bStrLeaveHospitalFacade;
+
+    @Autowired
+    private BStrIllCriticallyFacade bStrIllCriticallyFacade;
+
+    @Autowired
+    private BStrIllSeriouslFacade bStrIllSeriouslFacade;
+
+    @Autowired
+    private BStrPreoperativeDiscussionFacade bStrPreoperativeDiscussionFacade;
+
+    @Autowired
+    private BStrPeriodConclusionFacade bStrPeriodConclusionFacade;
+
+    @Autowired
+    private BStrRescueNoteFacade bStrRescueNoteFacade;
+
+    @Autowired
+    private BStrTransferInNoteFacade bStrTransferInNoteFacade;
+
+    @Autowired
+    private BStrTransferOutNoteFacade bStrTransferOutNoteFacade;
+
+    @Autowired
+    private BStrWardRecordFacade bStrWardRecordFacade;
+
+    @Autowired
+    private BStrOperativeNoteFacade bStrOperativeNoteFacade;
+
+    @Autowired
+    private BStrTalkInformFacade bStrTalkInformFacade;
+
+    @Autowired
+    private BStrInformedConsentFacade bStrInformedConsentFacade;
+
+    @ApiOperation(value = "入院记录")
+    @PostMapping("/sendAdmissionNote")
+    @SysLogger("sendAdmissionNote")
+    public RespDTO sendAdmissionNote(@RequestBody List<StrAdmissionNoteVO> list){
+        return bStrAdmissionNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "输血后效果评价")
+    @PostMapping("/sendBloodResult")
+    @SysLogger("sendBloodResult")
+    public RespDTO sendBloodResult(@RequestBody List<StrBloodResultVO> list){
+        return bStrBloodResultFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "输血/血制品病程记录")
+    @PostMapping("/sendBloodTransfusion")
+    @SysLogger("sendBloodTransfusion")
+    public RespDTO sendBloodTransfusion(@RequestBody List<StrBloodTransfusionVO> list){
+        return bStrBloodTransfusionFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "会诊申请单")
+    @PostMapping("/sendConsultationApply")
+    @SysLogger("sendConsultationApply")
+    public RespDTO sendConsultationApply(@RequestBody List<StrConsultationApplyVO> list){
+        return bStrConsultationApplyFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "会诊单(申请和结果)")
+    @PostMapping("/sendConsultationNote")
+    @SysLogger("sendConsultationNote")
+    public RespDTO sendConsultationNote(@RequestBody List<StrConsultationNoteVO> list){
+        return bStrConsultationNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "会诊记录")
+    @PostMapping("/sendConsultationRecord")
+    @SysLogger("sendConsultationRecord")
+    public RespDTO sendConsultationRecord(@RequestBody List<StrConsultationRecordVO> list){
+        return bStrConsultationRecordFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "会诊结果单")
+    @PostMapping("/sendConsultationResult")
+    @SysLogger("sendConsultationResult")
+    public RespDTO sendConsultationResult(@RequestBody List<StrConsultationResultVO> list){
+        return bStrConsultationResultFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "危急值记录")
+    @PostMapping("/sendCrisisNote")
+    @SysLogger("sendCrisisNote")
+    public RespDTO sendCrisisNote(@RequestBody List<StrCrisisNoteVO> list){
+        return bStrCrisisNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "死亡病例讨论记录")
+    @PostMapping("/sendDeathDiscussion")
+    @SysLogger("sendDeathDiscussion")
+    public RespDTO sendDeathDiscussion(@RequestBody List<StrDeathDiscussionVO> list){
+        return bStrDeathDiscussionFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "死亡记录")
+    @PostMapping("/sendDeathNote")
+    @SysLogger("sendDeathNote")
+    public RespDTO sendDeathNote(@RequestBody List<StrDeathNoteVO> list){
+        return bStrDeathNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "疑难病例讨论记录")
+    @PostMapping("/sendDifficultCase")
+    @SysLogger("sendDifficultCase")
+    public RespDTO sendDifficultCase(@RequestBody List<StrDifficultCaseVO> list){
+        return bStrDifficultCaseFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "首次病程录")
+    @PostMapping("/sendFirstRecord")
+    @SysLogger("sendFirstRecord")
+    public RespDTO sendFirstRecord(@RequestBody List<StrFirstRecordVO> list){
+        return bStrFirstRecordFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "病危通知单")
+    @PostMapping("/sendIllCritically")
+    @SysLogger("sendIllCritically")
+    public RespDTO sendIllCritically(@RequestBody List<StrIllCriticallyVO> list){
+        return bStrIllCriticallyFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "病重通知单")
+    @PostMapping("/sendIllSeriousl")
+    @SysLogger("sendIllSeriousl")
+    public RespDTO sendIllSeriousl(@RequestBody List<StrIllSeriouslVO> list){
+        return bStrIllSeriouslFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "出院小结")
+    @PostMapping("/sendLeaveHospital")
+    @SysLogger("sendLeaveHospital")
+    public RespDTO sendLeaveHospital(@RequestBody List<StrLeaveHospitalVO> list){
+        return bStrLeaveHospitalFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "术后首程")
+    @PostMapping("/sendOperativeFirstRecord")
+    @SysLogger("sendOperativeFirstRecord")
+    public RespDTO sendOperativeFirstRecord(@RequestBody List<StrOperativeFirstRecordVO> list){
+        return bStrOperativeFirstRecordFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "手术记录")
+    @PostMapping("/sendOperativeNote")
+    @SysLogger("sendOperativeNote")
+    public RespDTO sendOperativeNote(@RequestBody List<StrOperativeNoteVO> list){
+        return bStrOperativeNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "查房记录")
+    @PostMapping("/sendWardRecord")
+    @SysLogger("sendWardRecord")
+    public RespDTO sendWardRecord(@RequestBody List<StrWardRecordVO> list){
+        return bStrWardRecordFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "转出记录")
+    @PostMapping("/sendTransferOutNote")
+    @SysLogger("sendTransferOutNote")
+    public RespDTO sendTransferOutNote(@RequestBody List<StrTransferOutNoteVO> list){
+        return bStrTransferOutNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "转入记录")
+    @PostMapping("/sendTransferInNote")
+    @SysLogger("sendTransferInNote")
+    public RespDTO sendTransferInNote(@RequestBody List<StrTransferInNoteVO> list){
+        return bStrTransferInNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "抢救记录")
+    @PostMapping("/sendRescueNote")
+    @SysLogger("sendRescueNote")
+    public RespDTO sendRescueNote(@RequestBody List<StrRescueNoteVO> list){
+        return bStrRescueNoteFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "阶段小结")
+    @PostMapping("/sendPeriodConclusion")
+    @SysLogger("sendPeriodConclusion")
+    public RespDTO sendPeriodConclusion(@RequestBody List<StrPeriodConclusionVO> list){
+        return bStrPeriodConclusionFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "术前讨论小结")
+    @PostMapping("/sendPreoperativeDiscussion")
+    @SysLogger("sendPreoperativeDiscussion")
+    public RespDTO sendPreoperativeDiscussion(@RequestBody List<StrPreoperativeDiscussionVO> list){
+        return bStrPreoperativeDiscussionFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "告知书记录")
+    @PostMapping("/sendTalkInform")
+    @SysLogger("sendTalkInform")
+    public RespDTO sendTalkInform(@RequestBody List<StrTalkInformVO> list){
+        return bStrTalkInformFacade.execDealData(list);
+    }
+
+    @ApiOperation(value = "知情同意书")
+    @PostMapping("/sendInformedConsent")
+    @SysLogger("sendInformedConsent")
+    public RespDTO sendInformedConsent(@RequestBody List<StrInformedConsentVO> list){
+        return bStrInformedConsentFacade.execDealData(list);
+    }
+
+}

+ 4 - 0
src/main/resources/application-dev.yml

@@ -176,3 +176,7 @@ xml_analyse:
 #函数初始化modeId开关
 initmodeid:
   enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: true

+ 4 - 0
src/main/resources/application-local.yml

@@ -176,3 +176,7 @@ xml_analyse:
 #函数初始化modeId开关
 initmodeid:
   enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: true

+ 4 - 0
src/main/resources/application-pre.yml

@@ -176,3 +176,7 @@ xml_analyse:
 #函数初始化modeId开关
 initmodeid:
   enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: true

+ 4 - 0
src/main/resources/application-pro.yml

@@ -176,3 +176,7 @@ xml_analyse:
 #函数初始化modeId开关
 initmodeid:
   enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: true

+ 4 - 0
src/main/resources/application-test.yml

@@ -176,3 +176,7 @@ xml_analyse:
 #函数初始化modeId开关
 initmodeid:
   enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: true

+ 195 - 95
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -41,13 +41,7 @@
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
         SELECT * FROM (
-        select distinct  a.*,
-        ifnull(b.level,'未评分') as `level`,
-        b.grade_type,
-        b.score_res,
-        b.gmt_create as grade_time,
-        CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') )as age,
-        e.score_res as score_bn,
+        select   t.*,
         CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
         CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
         g.check_type AS ch_type,
@@ -56,13 +50,9 @@
         h.check_name AS mr_name,
         g.check_time AS ch_time,
         h.check_time AS mr_time
-        from med_behospital_info a
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
-        ON a.behospital_code = g.behospital_code
-        AND a.hospital_id = g.hospital_id
-        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
-        ON a.behospital_code = h.behospital_code
-        AND a.hospital_id = h.hospital_id
+        from (
+        select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
+        grade_time,IF(c.age is null, null,CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') )as age,e.score_res as score_bn from med_behospital_info a
         LEFT JOIN med_qcresult_info b
         on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
         left join med_home_page c
@@ -71,55 +61,61 @@
         on  a.behospital_code = e.behospital_code
         AND e.is_deleted = 'N'
         and e.cases_id = 243
-        where
-        a.is_deleted = 'N'
+        ) t
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
+        ON t.behospital_code = g.behospital_code
+        AND t.hospital_id = g.hospital_id
+        LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
+        ON t.behospital_code = h.behospital_code
+        AND t.hospital_id = h.hospital_id
+        where t.is_deleted = 'N'
         <if test="diagnose != null and diagnose != ''">
-            AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+            AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
         </if>
         <if test="deptName != null and deptName != ''">
-            and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
+            and t.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
         </if>
         <if test="doctorName != null and doctorName != ''">
             and CONCAT(
-            IFNULL(a.doctor_name,''),IFNULL(a.beh_doctor_name,''),IFNULL(a.director_doctor_name,''))
+            IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,''))
             like CONCAT('%',#{doctorName},'%')
         </if>
         <if test="name != null and name != ''">
-            and a.name like CONCAT('%',#{name},'%')
+            and t.name like CONCAT('%',#{name},'%')
         </if>
         <if test="doctorCode != null and doctorCode != ''">
-            and (a.doctor_id = #{doctorCode}
-            or a.beh_doctor_id = #{doctorCode}
-            or a.director_doctor_id = #{doctorCode})
+            and (t.doctor_id = #{doctorCode}
+            or t.beh_doctor_id = #{doctorCode}
+            or t.director_doctor_id = #{doctorCode})
         </if>
         <if test="fileCode != null and fileCode != ''">
-            and a.file_code like CONCAT('%',#{fileCode},'%')
+            and t.file_code like CONCAT('%',#{fileCode},'%')
         </if>
         <if test="hospitalId != null">
-            and a.hospital_id = #{hospitalId}
+            and t.hospital_id = #{hospitalId}
         </if>
         <if test="behospitalCode != null and behospitalCode != ''">
-            and a.behospital_code like CONCAT('%',#{behospitalCode},'%')
+            and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
         </if>
         <if test="behosDateStart != null">
-            <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
+            <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
         </if>
         <if test="behosDateEnd != null">
-            <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
+            <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
         </if>
         <if test="leaveHosDateStart != null">
-            <![CDATA[ and a.leave_hospital_date >= #{leaveHosDateStart}]]>
+            <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
         </if>
         <if test="leaveHosDateEnd != null">
-            <![CDATA[ and a.leave_hospital_date < #{leaveHosDateEnd}]]>
+            <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
         </if>
         <if test="level != null and level != ''">
-            and b.level = #{level}
+            and t.level = #{level}
         </if>
         <if test="isPlacefile != null and isPlacefile != ''">
-            and a.is_placefile = #{isPlacefile}
+            and t.is_placefile = #{isPlacefile}
         </if>
-        and a.qc_type_id != 0) p
+        and t.qc_type_id != 0) p
         where p.is_deleted="N"
         <if test="checkStatus != null ">
             and p.check_status = #{checkStatus}
@@ -3460,7 +3456,7 @@
         <result column="avgScore" property="avgScore"/>
         <collection property="excelBehospitalDTOS"
                     ofType="com.diagbot.dto.ExportExcelBehospitalDTO">
-            <result column="behDoctorName" property="behDoctorName"/>
+            <result column="doctorName" property="doctorName"/>
             <result column="patName" property="patName"/>
             <result column="behospitalCode" property="behospitalCode"/>
             <result column="behospitalDate" property="behospitalDate"/>
@@ -3481,7 +3477,7 @@
     <select id="exportExcel" resultMap="ExportExcelMap">
         SELECT DISTINCT
         t1.beh_dept_name AS behDeptName,
-        t1.beh_doctor_name AS behDoctorName,
+        t1.beh_doctor_name AS doctorName,
         t1.`name` AS patName,
         t1.behospital_code AS behospitalCode,
         t1.behospital_date AS behospitalDate,
@@ -3530,7 +3526,7 @@
         SELECT
         t1.behDeptId,
         t1.behDeptName,
-        t1.behDoctorName,
+        t1.doctorName,
         t1.patName,
         t1.behospitalCode,
         t1.hospitalId,
@@ -3549,7 +3545,7 @@
         CONCAT(
         ( CASE WHEN a.director_doctor_name IS NOT NULL AND a.director_doctor_name != '' THEN concat( a.director_doctor_name, '\n' ) ELSE '' END ),
         a.doctor_name
-        ) AS behDoctorName,
+        ) AS doctorName,
         a.`name` AS patName,
         a.behospital_code AS behospitalCode,
         a.behospital_date AS behospitalDate,
@@ -3756,7 +3752,7 @@
         SELECT
         t1.behDeptId,
         t1.behDeptName,
-        t1.behDoctorName,
+        t1.doctorName,
         t1.patName,
         t1.behospitalCode,
         t1.hospitalId,
@@ -3772,7 +3768,7 @@
         FROM
         (
         SELECT
-        a.doctor_name AS behDoctorName,
+        a.doctor_name AS doctorName,
         a.`name` AS patName,
         a.behospital_code AS behospitalCode,
         a.hospital_id AS hospital_id,
@@ -3986,7 +3982,7 @@
         SELECT
         t1.behDeptId,
         t1.behDeptName,
-        t1.behDoctorName,
+        t1.doctorName,
         t1.patName,
         t1.behospitalCode,
         t1.hospitalId,
@@ -4002,7 +3998,7 @@
         FROM
         (
         SELECT
-        a.doctor_name AS behDoctorName,
+        a.doctor_name AS doctorName,
         a.beh_doctor_name,
         a.director_doctor_name,
         a.`name` AS patName,
@@ -4219,7 +4215,7 @@
         SELECT
         t1.behDeptId,
         t1.behDeptName,
-        t1.behDoctorName,
+        t1.doctorName,
         t1.patName,
         t1.behospitalCode,
         t1.hospitalId,
@@ -4235,7 +4231,7 @@
         FROM
         (
         SELECT
-        a.doctor_name AS behDoctorName,
+        a.doctor_name AS doctorName,
         a.`name` AS patName,
         a.behospital_code AS behospitalCode,
         a.behospital_date AS behospitalDate,
@@ -4688,13 +4684,16 @@
 
     <!-- 条目缺陷质控评分页-科室(内页)-->
     <select id="qcResultShortByDeptPage" resultType="com.diagbot.dto.QcResultShortDTO">
-        SELECT DISTINCT
+        SELECT t.*
+        FROM
+        (SELECT DISTINCT
         t1.hospital_id AS hospitalId,
         t1.behospital_code AS behospitalCode,
         t1.bed_code AS bedCode,
         t1.LEVEL AS LEVEL,
         t1.grade_type AS gradeType,
         t1.score_res AS scoreRes,
+        t1.scoreBn,
         t1.NAME AS NAME,
         t1.sex AS sex,
         t1.beh_dept_id AS behDeptId,
@@ -4712,8 +4711,28 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose,
         t1.ward_name AS wardName,
-        t2.age,
-        t1.file_code AS fileCode
+        CONCAT( ifnull(t2.age,''),ifnull(t2.age_unit,'') )as age,
+        t1.file_code AS fileCode,
+        t1.checkStatus,
+        t1.mrStatus,
+        t1.chName,
+        t1.mrName,
+        t1.chTime,
+        t1.mrTime
+        FROM
+        (
+        SELECT DISTINCT
+        tt1.*
+        FROM
+        (SELECT
+        be.*,
+        ifnull(mci.status,0) AS checkStatus,
+        ifnull(hm_mci.status,0) AS mrStatus,
+        mci.check_name as chName,
+        e.score_res as scoreBn,
+        hm_mci.check_name as mrName,
+        mci.gmt_create as chTime,
+        hm_mci.gmt_create as mrTime
         FROM
         (
         SELECT DISTINCT
@@ -4762,15 +4781,12 @@
         AND c.cases_id = d.cases_id
         AND c.cases_entry_id = d.id
         AND a.qc_type_id != 0
+        <if test="qcResultShortPageVO.userId!=null">
+            AND e.user_id = #{qcResultShortPageVO.userId}
+        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
-        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
-            and a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
-        </if>
-        <if test="qcResultShortPageVO.userId != null and qcResultShortPageVO.userId != ''">
-            AND e.user_id = #{qcResultShortPageVO.userId}
-        </if>
         <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
             AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
         </if>
@@ -4790,21 +4806,11 @@
                 <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
             </if>
         </if>
-        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
-            AND a.beh_dept_name = #{qcResultShortPageVO.deptName}
-        </if>
-        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND a.doctor_name = #{qcResultShortPageVO.doctorName}
-        </if>
-        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
-            AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-            OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
-            OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
+        <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
+            AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
         </if>
-        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+        <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
+            AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
         </if>
         <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
             AND b.`level` = #{qcResultShortPageVO.level}
@@ -4816,21 +4822,118 @@
             AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
         </if>
         <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
-            AND d.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.casesEntryName}, '%' )
+            AND d.NAME = #{qcResultShortPageVO.casesEntryName}
         </if>
-        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId != ''">
+        <if test="qcResultShortPageVO.casesEntryId != null ">
             AND d.id = #{qcResultShortPageVO.casesEntryId}
         </if>
+        <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
+            AND d.cases_name = #{qcResultShortPageVO.casesName}
+        </if>
+        <if test="qcResultShortPageVO.casesId != null">
+            AND d.cases_id = #{qcResultShortPageVO.casesId}
+        </if>
+        <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
+            AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
+            OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
+            OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
+        </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
+            OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
+            OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
+        </if>
         <if test="qcResultShortPageVO.isReject != null">
             AND c.is_reject = #{qcResultShortPageVO.isReject}
         </if>
         <if test="qcResultShortPageVO.ruleType != null">
             AND d.rule_type = #{qcResultShortPageVO.ruleType}
         </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 30
+        </if>
+        <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
+            AND TIMESTAMPDIFF(
+            DAY,
+            DATE( a.behospital_date ),
+            DATE( a.leave_hospital_date ))> 31
+        </if>
+        )be
+        left join med_check_info mci
+        on mci.is_deleted = 'N'
+        and mci.check_type = 0
+        and be.hospital_id = mci.hospital_id
+        and be.behospital_code = mci.behospital_code
+        left join med_check_info hm_mci
+        on hm_mci.is_deleted = 'N'
+        and hm_mci.check_type = 1
+        and be.hospital_id = hm_mci.hospital_id
+        and be.behospital_code = hm_mci.behospital_code
+        LEFT JOIN med_qcresult_cases e
+        on  be.behospital_code = e.behospital_code
+        and be.hospital_id = e.hospital_id
+        AND e.is_deleted = 'N'
+        and e.cases_id = 243
+        )tt1
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
+            ,med_medical_record tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+            AND tt2.mode_id = 30
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
+            ,med_crisis_info tt2
+            WHERE
+            tt2.is_deleted = 'N'
+            AND tt1.hospital_id = tt2.hospital_id
+            AND tt1.behospital_code = tt2.behospital_code
+        </if>
         ) t1
-        LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
-        AND t1.behospital_code = t2.behospital_code
-        AND t2.is_deleted = 'N'
+        <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594  and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
+            LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.is_deleted = 'N'
+        </if>
+        <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594  or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
+            , med_home_page t2
+            , med_home_operation_info t3
+            WHERE t1.hospital_id = t2.hospital_id
+            AND t1.behospital_code = t2.behospital_code
+            AND t2.home_page_id = t3.home_page_id
+            AND t2.is_deleted = 'N'
+            AND t3.is_deleted = 'N'
+        </if>
+        ) t
+        where 1=1
+        <if test="qcResultShortPageVO.checkStatus != null">
+            AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
+        </if>
+        <if test="qcResultShortPageVO.mrStatus != null">
+            AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
+        </if>
+        <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
+            AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
+            AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
+        </if>
+        <if test="qcResultShortPageVO.chTimeStart != null ">
+            <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.chTimeEnd != null ">
+            <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeStart != null ">
+            <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
+        </if>
+        <if test="qcResultShortPageVO.mrTimeEnd != null ">
+            <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
+        </if>
     </select>
 
     <update id="updateBatchByKey">
@@ -7572,7 +7675,7 @@
         SELECT
         f1.behDeptId,
         f1.behDeptName,
-        f1.behDoctorName,
+        f1.doctorName,
         f1.patName,
         f1.behospitalCode,
         f1.hospitalId,
@@ -7593,7 +7696,7 @@
         f1.mrTime
         FROM
         (SELECT
-        t.doctorName AS behDoctorName,
+        t.doctorName,
         t.`name` AS patName,
         t.behospitalCode AS behospitalCode,
         t.behospitalDate AS behospitalDate,
@@ -10594,6 +10697,9 @@
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
         </if>
+        <if test="doctorName != null and doctorName != ''">
+            and a.doctor_name = #{doctorName}
+        </if>
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
@@ -10627,11 +10733,6 @@
             OR a.beh_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
             OR a.director_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' ))
         </if>
-        <if test="doctorName != null and doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' ))
-        </if>
         )be
         left join med_check_info mci
         on mci.is_deleted = 'N'
@@ -10698,6 +10799,9 @@
         <if test="deptName != null and deptName != ''">
             and a.beh_dept_name = #{deptName}
         </if>
+        <if test="doctorName != null and doctorName != ''">
+            and a.doctor_name = #{doctorName}
+        </if>
         <if test="deptClass != null and deptClass != ''">
             and a.beh_dept_id = #{deptClass}
         </if>
@@ -10732,16 +10836,6 @@
         <if test="patName != null and patName != ''">
             AND a.NAME LIKE CONCAT( '%', #{patName}, '%' )
         </if>
-        <if test="doctorId != null and doctorId != ''">
-            AND (a.doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
-            OR a.beh_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' )
-            OR a.director_doctor_id LIKE CONCAT( '%', #{doctorId}, '%' ))
-        </if>
-        <if test="doctorName != null and doctorName != ''">
-            AND (a.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.beh_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
-            OR a.director_doctor_name LIKE CONCAT( '%', #{doctorName}, '%' ))
-        </if>
         GROUP BY
         a.doctor_id,
         a.doctor_name
@@ -11454,7 +11548,7 @@
         SELECT
         f1.behDeptId,
         f1.behDeptName,
-        f1.behDoctorName,
+        f1.doctorName,
         f1.patName,
         f1.behospitalCode,
         f1.hospitalId,
@@ -11475,7 +11569,7 @@
         f1.mrTime
         FROM
         (SELECT
-        t.doctorName AS behDoctorName,
+        t.doctorName,
         t.`name` AS patName,
         t.behospitalCode AS behospitalCode,
         t.behospitalDate AS behospitalDate,
@@ -12066,6 +12160,9 @@
                 AND c.`level`='合格'
             </if>
         </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            and a.doctor_name = #{qcResultShortPageVO.doctorName}
+        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
@@ -12296,6 +12393,9 @@
         <if test="qcResultShortPageVO.userId!=null">
             AND b.user_id = #{qcResultShortPageVO.userId}
         </if>
+        <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
+            and a.doctor_name = #{qcResultShortPageVO.doctorName}
+        </if>
         <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
             and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
         </if>
@@ -12416,7 +12516,7 @@
         SELECT
         f1.behDeptId,
         f1.behDeptName,
-        f1.behDoctorName,
+        f1.doctorName,
         f1.patName,
         f1.behospitalCode,
         f1.hospitalId,
@@ -12435,7 +12535,7 @@
         f1.mrTime
         FROM
         (SELECT
-        t.doctorName AS behDoctorName,
+        t.doctorName,
         t.`name` AS patName,
         t.behospitalCode AS behospitalCode,
         t.behospitalDate AS behospitalDate,
@@ -14972,7 +15072,7 @@
         SELECT
         f1.behDeptId,
         f1.behDeptName,
-        f1.behDoctorName,
+        f1.doctorName,
         f1.patName,
         f1.behospitalCode,
         f1.hospitalId,
@@ -16072,7 +16172,7 @@
         SELECT
         f1.behDeptId,
         f1.behDeptName,
-        f1.behDoctorName,
+        f1.doctorName,
         f1.patName,
         f1.behospitalCode,
         f1.hospitalId,
@@ -16093,7 +16193,7 @@
         f1.mrTime
         FROM
         (SELECT
-        t.doctorName AS behDoctorName,
+        t.doctorName,
         t.`name` AS patName,
         t.behospitalCode AS behospitalCode,
         t.behospitalDate AS behospitalDate,