From 88b9c05638cb358439b9b7d7d74fa2ea5c58788e Mon Sep 17 00:00:00 2001 From: gongzhenkun <1658878546@qq.com> Date: Thu, 22 Dec 2022 17:36:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80AI=E8=BF=94=E5=9B=9E=E5=80=BC?= =?UTF-8?q?,=E8=BE=B9=E7=95=8C=E6=9D=A1=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TRecordServiceImpl.java | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java index e11751a..a685e7d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordServiceImpl.java @@ -169,19 +169,14 @@ public class TRecordServiceImpl implements ITRecordService public TRecordResp selectById(Long id) { TRecordResp tRecordResp = tRecordMapper.selectById(id); + if (null == tRecordResp.getAiResult()) { + return tRecordResp; + } String aiResult = tRecordResp.getAiResult(); - String aiResult2 = tRecordResp.getAiResult(); String updateResult = tRecordResp.getUpdateResult(); - String updateResult2 = tRecordResp.getUpdateResult(); if (!aiResult.contains("sz_color2")) { - try { - tRecordResp.setAiResult(dealJsonString(aiResult)); - tRecordResp.setAiResult2(dealJsonString(aiResult2)); - tRecordResp.setUpdateResult(dealJsonString(updateResult)); - tRecordResp.setUpdateResult2(dealJsonString(updateResult2)); - } catch (IOException e) { - throw new ServiceException("loading json template failed.."); - } + tRecordResp.setAiResult(dealJsonString(aiResult)); + tRecordResp.setUpdateResult(dealJsonString(updateResult)); } return tRecordResp; } @@ -191,9 +186,8 @@ public class TRecordServiceImpl implements ITRecordService * * @param jsonString json字符串 * @return {@code String} - * @throws IOException ioexception */ - private String dealJsonString(String jsonString) throws IOException { + private String dealJsonString(String jsonString) { if (null == jsonString || "".equals(jsonString)) { return ""; } @@ -271,15 +265,13 @@ public class TRecordServiceImpl implements ITRecordService { List tRecordResps = tRecordMapper.queryRecordListByPHDids(tPatientHospitalDoctor); TRecordResp tRecordResp1 = tRecordResps.get(0); - if (null != tRecordResp1 && !tRecordResp1.getAiResult().contains("sz_color2")) { + if (null != tRecordResp1 && null != tRecordResp1.getAiResult() && !tRecordResp1.getAiResult().contains("sz_color2")) { tRecordResps = tRecordResps.stream().peek(tRecordResp -> { - try { + if (null != tRecordResp.getAiResult()) { tRecordResp.setAiResult(dealJsonString(tRecordResp.getAiResult())); - tRecordResp.setAiResult2(dealJsonString(tRecordResp.getAiResult2())); + } + if (null != tRecordResp.getUpdateResult()) { tRecordResp.setUpdateResult(dealJsonString(tRecordResp.getUpdateResult())); - tRecordResp.setUpdateResult2(dealJsonString(tRecordResp.getUpdateResult2())); - } catch (IOException e) { - throw new ServiceException("加载json模板失败。"); } }).collect(Collectors.toList()); }