diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/EcganalysisparasController.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/EcganalysisparasController.java index aa2284ce8..83e41dc69 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/EcganalysisparasController.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/EcganalysisparasController.java @@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO; import cn.iocoder.yudao.module.tblist.dal.mysql.ecganalysisparas.EcganalysisparasMapper; import cn.iocoder.yudao.module.tblist.dal.mysql.patientexamlist.PatientexamlistMapper; +import cn.iocoder.yudao.module.tblist.service.positivestatistics.PositivestatisticsService; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -71,6 +72,8 @@ public class EcganalysisparasController { @Resource private EcganalysisparasService ecganalysisparasService; @Resource + private PositivestatisticsService positivestatisticsService; + @Resource private EcganalysisparasMapper ecganalysisparasMapper; @PostMapping("/create") @Operation(summary = "创建心电分析数据") @@ -151,11 +154,13 @@ public class EcganalysisparasController { ecgPrintPdf.setDoctorName(updateReqVO.getDoctorName()); ecgPrintPdf.setType("2"); ecgPrintPdf.setFilepath(updateReqVO.getEcgJsonDataFilePath()); + ecgPrintPdf.setOrgid(updateReqVO.getOrgId()); OrgUnitDO aDo = orgService.getonekey(updateReqVO.getOrgId()); - if(!aDo.getOrgName().isEmpty()) - { + if (aDo != null && !aDo.getOrgName().isEmpty()) { ecgPrintPdf.setOrgname(aDo.getOrgName()); } + AdminUserDO user = userService.getUser(getLoginUserId()); + ecgPrintPdf.setIsAbnormal(positivestatisticsService.isAbnormalContent((updateReqVO.getDoctorDiagResult() == null) ? "" : updateReqVO.getDoctorDiagResult().trim(), user == null ? "" : user.getOrgId()) ? "0" : "1"); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(ecgPrintPdf); if(!json.isEmpty()) @@ -179,6 +184,12 @@ public class EcganalysisparasController { return success(true); } + @PostMapping("/SaveEcgPdf_image") + @Operation(summary = "保存心电分析数据(图片)调用打印服务生成pdf") + public CommonResult SaveEcgPdf_image(@RequestBody JSONObject params) { + Map mapResult = ecganalysisparasService.saveECGPdf_img(params); + return success(true); + } @DeleteMapping("/delete") @Operation(summary = "删除心电分析数据") diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/vo/EcgPrintPdf.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/vo/EcgPrintPdf.java index e3263f129..52b2e5850 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/vo/EcgPrintPdf.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/ecganalysisparas/vo/EcgPrintPdf.java @@ -27,6 +27,8 @@ public class EcgPrintPdf { private String doctorName; private String type; private String filepath; + private String orgid; private String orgname; private String ptimelimit; + private String isAbnormal; } diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasService.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasService.java index 666608ab6..2989a2a66 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasService.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasService.java @@ -81,4 +81,12 @@ public interface EcganalysisparasService extends IService { * @return Map类型的结果集 */ Map getEcgPdfImage(JSONObject params); + + /** + * 保存心电分析数据对应的pdf图像 + * + * @param params JSONObject对象 + * @return Map类型的结果集 + */ + Map saveECGPdf_img(JSONObject params); } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasServiceImpl.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasServiceImpl.java index 8df79acc3..413b43970 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasServiceImpl.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/ecganalysisparas/EcganalysisparasServiceImpl.java @@ -3,10 +3,18 @@ package cn.iocoder.yudao.module.tblist.service.ecganalysisparas; import cn.iocoder.yudao.framework.common.exception.ErrorCode; import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; import cn.iocoder.yudao.module.infra.service.config.ConfigService; +import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; +import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.service.doctor.DoctorService; +import cn.iocoder.yudao.module.system.service.org.OrgUnitService; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO; import cn.iocoder.yudao.module.tblist.dal.mysql.patientexamlist.PatientexamlistMapper; +import cn.iocoder.yudao.module.tblist.service.positivestatistics.PositivestatisticsService; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -30,7 +38,7 @@ import org.springframework.web.client.RestTemplate; import javax.annotation.Resource; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; /** * 心电分析数据 Service 实现类 * @@ -43,6 +51,21 @@ public class EcganalysisparasServiceImpl extends ServiceImpl getEcgPdfImage(JSONObject params) { Map mapResult = new HashMap<>(); String data_Image = ""; - - ConfigDO configInfo = configService.getConfigByKey("url.printurl"); + AdminUserDO user = userService.getUser(getLoginUserId()); + ConfigDO configInfo = null; + if (params.get("filepath") != null && !( + params.get("filepath").toString().trim().toUpperCase().endsWith(".BMP") || + params.get("filepath").toString().trim().toUpperCase().endsWith(".JPG") || + params.get("filepath").toString().trim().toUpperCase().endsWith(".PNG") + )) + configInfo = configService.getConfigByKey("url.printurl"); + else + configInfo = configService.getConfigByKey("url.printurl_image"); ConfigDO configInfo_ftpurl = configService.getConfigByKey("url.ecgpdf"); if (params != null && !params.isEmpty()) { try { + params.put("isAbnormal", positivestatisticsService.isAbnormalContent((params.get("diagContent") == null) ? "" : params.get("diagContent").toString().trim(), user == null ? "" : user.getOrgId()) ? "0" : "1"); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); HttpEntity requestEntity = new HttpEntity(params.toJSONString(), headers); @@ -140,4 +172,52 @@ public class EcganalysisparasServiceImpl extends ServiceImpl saveECGPdf_img(JSONObject params) { + Map mapResult = new HashMap<>(); + String data_Image = ""; + AdminUserDO user = userService.getUser(getLoginUserId()); + ConfigDO configInfo = configService.getConfigByKey("url.printurl_image"); + ConfigDO configInfo_ftpurl = configService.getConfigByKey("url.ecgpdf"); + if (params != null && !params.isEmpty()) { + try { + params.put("type", "2"); + OrgUnitDO orgDO = params.get("orgid") == null ? null : orgService.getonekey(params.get("orgid").toString().trim()); + if (orgDO != null && orgDO.getOrgName() != null && !orgDO.getOrgName().trim().equals("")) { + params.put("orgname", orgDO.getOrgName().trim()); + } + params.put("isAbnormal", positivestatisticsService.isAbnormalContent((params.get("diagContent") == null) ? "" : params.get("diagContent").toString().trim(), user == null ? "" : user.getOrgId()) ? "0" : "1"); + DoctorDO doctorDO = (params.get("doctorId") == null || params.get("doctorId").toString().trim().equals("")) ? null : doctorService.getBydoctorID(params.get("doctorId").toString().trim()); + if (doctorDO != null && doctorDO.getESignatureUrl() != null && !doctorDO.getESignatureUrl().trim().equals("")) { + params.put("image", doctorDO.getESignatureUrl().trim()); + } + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON_UTF8); + HttpEntity requestEntity = new HttpEntity(params.toJSONString(), headers); + ResponseEntity res = httpRestTemplate.postForEntity(configInfo.getValue(), requestEntity, String.class); + data_Image = res.getBody(); + } catch (Exception ex) { + data_Image = ""; + } + } + if (data_Image == null || data_Image.trim().isEmpty()) { + mapResult.put("code", "-200"); + mapResult.put("dataImage", null); + } else { + String pdfurl = configInfo_ftpurl.getValue().trim() + data_Image.trim(); + try { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("examId", params.get("examid").toString().trim()); + updateWrapper.eq("regId", params.get("regid").toString().trim()); + updateWrapper.eq("orgId", params.get("orgid") == null ? "" : params.get("orgid").toString().trim()); + PatientexamlistDO patientexamlistDO = new PatientexamlistDO(); + patientexamlistDO.setPdfurl(pdfurl); + patientexamlistMapper.update(patientexamlistDO, updateWrapper); + } catch (Exception ex) { + } + mapResult.put("code", "200"); + mapResult.put("dataImage", pdfurl); + } + return mapResult; + } } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsService.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsService.java index 0c74d6940..416962eb1 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsService.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsService.java @@ -53,5 +53,9 @@ public interface PositivestatisticsService { */ PageResult getPositivestatisticsPage(PositivestatisticsPageReqVO pageReqVO); + boolean isAbnormalContent(String Content, String orgId); + + boolean isAbnormalContent(String Content, String[] keyWords); + boolean validatePositivestatisticsExists(String orgId, String diseaseName); } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsServiceImpl.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsServiceImpl.java index 9fc1364fc..2d3b9ccb6 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsServiceImpl.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/service/positivestatistics/PositivestatisticsServiceImpl.java @@ -127,4 +127,39 @@ public class PositivestatisticsServiceImpl implements PositivestatisticsService return positivestatisticsMapper.selectPage(pageReqVO); } + @Override + public boolean isAbnormalContent(String Content, String orgId) { + List keyWords = new ArrayList<>(); + String[] keyWords_temp = null; + List> positivestatisticsDict = (orgId == null || orgId.trim().equals("")) ? null : positivestatisticsMapper.selectList_usable(orgId.trim()); + if (positivestatisticsDict != null && positivestatisticsDict.size() > 0) { + for (Map dict : positivestatisticsDict) { + keyWords_temp = null; + if (dict.containsKey("keyWord") && dict.get("keyWord") != null && !dict.get("keyWord").toString().trim().equals("")) + keyWords_temp = dict.get("keyWord").toString().trim().split(","); + if (keyWords_temp != null && keyWords_temp.length > 0) + Collections.addAll(keyWords, keyWords_temp); + } + } + if (!(keyWords != null && keyWords.size() > 0)) + keyWords = null; + return isAbnormalContent(Content, (keyWords == null) ? null : keyWords.toArray(new String[0])); + } + + @Override + public boolean isAbnormalContent(String Content, String[] keyWords) { + boolean out = false; + if (Content != null && !Content.trim().equals("") + && keyWords != null && keyWords.length > 0) { + Content = Content.trim(); + for (String keyWord : keyWords) { + if (keyWord != null && !keyWord.trim().equals("") && Content.contains(keyWord)) { + out = true; + break; + } + } + } + return out; + } + } \ No newline at end of file