|
|
@@ -4,6 +4,7 @@ package org.ruoyi.chat.service.chat.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
@@ -181,6 +182,9 @@ public class PatientRecordServiceImpl implements PatientRecordService {
|
|
|
|
|
|
|
|
|
record.setId(UUID.randomUUID().toString());
|
|
|
+ // 使用雪花ID(需要引入雪花ID工具类):
|
|
|
+ // record.setId(String.valueOf(IdWorker.getId())); // MyBatis-Plus内置
|
|
|
+ // 或者:record.setId(IdUtils.snowflakeId()); // 若项目有自定义工具类
|
|
|
record.setPatientId(getString(data, "patientId"));
|
|
|
record.setVisitId(getString(data, "visitId"));
|
|
|
record.setAdmissionNo(getString(data, "admissionNo"));
|
|
|
@@ -574,11 +578,15 @@ public class PatientRecordServiceImpl implements PatientRecordService {
|
|
|
case "抢救记录":
|
|
|
case "手术记录":
|
|
|
case "医嘱记录":
|
|
|
- case "知情同意书":
|
|
|
// 这些类型是数组,需要逐条拆分
|
|
|
formattedContent.append(formatMedicalRecords(content));
|
|
|
break;
|
|
|
|
|
|
+ case "知情同意书":
|
|
|
+ // 知情同意书带分割线格式化
|
|
|
+ formattedContent.append(formatConsentFormsContent(content));
|
|
|
+ break;
|
|
|
+
|
|
|
case "检验报告单":
|
|
|
case "检查报告单":
|
|
|
// 检验 / 检查报告单单独格式化
|
|
|
@@ -616,6 +624,38 @@ public class PatientRecordServiceImpl implements PatientRecordService {
|
|
|
return formattedContent.toString().trim();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 知情同意书的专用格式化(带分割线)
|
|
|
+ */
|
|
|
+ private String formatConsentFormsContent(String content) {
|
|
|
+ if (content == null || content.trim().isEmpty()) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuilder formattedContent = new StringBuilder();
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 解析JSON数组,每个元素为一份知情同意书
|
|
|
+ List<String> consentForms = objectMapper.readValue(content, List.class);
|
|
|
+
|
|
|
+ for (String form : consentForms) {
|
|
|
+ if (form == null || form.trim().isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 直接添加内容和分割线
|
|
|
+ formattedContent.append(form.trim())
|
|
|
+ .append("\n\n========================================================== 分隔线 ==========================================================\n\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return "解析知情同意书失败";
|
|
|
+ }
|
|
|
+
|
|
|
+ return formattedContent.toString().trim();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检验/检查报告单的专用格式化
|
|
|
*/
|