ecg的相关功能
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:
旺仔 2024-12-30 15:43:19 +08:00
parent e1ffe5e780
commit 57389293c9
3 changed files with 70 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.system.service.org.OrgUnitService;
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 com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
@ -100,6 +101,14 @@ public class EcganalysisparasController {
return success(true);
}
@PostMapping("/getEcgPdfImage")
@Operation(summary = "获取心电分析数据对应的pdf图像")
public CommonResult<Map<String, Object>> getEcgPdfImage(@RequestBody JSONObject params) {
Map<String, Object> mapResult = ecganalysisparasService.getEcgPdfImage(params);
return success(mapResult);
}
@PutMapping("/SaveEcgPdf")
@Operation(summary = "保存心电分析数据调用打印服务生成pdf")
public CommonResult<Boolean> SaveEcgPdf(@RequestBody EcganalysisparasSaveReqVO updateReqVO) throws IOException {

View File

@ -1,11 +1,13 @@
package cn.iocoder.yudao.module.tblist.service.ecganalysisparas;
import java.util.*;
import cn.iocoder.yudao.module.tblist.controller.admin.ecganalysisparas.vo.*;
import cn.iocoder.yudao.module.tblist.dal.dataobject.ecganalysisparas.EcganalysisparasDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.tblist.dal.dataobject.patientexamlist.PatientexamlistDO;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
@ -33,6 +35,7 @@ public interface EcganalysisparasService extends IService<EcganalysisparasDO> {
* @return 编号
*/
String insertEcganalysisparas(@Valid EcganalysisparascreateReqVO createReqVO);
/**
* 更新心电分析数据
*
@ -62,12 +65,20 @@ public interface EcganalysisparasService extends IService<EcganalysisparasDO> {
* @return 心电分析数据分页
*/
PageResult<EcganalysisparasDO> getEcganalysisparasPage(EcganalysisparasPageReqVO pageReqVO);
/**
* 通过examID获得心电分析数据
*
* @param examID 编号
* @return 心电分析数据
*/
EcganalysisparasDO getexamIDdata(String examID,String orgId);
EcganalysisparasDO getexamIDdata(String examID, String orgId);
/**
* 获取心电分析数据对应的pdf图像
*
* @param params JSONObject对象
* @return Map<String, Object>类型的结果集
*/
Map<String, Object> getEcgPdfImage(JSONObject params);
}

View File

@ -1,15 +1,23 @@
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.tblist.dal.dataobject.patientexamlist.PatientexamlistDO;
import cn.iocoder.yudao.module.tblist.dal.mysql.patientexamlist.PatientexamlistMapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.tblist.controller.admin.ecganalysisparas.vo.*;
import cn.iocoder.yudao.module.tblist.dal.dataobject.ecganalysisparas.EcganalysisparasDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -17,6 +25,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.tblist.dal.mysql.ecganalysisparas.EcganalysisparasMapper;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
@ -29,11 +38,17 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
*/
@Service
@Validated
public class EcganalysisparasServiceImpl extends ServiceImpl<EcganalysisparasMapper,EcganalysisparasDO > implements EcganalysisparasService {
public class EcganalysisparasServiceImpl extends ServiceImpl<EcganalysisparasMapper, EcganalysisparasDO> implements EcganalysisparasService {
@Resource
private EcganalysisparasMapper ecganalysisparasMapper;
@Resource
private ConfigService configService;
@Resource
private RestTemplate httpRestTemplate;
@Override
public String createEcganalysisparas(EcganalysisparasSaveReqVO createReqVO) {
// 插入
@ -71,7 +86,7 @@ public class EcganalysisparasServiceImpl extends ServiceImpl<EcganalysisparasMap
private void validateEcganalysisparasExists(String id) {
if (ecganalysisparasMapper.selectById(id) == null) {
throw exception(new ErrorCode(999,"1111"));
throw exception(new ErrorCode(999, "1111"));
}
}
@ -87,11 +102,42 @@ public class EcganalysisparasServiceImpl extends ServiceImpl<EcganalysisparasMap
}
@Override
public EcganalysisparasDO getexamIDdata(String examID,String orgId) {
public EcganalysisparasDO getexamIDdata(String examID, String orgId) {
QueryWrapper<EcganalysisparasDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("examId", examID);
queryWrapper.eq("orgId", orgId);
return ecganalysisparasMapper.selectOne(queryWrapper);
}
@Override
public Map<String, Object> getEcgPdfImage(JSONObject params) {
Map<String, Object> mapResult = new HashMap<>();
String data_Image = "";
ConfigDO configInfo = configService.getConfigByKey("url.printurl");
ConfigDO configInfo_ftpurl = configService.getConfigByKey("url.ecgpdf");
if (params != null && !params.isEmpty()) {
try {
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 {
mapResult.put("code", "200");
if (params.containsKey("type") && params.get("type") != null && params.get("type").toString().trim().equals("1"))
mapResult.put("dataImage", ("data:image/png;base64," + data_Image.trim()));
else
mapResult.put("dataImage", (configInfo_ftpurl.getValue().trim() + data_Image.trim()));
}
return mapResult;
}
}