From 6f5dd32dcefab1dce403f12b4eda7d72ca72445b Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Tue, 12 Sep 2023 14:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E7=97=87=E5=88=86=E6=AE=B5=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-config/system-assort-config.json | 15 +++++ .../report/config/SystemAssortConfig.java | 55 +++++++++++++++++++ .../webservice/impl/JsIcuReportHandler.java | 46 +++++++++++++++- 3 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 data-config/system-assort-config.json create mode 100644 src/main/java/com/docus/server/report/config/SystemAssortConfig.java diff --git a/data-config/system-assort-config.json b/data-config/system-assort-config.json new file mode 100644 index 0000000..0614ab5 --- /dev/null +++ b/data-config/system-assort-config.json @@ -0,0 +1,15 @@ +[ + { + "key": "icu", + "desc": "重症系统文件采集,文件分段设置,通过文件名包含标题取,否则取默认", + "assort": { + "defaultAssortId": "icu702", + "other": [ + { + "title": "血气", + "assortId": "检验报告分类id" + } + ] + } + } +] \ No newline at end of file diff --git a/src/main/java/com/docus/server/report/config/SystemAssortConfig.java b/src/main/java/com/docus/server/report/config/SystemAssortConfig.java new file mode 100644 index 0000000..ad0c02e --- /dev/null +++ b/src/main/java/com/docus/server/report/config/SystemAssortConfig.java @@ -0,0 +1,55 @@ +package com.docus.server.report.config; + +import cn.hutool.core.collection.CollUtil; +import com.docus.core.util.Func; +import com.docus.server.report.util.TableJsonRead; +import lombok.Data; + +import java.util.List; + +/** + * 文件分段配置 + * @author WYBDEV + */ +@Data +public class SystemAssortConfig { + + private String key; + private String desc; + private Assort assort; + + private final static TableJsonRead JSON_READ = new TableJsonRead(); + + public static SystemAssortConfig getSystemAssortConfig(String collectorId) { + List configs = getSystemAssortConfig(); + if (CollUtil.isNotEmpty(configs)) { + for (SystemAssortConfig config : configs) { + if (collectorId.equals(config.getKey())) { + return config; + } + } + } + return null; + } + + public synchronized static List getSystemAssortConfig() { + String configJson = JSON_READ.ReadContent("data-config", "system-assort-config.json"); + return Func.parseJsonArray(configJson, SystemAssortConfig.class); + } + + @Data + public static class Assort { + private String defaultAssortId; + private List other; + } + + @Data + public static class AssortObj { + private String title; + private String assortId; + } + + public static void main(String[] args) { + System.out.println(getSystemAssortConfig()); + } +} diff --git a/src/main/java/com/docus/server/report/webservice/impl/JsIcuReportHandler.java b/src/main/java/com/docus/server/report/webservice/impl/JsIcuReportHandler.java index ba44425..7e0b7c3 100644 --- a/src/main/java/com/docus/server/report/webservice/impl/JsIcuReportHandler.java +++ b/src/main/java/com/docus/server/report/webservice/impl/JsIcuReportHandler.java @@ -7,6 +7,7 @@ import com.docus.server.api.dto.HospitalSubmitNodeLogAddDTO; import com.docus.server.api.enums.HospitalSubmitNodeEnum; import com.docus.server.collection.mapper.TBasicMapper; import com.docus.server.report.api.dto.ReportDto; +import com.docus.server.report.config.SystemAssortConfig; import com.docus.server.report.service.ReportService; import com.docus.server.report.util.JSXMLResult; import com.docus.server.report.util.XmlUtil; @@ -17,6 +18,7 @@ import org.springframework.stereotype.Service; import org.w3c.dom.Node; import javax.annotation.Resource; +import java.util.List; /** * 重症症接收 @@ -43,6 +45,7 @@ public class JsIcuReportHandler implements WebserviceReceiveServerHandler { msgId = msgNode.getTextContent(); ReportDto reportDto = convert(xmlUtil); verifyReportDto(reportDto); + setAssortId(reportDto); reportService.report(reportDto); saveSubmitNodeLog(reportDto); return JSXMLResult.success(msgId); @@ -55,11 +58,48 @@ public class JsIcuReportHandler implements WebserviceReceiveServerHandler { } } + /** + * 从配置额外重新设置分段id + * + * @param reportDto 上报文件信息 + */ + private void setAssortId(ReportDto reportDto) { + SystemAssortConfig systemAssortConfig = SystemAssortConfig.getSystemAssortConfig(reportDto.getSysFlag()); + if (systemAssortConfig == null) { + return; + } + String fileTitle = reportDto.getFileTitle(); + // 有配置,没有配置其他的条件,取默认 + SystemAssortConfig.Assort configAssort = systemAssortConfig.getAssort(); + String assortId = configAssort.getDefaultAssortId(); + List configAssortOther = configAssort.getOther(); + if (configAssortOther != null) { + // 有配置其它的,匹配文件标题 + for (SystemAssortConfig.AssortObj assortObj : configAssortOther) { + if (Func.isNotBlank(assortObj.getTitle()) && fileTitle.contains(assortObj.getTitle())) { + assortId = assortObj.getAssortId(); + break; + } + } + } + reportDto.setAssortId(assortId); + } + + public static void main(String[] args) { + JsIcuReportHandler icuReportHandler = new JsIcuReportHandler(); + ReportDto reportDto = new ReportDto(); + reportDto.setSysFlag("icu"); + reportDto.setFileTitle("血气哈哈哈"); + reportDto.setAssortId("1008611"); + icuReportHandler.setAssortId(reportDto); + System.out.println(reportDto); + } + private void saveSubmitNodeLog(ReportDto reportDto) { try { // 如果出现多条出错的情况,还是得保存收到的信息,人工干预处理 - String patientId = tBasicMapper.getPatientIdByInpatientNoAndAdminssTimes(reportDto.getInpatientNo(), reportDto.getAdmisstimes()); - if(Func.isNotBlank(patientId)){ + String patientId = tBasicMapper.getPatientIdByInpatientNoAndAdminssTimes(reportDto.getInpatientNo(), reportDto.getAdmisstimes()); + if (Func.isNotBlank(patientId)) { HospitalSubmitNodeLogAddDTO dto = new HospitalSubmitNodeLogAddDTO(); dto.setPatientId(patientId); dto.setContent(new String[]{reportDto.getFileTitle()}); @@ -69,7 +109,7 @@ public class JsIcuReportHandler implements WebserviceReceiveServerHandler { hospitalSubmitNodeServiceApi.addLog(dto); } } catch (Exception ex) { - log.error("保存icu提交记录出错,病案号:"+reportDto.getInpatientNo()+" ,住院次数:"+reportDto.getAdmisstimes(), ex); + log.error("保存icu提交记录出错,病案号:" + reportDto.getInpatientNo() + " ,住院次数:" + reportDto.getAdmisstimes(), ex); } }