浏览代码

fix
患者列表

lifang 3 月之前
父节点
当前提交
19d3a56678

+ 18 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/common/service/impl/ALiYunServiceImpl.java

@@ -202,12 +202,29 @@ public class ALiYunServiceImpl implements ALiYunService {
                     .messages(Arrays.asList(systemMessage, userMessage))
                     .build();
             MultiModalConversationResult result = conv.call(param);
-            return JSONUtil.toList(String.valueOf(result.getOutput().getChoices().get(0).getMessage().getContent().get(0).get("text")), WxDoctorClinicRoomThumbnailVO.class);
+            String jsonResponse =String.valueOf(result.getOutput().getChoices().get(0).getMessage().getContent().get(0).get("text"));
+            String cleanedJson = cleanMarkdownJson(jsonResponse);
+            ObjectMapper objectMapper = new ObjectMapper();
+            if (cleanedJson.trim().startsWith("[")) {
+                List<Map<String, Object>> patientList = objectMapper.readValue(
+                        cleanedJson,
+                        new TypeReference<List<Map<String, Object>>>() {}
+                );
+                if(CollectionUtil.isNotEmpty(patientList)){
+                    return patientList.stream()
+                            .map(info ->
+                                    JSONUtil.toBean(JSONUtil.toJsonStr(info), WxDoctorClinicRoomThumbnailVO.class)
+                            )
+                            .filter(info-> StrUtil.isNotEmpty(info.getPatientCode()))
+                            .collect(Collectors.toList());
+                }
+            }
         }finally {
             if (ObjectUtil.isNotNull(uploadResult)) {
                 fileService.remove(Arrays.asList(uploadResult.getId()));
             }
         }
+        return null;
     }
 
     /**

+ 0 - 1
tr-modules/tr-module-smartFollowUp/src/main/java/cn/tr/module/smart/wx/controller/vo/BizWxAppletClinicDetailVO.java

@@ -47,7 +47,6 @@ public class BizWxAppletClinicDetailVO implements Serializable {
     @ApiModelProperty(value = "手术结束时间", position = 6)
     private Date clinicEndTime;
 
-
     @ApiModelProperty(value = "科室id",position = 7)
     private String deptId;
 

+ 2 - 3
tr-modules/tr-module-smartFollowUp/src/main/resources/llm/prompt.txt

@@ -10,11 +10,10 @@
 - 如果图片中的信息不完整或无法识别,在相应字段中填写"未知"或"未提供"。
 
 ## 限制
-- 只返回提取后的JSON格式数据,不添加任何额外的文字或解释。
-- 确保JSON格式严格按照用户提供的模板进行组织。
+- 严格遵循指定的JSON格式输出,只返回提取后的JSON格式数据,不添加任何额外的文字或解释。
 - 如果图片中的信息不完整或无法识别,请在除了年龄和手术时间的相应字段中填写"未知"或"未提供",如果年龄和手术时间无法识别,字段置空即可。
 
-
+## 输出格式
 [
     {
         "clinicName": "手术名称",

+ 1 - 1
tr-modules/tr-module-smartFollowUp/src/main/resources/llm/questionPrompt.txt

@@ -108,4 +108,4 @@ json
 
 问题标题上不能出现可多选字样
 
-只输出JSON格式内容,不要有任何额外解释
+只输出JSON格式内容,不要有任何额外解释

+ 2 - 1
tr-modules/tr-module-smartFollowUp/src/main/resources/mapper/smart/BizClinicRoomMapper.xml

@@ -105,7 +105,7 @@
         bqa.answer_time       as last_modify_question_time,
         su.id                 as doctor_id,
         su.nickname           as doctor_nickname,
-        bd.group_id as post_question_group_id,
+        bqg.id as post_question_group_id,
         bcr.image_url as image_url,
         bp.new_human as new_human,
         bp.card_no as card_no,
@@ -122,6 +122,7 @@
         left join   ( SELECT  *, ROW_NUMBER() OVER (PARTITION BY clinic_id ORDER BY answer_time DESC) as rn FROM biz_question_answer ) as bqa
             on bqa.clinic_id = bcr.id  and rn = 1
         left join biz_dept as bd on bd.id=bcr.dept_id
+        left join biz_question_group as bqg on bqg.id=bd.group_id
         left join (select * from im_group_user where user_id=  #{query.userId,jdbcType=VARCHAR}) as igu on igu.group_id=bcr.id
         <where>
             and bcr.deleted=0 and bcrwu.wx_user_id = #{query.userId}