统一AI返回值,边界条件修改

master
gongzhenkun 2 years ago
parent c77d89ddef
commit 88b9c05638

@ -169,19 +169,14 @@ public class TRecordServiceImpl implements ITRecordService
public TRecordResp selectById(Long id) public TRecordResp selectById(Long id)
{ {
TRecordResp tRecordResp = tRecordMapper.selectById(id); TRecordResp tRecordResp = tRecordMapper.selectById(id);
if (null == tRecordResp.getAiResult()) {
return tRecordResp;
}
String aiResult = tRecordResp.getAiResult(); String aiResult = tRecordResp.getAiResult();
String aiResult2 = tRecordResp.getAiResult();
String updateResult = tRecordResp.getUpdateResult(); String updateResult = tRecordResp.getUpdateResult();
String updateResult2 = tRecordResp.getUpdateResult();
if (!aiResult.contains("sz_color2")) { if (!aiResult.contains("sz_color2")) {
try {
tRecordResp.setAiResult(dealJsonString(aiResult)); tRecordResp.setAiResult(dealJsonString(aiResult));
tRecordResp.setAiResult2(dealJsonString(aiResult2));
tRecordResp.setUpdateResult(dealJsonString(updateResult)); tRecordResp.setUpdateResult(dealJsonString(updateResult));
tRecordResp.setUpdateResult2(dealJsonString(updateResult2));
} catch (IOException e) {
throw new ServiceException("loading json template failed..");
}
} }
return tRecordResp; return tRecordResp;
} }
@ -191,9 +186,8 @@ public class TRecordServiceImpl implements ITRecordService
* *
* @param jsonString json * @param jsonString json
* @return {@code String} * @return {@code String}
* @throws IOException ioexception
*/ */
private String dealJsonString(String jsonString) throws IOException { private String dealJsonString(String jsonString) {
if (null == jsonString || "".equals(jsonString)) { if (null == jsonString || "".equals(jsonString)) {
return ""; return "";
} }
@ -271,15 +265,13 @@ public class TRecordServiceImpl implements ITRecordService
{ {
List<TRecordResp> tRecordResps = tRecordMapper.queryRecordListByPHDids(tPatientHospitalDoctor); List<TRecordResp> tRecordResps = tRecordMapper.queryRecordListByPHDids(tPatientHospitalDoctor);
TRecordResp tRecordResp1 = tRecordResps.get(0); 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 -> { tRecordResps = tRecordResps.stream().peek(tRecordResp -> {
try { if (null != tRecordResp.getAiResult()) {
tRecordResp.setAiResult(dealJsonString(tRecordResp.getAiResult())); tRecordResp.setAiResult(dealJsonString(tRecordResp.getAiResult()));
tRecordResp.setAiResult2(dealJsonString(tRecordResp.getAiResult2())); }
if (null != tRecordResp.getUpdateResult()) {
tRecordResp.setUpdateResult(dealJsonString(tRecordResp.getUpdateResult())); tRecordResp.setUpdateResult(dealJsonString(tRecordResp.getUpdateResult()));
tRecordResp.setUpdateResult2(dealJsonString(tRecordResp.getUpdateResult2()));
} catch (IOException e) {
throw new ServiceException("加载json模板失败。");
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }

Loading…
Cancel
Save