Forráskód Böngészése

1、代码简化;
2、病案首页、病案手术、病案诊断,文书信息,文书详情,修改时调整删除标识为未删除状态(预防his删除后恢复再次进行编辑保存操作)
3、无模板对应的数据,保存到qc_model_hospital中,方便后续维护跟进

liuqq 3 éve
szülő
commit
1b963ee718

+ 1 - 11
src/main/java/com/diagbot/facade/data/AHomeDiagnoseInfoFacade.java

@@ -36,17 +36,6 @@ public class AHomeDiagnoseInfoFacade extends HomeDiagnoseInfoServiceImpl{
 
     private TZDBConn tzDBConn = new TZDBConn();
 
-    /**
-     * 终末质控-定时同步病案首页诊断
-     */
-    public void executeHomeDiagnose() {
-        //String sql="select * from br_recdiagnose where BASYID in (select BASYID from br_rechome where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate())";//今年的数据
-        //前一天的数据
-        String sql="select * from br_recdiagnose where BASYID in (select BASYID from br_rechome where cjcxrq>=(select CONVERT(varchar,GETDATE()-1,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)))";
-        List<HomeDiagnoseInfo> homeDiagnoseList = tzDBConn.getHomeDiagnose(sql);
-        execute(homeDiagnoseList);
-    }
-
     /**
      * 数据引擎-通过接口更新病案首页诊断
      * @param list
@@ -87,6 +76,7 @@ public class AHomeDiagnoseInfoFacade extends HomeDiagnoseInfoServiceImpl{
                             .eq("diagnose_order_no", s.getDiagnoseOrderNo()), false);
                     if (diagnoseInfo != null) {
                         s.setGmtModified(new Date());
+                        s.setIsDeleted(IsDeleteEnum.N.getKey());
                         updateE.add(s);
                     } else {
                         s.setGmtCreate(new Date());

+ 1 - 13
src/main/java/com/diagbot/facade/data/AHomeOperationInfoFacade.java

@@ -36,17 +36,6 @@ public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl{
 
     private TZDBConn tzDBConn = new TZDBConn();
 
-    /**
-     * 终末质控-同步前一天数据
-     */
-    public void executeHomeOperation() {
-        //String sql="select * from br_recoperation where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
-        //前一天数据
-        String sql="select * from br_recoperation where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23))";
-        List<HomeOperationInfo> homeOperationList = tzDBConn.getHomeOperation(sql);
-        execute(homeOperationList);
-    }
-
     /**
      * 终末质控-通过接口更新病案首页手术
      * @param list
@@ -55,7 +44,6 @@ public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl{
     public RespDTO executeHomeOperation(List<AHomeOperationVO> list) {
         try {
             List<HomeOperationInfo> homeOperationList=Lists.newArrayList();
-            List<AHomeOperationDTO> homeOperationDtoList=Lists.newArrayList();
             if(list!=null && list.size()>0){
                 list.stream().forEach(s->{
                     HomeOperationInfo homeOperationInfo=new HomeOperationInfo();
@@ -63,7 +51,6 @@ public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl{
                     homeOperationInfo.setOperationDate(DateUtil.parseDateTime(s.getOperationDate()));
                     homeOperationList.add(homeOperationInfo);
                 });
-                homeOperationDtoList=BeanUtil.listCopyTo(list,AHomeOperationDTO.class);
                 execute(homeOperationList);
                 if(logSwitch){
                     homeOperationList.forEach(s->{
@@ -94,6 +81,7 @@ public class AHomeOperationInfoFacade extends HomeOperationInfoServiceImpl{
                     HomeOperationInfo operationInfo = this.getOne(queryWrapper, false);
                     if (operationInfo != null) {
                         s.setGmtModified(new Date());
+                        s.setIsDeleted(IsDeleteEnum.N.getKey());
                         updateE.add(s);
                     } else {
                         s.setGmtCreate(new Date());

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

@@ -54,26 +54,6 @@ public class AHomePageFacade extends HomePageServiceImpl{
 
     private TZDBConn tzDBConn = new TZDBConn();
 
-    /**
-     * 同步前一天病案首页
-     */
-    public void executeHomePage() {
-        //String sql="select * from br_rechome where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
-        //同步前一天的数据
-        String sql="select * from br_rechome where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23))";
-        List<HomePage> homePageList = tzDBConn.getHomePage(sql);
-        /*
-        int mod=Math.floorMod(homePageList.size(),500);
-        int div=Math.floorDiv(homePageList.size(),500);
-        for (int i = 0; i <= homePageList.size(); i++) {
-            System.out.println((i-1)*500+"---"+(i*500));
-            homePageList=homePageList.subList((i*500),(i+1)*500);
-            execute(homePageList);
-        }
-        */
-        execute(homePageList);
-    }
-
     /**
      * 运行质控-验证数据有效性
      * @param aHomePageIngVO
@@ -259,6 +239,7 @@ public class AHomePageFacade extends HomePageServiceImpl{
                             .eq("behospital_code", s.getBehospitalCode()), false);
                     if (homePage != null) {
                         s.setGmtModified(new Date());
+                        s.setIsDeleted(IsDeleteEnum.N.getKey());
                         updateE.add(s);
                     } else {
                         s.setGmtCreate(new Date());

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

@@ -75,6 +75,7 @@ public class AMedicalRecordContentFacade extends MedicalRecordContentServiceImpl
                     MedicalRecordContent mrContent = this.getOne(queryWrapper, false);
                     if (mrContent != null) {
                         s.setGmtModified(new Date());
+                        s.setIsDeleted(IsDeleteEnum.N.getKey());
                         updateE.add(s);
                     } else {
                         s.setGmtCreate(new Date());

+ 13 - 51
src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

@@ -7,13 +7,11 @@ import com.diagbot.dto.AnalyzeRunDTO;
 import com.diagbot.dto.RecordContentDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.data.AMedicalRecordDTO;
-import com.diagbot.dto.data.AMrContentDTO;
 import com.diagbot.entity.*;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.ModeIdEnum;
 import com.diagbot.facade.*;
 import com.diagbot.service.impl.MedicalRecordServiceImpl;
-import com.diagbot.service.impl.QcAbnormalServiceImpl;
 import com.diagbot.util.*;
 import com.diagbot.vo.AnalyzeRunVO;
 import com.diagbot.vo.MedrecVo;
@@ -46,10 +44,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
     @Autowired
     private BehospitalInfoFacade behospitalInfoFacade;
 
-    @Autowired
-    @Qualifier("qcAbnormalServiceImpl")
-    private QcAbnormalServiceImpl qcAbnormalService;
-
     @Autowired
     private QcTypeFacade qcTypeFacade;
 
@@ -76,16 +70,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
 
     private TZDBConn tzDBConn = new TZDBConn();
 
-    /**
-     * 终末质控-同步前一天的病历记录
-     */
-    public void executeMrRecord() {
-        //String sql="select * from mr_medicalrecords  where cjcxrq>=dateadd(day,-2,getdate()) and cjcxrq<=getdate()";
-        String sql = "select * from mr_medicalrecords  where cjcxrq>=(select CONVERT(varchar,GETDATE()-2,23)) and cjcxrq<(select CONVERT(varchar,GETDATE(),23)) ORDER BY cjcxrq DESC";
-        List<MedicalRecord> medicalRecordList = tzDBConn.getMedicalRecord(sql);
-        execute(medicalRecordList);
-    }
-
     /**
      * 终末质控-通过接口更新病历记录
      *
@@ -262,7 +246,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
      */
     public RespDTO<Map<String, Object>> executeMrRecordIng(AMrContentVO aMrContentVO) {
         if (aMrContentVO.getRecords() != null && aMrContentVO.getRecords().size() > 0) {
-            AMrContentDTO aMrContentDTO = new AMrContentDTO();
             //循环验证数据有效性
             for (AMedicalRecordVO aMedicalRecordVO : aMrContentVO.getRecords()) {
                 if ("".equals(aMedicalRecordVO.getRecId())) {
@@ -310,7 +293,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
         Long hospitalId = aMrContentVO.getRecords().get(0).getHospitalId();
         MedicalRecord medicalRecord = new MedicalRecord();
         BeanUtil.copyProperties(aMrContentVO.getRecords().get(0), medicalRecord);
-        Long modeId = initModeId(medicalRecord);
+        Long modeId = initModeId(medicalRecord.getHospitalId(),medicalRecord.getRecTypeId());
         if (aMrContentVO.getDockModeType().equals("0")) {
             Map<String, Object> map = new HashMap<String, Object>();
             List<AMedicalRecordDTO> medicalRecordDTOList = BeanUtil.listCopyTo(aMrContentVO.getRecords(), AMedicalRecordDTO.class);
@@ -363,21 +346,20 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
             List<MedicalRecord> addE = Lists.newLinkedList();
             List<MedicalRecord> updateE = Lists.newLinkedList();
             List<BehospitalInfo> behospitalInfoList = Lists.newLinkedList();
-            List<QcAbnormal> qcAbnormalList = Lists.newLinkedList();
+            List<ModelHospital> modelHospitalList = Lists.newLinkedList();
             if (medicalRecordList != null && medicalRecordList.size() > 0) {
                 medicalRecordList.stream().forEach(s -> {
                     //初始化mode_id
-                    Long modeId = initModeId(s);
+                    Long modeId = initModeId(s.getHospitalId(),s.getRecTypeId());
                     if (modeId == Long.valueOf("0")) {
-                        //新增类型到监测表中
-                        QcAbnormal qcAbnormal = new QcAbnormal();
-                        qcAbnormal.setHospitalId(s.getHospitalId());
-                        qcAbnormal.setBehospitalCode(s.getBehospitalCode());
-                        qcAbnormal.setType(1);
-                        qcAbnormal.setDescription(s.getRecTitle());
-                        qcAbnormal.setGmtCreate(new Date());
-                        qcAbnormalList.add(qcAbnormal);
+                        //未匹配到模板的进行记录,后续可跟进
+                        ModelHospital modelHospital = new ModelHospital();
+                        modelHospital.setHospitalId(s.getHospitalId());
+                        modelHospital.setHospitalModelName(s.getRecTitle());
+                        modelHospital.setRemark(s.getRecTypeId());
+                        modelHospitalList.add(modelHospital);
                     } else if (modeId == Long.valueOf("1")) {
+                        //入院记录保存时,同步调整住院病人的质控类型,即qc_type_id
                         BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
                                 .eq("behospital_code", s.getBehospitalCode())
                                 .eq("hospital_id", s.getHospitalId()), false);
@@ -396,6 +378,7 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
                             .eq("behospital_code", s.getBehospitalCode()), false);
                     if (mRecord != null) {
                         s.setGmtModified(new Date());
+                        s.setIsDeleted(IsDeleteEnum.N.getKey());
                         updateE.add(s);
                     } else {
                         s.setGmtCreate(new Date());
@@ -409,8 +392,8 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
             if (updateE.size() > 0) {
                 medicalRecordService.updateBatchByKey(updateE);
             }
-            if (qcAbnormalList.size() > 0) {
-                qcAbnormalService.saveBatch(qcAbnormalList);
+            if (modelHospitalList.size() > 0) {
+                modelHospitalFacade.saveBatch(modelHospitalList);
             }
             if (behospitalInfoList.size() > 0) {
                 behospitalInfoFacade.updateBatchByKey(behospitalInfoList);
@@ -453,27 +436,6 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
         return qcTypeId;
     }
 
-    /**
-     * 初始化模型ID
-     *
-     * @param medicalRecord
-     * @return
-     */
-    private Long initModeId(MedicalRecord medicalRecord) {
-        Long modeId = Long.valueOf("0");
-        QueryWrapper<ModelHospital> wrapper = new QueryWrapper<>();
-        wrapper.eq("hospital_id", medicalRecord.getHospitalId());
-        //wrapper.eq("hospital_model_name", medicalRecord.getRecTitle());
-        wrapper.eq("remark", medicalRecord.getRecTypeId());
-        ModelHospital mode = modelHospitalFacade.getOne(wrapper, false);
-        if (mode != null) {
-            modeId = mode.getStandModelId();
-        } else {
-            modeId = Long.valueOf("0");
-        }
-        return modeId;
-    }
-
     /**
      * 初始化模型ID
      *

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

@@ -44,7 +44,7 @@ public class HomeDiagnoseInfoTask implements SchedulingConfigurer {
                         && task001.getIsDeleted().equals(IsDeleteEnum.N.getKey())
                         && task001.getIsUsed().equals(1)) {
                     log.info("执行动态定时任务: " + LocalDateTime.now().toLocalTime());
-                    aHomeDiagnoseInfoFacade.executeHomeDiagnose();
+                    //aHomeDiagnoseInfoFacade.executeHomeDiagnose();
                 }
             }
         }, new Trigger() {

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

@@ -47,7 +47,7 @@ public class HomeOperationInfoTask implements SchedulingConfigurer{
                         && task001.getIsDeleted().equals(IsDeleteEnum.N.getKey())
                         && task001.getIsUsed().equals(1)) {
                     log.info("执行动态定时任务: " + LocalDateTime.now().toLocalTime());
-                    aHomeOperationInfoFacade.executeHomeOperation();
+                    //aHomeOperationInfoFacade.executeHomeOperation();
                 }
             }
         }, new Trigger() {

+ 3 - 0
src/main/resources/mapper/HomeDiagnoseInfoMapper.xml

@@ -52,6 +52,9 @@
                 <if test="item.modifier != null">
                     modifier = #{item.modifier},
                 </if>
+                <if test="item.isDeleted != null">
+                    is_deleted = #{item.isDeleted},
+                </if>
             </set>
             where home_page_id = #{item.homePageId} and hospital_id = #{item.hospitalId} and diagnose_order_no = #{item.diagnoseOrderNo}
         </foreach>

+ 3 - 0
src/main/resources/mapper/HomeOperationInfoMapper.xml

@@ -68,6 +68,9 @@
                 <if test="item.modifier != null">
                     modifier = #{item.modifier},
                 </if>
+                <if test="item.isDeleted != null">
+                    is_deleted = #{item.isDeleted},
+                </if>
             </set>
             where home_page_id = #{item.homePageId} and hospital_id = #{item.hospitalId} and operation_order_no = #{item.operationOrderNo}
         </foreach>

+ 3 - 0
src/main/resources/mapper/HomePageMapper.xml

@@ -862,6 +862,9 @@
                 <if test="item.modifier != null">
                     modifier = #{item.modifier},
                 </if>
+                <if test="item.isDeleted != null">
+                    is_deleted = #{item.isDeleted},
+                </if>
             </set>
             where home_page_id = #{item.homePageId} and hospital_id = #{item.hospitalId} and behospital_code = #{item.behospitalCode}
         </foreach>

+ 3 - 0
src/main/resources/mapper/MedicalRecordContentMapper.xml

@@ -31,6 +31,9 @@
                 <if test="item.modifier != null">
                     modifier = #{item.modifier},
                 </if>
+                <if test="item.isDeleted != null">
+                    is_deleted = #{item.isDeleted},
+                </if>
             </set>
             where rec_id = #{item.recId} and hospital_id = #{item.hospitalId}
         </foreach>

+ 3 - 0
src/main/resources/mapper/MedicalRecordMapper.xml

@@ -112,6 +112,9 @@
                 <if test="item.modifier != null">
                     modifier = #{item.modifier},
                 </if>
+                <if test="item.isDeleted != null">
+                    is_deleted = #{item.isDeleted},
+                </if>
             </set>
             where rec_id = #{item.recId} and hospital_id = #{item.hospitalId} and behospital_code = #{item.behospitalCode}
         </foreach>