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 f2d3c9e41..a9778844f 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 @@ -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> getEcgPdfImage(@RequestBody JSONObject params) { + Map mapResult = ecganalysisparasService.getEcgPdfImage(params); + return success(mapResult); + } + + @PutMapping("/SaveEcgPdf") @Operation(summary = "保存心电分析数据调用打印服务生成pdf") public CommonResult SaveEcgPdf(@RequestBody EcganalysisparasSaveReqVO updateReqVO) throws IOException { 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 139c98f2c..666608ab6 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 @@ -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 { * @return 编号 */ String insertEcganalysisparas(@Valid EcganalysisparascreateReqVO createReqVO); + /** * 更新心电分析数据 * @@ -62,12 +65,20 @@ public interface EcganalysisparasService extends IService { * @return 心电分析数据分页 */ PageResult 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类型的结果集 + */ + Map getEcgPdfImage(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 895ef7289..8df79acc3 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 @@ -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 implements EcganalysisparasService { +public class EcganalysisparasServiceImpl extends ServiceImpl 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 queryWrapper = new QueryWrapper<>(); queryWrapper.eq("examId", examID); queryWrapper.eq("orgId", orgId); return ecganalysisparasMapper.selectOne(queryWrapper); } + @Override + public Map getEcgPdfImage(JSONObject params) { + Map 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 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 { + 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; + } + } \ No newline at end of file