diff --git a/data-config/sdry-collect-nurse-insert-sugar-config.json b/data-config/sdry-collect-nurse-insert-sugar-config.json new file mode 100644 index 0000000..29fb3c3 --- /dev/null +++ b/data-config/sdry-collect-nurse-insert-sugar-config.json @@ -0,0 +1,3 @@ +{ + "fileRemoveByFormName":["同意书","告知书"] +} \ No newline at end of file diff --git a/src/main/java/com/docus/server/collection/mapper/TBasicMapper.java b/src/main/java/com/docus/server/collection/mapper/TBasicMapper.java index 62436b9..9bd03dc 100644 --- a/src/main/java/com/docus/server/collection/mapper/TBasicMapper.java +++ b/src/main/java/com/docus/server/collection/mapper/TBasicMapper.java @@ -50,4 +50,12 @@ public interface TBasicMapper{ List selectBasicListByPatientIds(@Param("patientIds") List patientIds); Integer getNurseFileCount(@Param("patientId")String patientId); + + /** + * 保存护理采集删除文件数量 + * @param patientId 病案主键 + * @param removeCount 删除数量 + * @return db操作影响行 + */ + Integer saveNisRemoveFilesCount(@Param("patientId") String patientId,@Param("count") int removeCount); } diff --git a/src/main/java/com/docus/server/report/config/SdRyCollectNurseInsertSugarConfig.java b/src/main/java/com/docus/server/report/config/SdRyCollectNurseInsertSugarConfig.java new file mode 100644 index 0000000..fb6ba65 --- /dev/null +++ b/src/main/java/com/docus/server/report/config/SdRyCollectNurseInsertSugarConfig.java @@ -0,0 +1,30 @@ +package com.docus.server.report.config; + +import com.docus.server.report.util.TableJsonRead; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +/** + * 顺德人医移动护理采集配置 + * @author wyb + */ +@Data +public class SdRyCollectNurseInsertSugarConfig { + private final static String CONFIG_FILE_PATH="data-config"; + private final static String CONFIG_FILE_NAME="sdry-collect-nurse-insert-sugar-config.json"; + private List fileRemoveByFormName=new ArrayList<>(); + + public static SdRyCollectNurseInsertSugarConfig getConfig(){ + TableJsonRead jsonRead = new TableJsonRead(); + SdRyCollectNurseInsertSugarConfig readObject = jsonRead.Read(CONFIG_FILE_PATH, CONFIG_FILE_NAME, SdRyCollectNurseInsertSugarConfig.class); + return Optional.ofNullable(readObject).orElse(new SdRyCollectNurseInsertSugarConfig()); + } + + public static void main(String[] args) { + System.out.println(getConfig()); + } + +} diff --git a/src/main/java/com/docus/server/report/job/ReportJob.java b/src/main/java/com/docus/server/report/job/ReportJob.java index 1c968c3..23225dd 100644 --- a/src/main/java/com/docus/server/report/job/ReportJob.java +++ b/src/main/java/com/docus/server/report/job/ReportJob.java @@ -10,6 +10,7 @@ import com.docus.server.collection.mapper.TBasicMapper; import com.docus.server.report.api.ShunDePeopleService; import com.docus.server.report.api.TaskDistributeService; import com.docus.server.report.api.dto.*; +import com.docus.server.report.config.SdRyCollectNurseInsertSugarConfig; import com.docus.server.report.config.SdRyReportQueryConfig; import com.docus.server.report.config.TaskValidateConfig; import com.docus.server.report.config.ZdAssortConfig; @@ -170,8 +171,22 @@ public class ReportJob { nurseFileCountError(inpatientNo, admissTimes); return; } + // 从配置获取需要过滤的文件名称 + SdRyCollectNurseInsertSugarConfig config = SdRyCollectNurseInsertSugarConfig.getConfig(); + List fileRemoveByFormName = config.getFileRemoveByFormName(); + List removeFiles = nurseInsertSugarReportList.stream() + .filter(item -> isCharacterContains(item.getForm_name(), fileRemoveByFormName)) + .collect(Collectors.toList()); + log.info("住院号:{},住院次数{},护理采集过滤文件: {} 共 {} 条", inpatientNo, admissTimes, fileRemoveByFormName, removeFiles.size()); + tBasicMapper.saveNisRemoveFilesCount(patientId, removeFiles.size()); + ReportDto reportDto; + int collectFileCount = 0; for (SdNurseInsertSugarResponse.NisData nisReport : nurseInsertSugarReportList) { + // 从过滤配置中匹配,如果匹配则跳过本次循环 + if (isCharacterContains(nisReport.getForm_name(), fileRemoveByFormName)) { + continue; + } reportDto = new ReportDto(); reportDto.setSysFlag(reportQueryNurseInsertSugarCollectorId); reportDto.setTaskId(reportDownTwoDto.getTasks().get(0).getTaskId()); @@ -186,8 +201,22 @@ public class ReportJob { reportDto.setFileSource("1"); reportDto.setFilestoragetype("1"); reportService.report(reportDto); + collectFileCount++; + } + log.info("住院号:{},住院次数{},护理采集文件: {} 条", inpatientNo, admissTimes, collectFileCount); + } + } + /** + * 循环遍历 集合,如果 str字符串包含有集合中的元素,返回true; + * + */ + private static boolean isCharacterContains(String str, List strList){ + for (String e : strList) { + if(str.contains(e)){ + return true; } } + return false; } private void nurseFileCountError(String inpatientNo, Integer admissTimes) { @@ -454,9 +483,6 @@ public class ReportJob { } } - public static void main(String[] args) { - System.out.println(createBase64SaveDir()); - } private List parseQuerySdRyInspectReport(String respBody, TBasic tBasic, AtomicInteger reportTotalCount) { JSONObject jsonObject = Func.readJson(respBody, JSONObject.class); diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml index 04a5e65..4e1fbbc 100644 --- a/src/main/resources/mapper/TBasicMapper.xml +++ b/src/main/resources/mapper/TBasicMapper.xml @@ -28,6 +28,13 @@ VALUES (#{tBasicExtend.patientId},#{tBasicExtend.wardCode},#{tBasicExtend.wardName},#{tBasicExtend.sdryIndex}) + + INSERT INTO `docus_medicalrecord`.`t_basic_extend` + (`patient_id`, `nurse_file_collect_remove_count`) + VALUES (#{patientId}, #{count}) + on DUPLICATE KEY UPDATE + `nurse_file_collect_remove_count`=#{count}; + UPDATE `docus_medicalrecord`.`t_basic`