ecg图片pdf
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled

This commit is contained in:
旺仔 2025-01-08 16:19:43 +08:00
parent 35d54d7466
commit aa8b2d7139
6 changed files with 145 additions and 5 deletions

View File

@ -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<Boolean> SaveEcgPdf_image(@RequestBody JSONObject params) {
Map<String, Object> mapResult = ecganalysisparasService.saveECGPdf_img(params);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除心电分析数据")

View File

@ -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;
}

View File

@ -81,4 +81,12 @@ public interface EcganalysisparasService extends IService<EcganalysisparasDO> {
* @return Map<String, Object>类型的结果集
*/
Map<String, Object> getEcgPdfImage(JSONObject params);
/**
* 保存心电分析数据对应的pdf图像
*
* @param params JSONObject对象
* @return Map<String, Object>类型的结果集
*/
Map<String, Object> saveECGPdf_img(JSONObject params);
}

View File

@ -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<EcganalysisparasMap
@Resource
private EcganalysisparasMapper ecganalysisparasMapper;
@Resource
private PatientexamlistMapper patientexamlistMapper;
@Resource
private AdminUserService userService;
@Resource
private DoctorService doctorService;
@Resource
private PositivestatisticsService positivestatisticsService;
@Resource
private OrgUnitService orgService;
@Resource
private ConfigService configService;
@ -113,11 +136,20 @@ public class EcganalysisparasServiceImpl extends ServiceImpl<EcganalysisparasMap
public Map<String, Object> getEcgPdfImage(JSONObject params) {
Map<String, Object> 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<String> requestEntity = new HttpEntity<String>(params.toJSONString(), headers);
@ -140,4 +172,52 @@ public class EcganalysisparasServiceImpl extends ServiceImpl<EcganalysisparasMap
return mapResult;
}
@Override
public Map<String, Object> saveECGPdf_img(JSONObject params) {
Map<String, Object> 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<String> requestEntity = new HttpEntity<String>(params.toJSONString(), headers);
ResponseEntity<String> 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<PatientexamlistDO> 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;
}
}

View File

@ -53,5 +53,9 @@ public interface PositivestatisticsService {
*/
PageResult<PositivestatisticsDO> getPositivestatisticsPage(PositivestatisticsPageReqVO pageReqVO);
boolean isAbnormalContent(String Content, String orgId);
boolean isAbnormalContent(String Content, String[] keyWords);
boolean validatePositivestatisticsExists(String orgId, String diseaseName);
}

View File

@ -127,4 +127,39 @@ public class PositivestatisticsServiceImpl implements PositivestatisticsService
return positivestatisticsMapper.selectPage(pageReqVO);
}
@Override
public boolean isAbnormalContent(String Content, String orgId) {
List<String> keyWords = new ArrayList<>();
String[] keyWords_temp = null;
List<Map<String, Object>> positivestatisticsDict = (orgId == null || orgId.trim().equals("")) ? null : positivestatisticsMapper.selectList_usable(orgId.trim());
if (positivestatisticsDict != null && positivestatisticsDict.size() > 0) {
for (Map<String, Object> 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;
}
}