WXL
2025-12-30 ed62678cd16042506bad5e5f75665a822f2d5717
src/views/business/course/components/DonorMaintenanceStage.vue
@@ -1,156 +1,1054 @@
<template>
  <base-stage :stage-data="stageData" :case-info="caseInfo">
    <template #header>
      <el-alert
        title="供者维护阶段"
        type="success"
        description="供者信息维护已完成,所有基本信息已确认无误"
        show-icon
        :closable="false"
      />
    </template>
  <div class="maintenance-detail">
    <!-- 基础信息 -->
    <el-row :gutter="20" style="margin-top: 20px;">
      <el-col :span="12">
        <el-card class="info-card">
          <div slot="header" class="card-header">
            <span>供者基本信息</span>
          </div>
          <el-descriptions :column="1" border size="small">
            <el-descriptions-item label="住院号">
              {{ caseInfo.hospitalNo }}
            </el-descriptions-item>
            <el-descriptions-item label="捐献者姓名">
              {{ caseInfo.donorName }}
            </el-descriptions-item>
            <el-descriptions-item label="性别">
              <dict-tag :options="dict.type.sys_user_sex" :value="parseInt(caseInfo.gender)" />
            </el-descriptions-item>
            <el-descriptions-item label="年龄">
              {{ caseInfo.age }} 岁
            </el-descriptions-item>
            <el-descriptions-item label="疾病诊断">
              {{ caseInfo.diagnosis }}
            </el-descriptions-item>
          </el-descriptions>
        </el-card>
      </el-col>
    <el-card class="assessment-card">
      <el-col :span="12">
        <el-card class="timeline-card">
          <div slot="header" class="card-header">
            <span>维护时间线</span>
          </div>
          <el-timeline>
            <el-timeline-item
              v-for="event in maintenanceEvents"
              :key="event.time"
              :timestamp="formatTime(event.time)"
              :type="event.type"
            >
              {{ event.content }}
            </el-timeline-item>
          </el-timeline>
        </el-card>
      </el-col>
    </el-row>
      <el-tabs v-model="activeTab" type="card" @tab-click="handleTabClick">
        <!-- 培养结果记录 -->
        <el-tab-pane label="培养结果" name="culture">
          <el-card class="culture-card">
            <div slot="header" class="clearfix">
              <span class="detail-title">培养结果记录</span>
            </div>
    <el-card style="margin-top: 20px;">
      <div slot="header" class="card-header">
        <span>维护记录详情</span>
            <el-table :data="cultureList" v-loading="cultureLoading">
              <el-table-column
                label="培养类型"
                align="center"
                prop="cultureType"
              >
                <!-- <template slot-scope="scope">
            <dict-tag
              :options="cultureTypeOptions"
              :value="scope.row.cultureType"
            />
          </template> -->
              </el-table-column>
              <el-table-column
                label="采样时间"
                align="center"
                prop="sampleTime"
              />
              <el-table-column label="培养结果" align="center" prop="result">
                <template slot-scope="scope">
                  <el-tag
                    :type="scope.row.result === '阴性' ? 'success' : 'danger'"
                    effect="plain"
                  >
                    {{ scope.row.result }}
                  </el-tag>
                </template>
              </el-table-column>
              <!-- 附件列 -->
              <el-table-column label="附件" align="center">
                <template slot-scope="scope">
                  <el-button
                    v-if="
                      scope.row.attachments && scope.row.attachments.length > 0
                    "
                    size="mini"
                    type="text"
                    @click="handleViewCultureAttachments(scope.row)"
                  >
                    查看附件({{ scope.row.attachments.length }})
                  </el-button>
                  <span v-else>无附件</span>
                </template>
              </el-table-column>
            </el-table>
            <pagination
              v-show="cultureTotal > 0"
              :total="cultureTotal"
              :page.sync="cultureQueryParams.pageNum"
              :limit.sync="cultureQueryParams.pageSize"
              @pagination="getCultureList"
            />
          </el-card>
        </el-tab-pane>
        <!-- 肝功能肾功能 -->
        <el-tab-pane label="肝功能肾功能" name="liverKidney">
          <liver-kidney-panel
            ref="liverKidney"
            :is-editing="isEdit && activeTab === 'liverKidney'"
            @data-change="handleLiverKidneyDataChange"
          />
        </el-tab-pane>
        <!-- 血常规 -->
        <el-tab-pane label="血常规" name="bloodRoutine">
          <blood-routine-panel
            ref="bloodRoutine"
            :is-editing="isEdit && activeTab === 'bloodRoutine'"
            @data-change="handleBloodRoutineDataChange"
          />
        </el-tab-pane>
        <!-- 尿常规 -->
        <el-tab-pane label="尿常规" name="urineRoutine">
          <urine-routine-panel
            ref="urineRoutine"
            :is-editing="isEdit && activeTab === 'urineRoutine'"
            @data-change="handleUrineRoutineDataChange"
          />
        </el-tab-pane>
      </el-tabs>
    </el-card>
    <!-- 培养结果记录 -->
    <!-- 简化后的护理核查记录 -->
    <el-card class="record-card">
      <div slot="header" class="clearfix">
        <span class="detail-title">护理核查记录</span>
      </div>
      <el-table :data="maintenanceRecords" border>
        <el-table-column label="维护项目" prop="item" width="150" />
        <el-table-column label="维护内容" prop="content" min-width="200" />
        <el-table-column label="维护人" prop="operator" width="120" />
        <el-table-column label="维护时间" width="160">
      <el-table :data="recordList" v-loading="recordLoading">
        <el-table-column
          label="核查时间"
          align="center"
          prop="recordTime"
          width="160"
        />
        <el-table-column
          label="核查人"
          align="center"
          prop="recorder"
          width="100"
        />
        <el-table-column
          label="核查记录"
          align="center"
          prop="checkRecord"
          min-width="200"
          show-overflow-tooltip
        />
        <!-- 附件列 -->
        <el-table-column label="附件" align="center" width="120">
          <template slot-scope="scope">
            {{ formatTime(scope.row.time) }}
          </template>
        </el-table-column>
        <el-table-column label="状态" width="100">
          <template slot-scope="scope">
            <el-tag :type="scope.row.status === 'completed' ? 'success' : 'warning'">
              {{ scope.row.status === 'completed' ? '已完成' : '进行中' }}
            </el-tag>
            <el-button
              v-if="scope.row.attachments && scope.row.attachments.length > 0"
              size="mini"
              type="text"
              @click="handleViewRecordAttachments(scope.row)"
            >
              查看附件({{ scope.row.attachments.length }})
            </el-button>
            <span v-else>无附件</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="recordTotal > 0"
        :total="recordTotal"
        :page.sync="recordQueryParams.pageNum"
        :limit.sync="recordQueryParams.pageSize"
        @pagination="getRecordList"
      />
    </el-card>
  </base-stage>
    <!-- 培养记录编辑对话框 -->
    <el-dialog
      :title="cultureDialogTitle"
      :visible.sync="cultureDialogVisible"
      width="700px"
      :close-on-click-modal="false"
    >
      <el-form
        :model="cultureForm"
        ref="cultureForm"
        :rules="cultureRules"
        label-width="120px"
      >
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="培养类型" prop="cultureType">
              <el-select
                v-model="cultureForm.cultureType"
                placeholder="请选择培养类型"
                style="width: 100%"
              >
                <el-option
                  v-for="item in cultureTypeOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.label"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采样时间" prop="sampleTime">
              <el-date-picker
                v-model="cultureForm.sampleTime"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择采样时间"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="培养结果" prop="result">
              <el-select
                v-model="cultureForm.result"
                placeholder="请选择培养结果"
                style="width: 100%"
              >
                <el-option label="阴性" value="阴性" />
                <el-option label="阳性" value="阳性" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 附件上传 -->
        <el-form-item label="附件">
          <upload-attachment
            :file-list="cultureForm.attachments"
            @change="handleCultureAttachmentChange"
          />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cultureDialogVisible = false">取消</el-button>
        <el-button
          type="primary"
          @click="handleSaveCulture"
          :loading="cultureSaveLoading"
          >保存</el-button
        >
      </span>
    </el-dialog>
    <!-- 护理核查记录编辑对话框 -->
    <el-dialog
      :title="recordDialogTitle"
      :visible.sync="recordDialogVisible"
      width="700px"
      :close-on-click-modal="false"
    >
      <el-form
        :model="recordForm"
        ref="recordForm"
        :rules="recordRules"
        label-width="120px"
      >
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="核查时间" prop="recordTime">
              <el-date-picker
                v-model="recordForm.recordTime"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择核查时间"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="核查人" prop="recorder">
              <el-input
                v-model="recordForm.recorder"
                placeholder="请输入核查人姓名"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="核查记录" prop="checkRecord">
          <el-input
            type="textarea"
            :rows="4"
            v-model="recordForm.checkRecord"
            placeholder="请输入核查记录内容"
          />
        </el-form-item>
        <!-- 附件上传 -->
        <el-form-item label="附件">
          <upload-attachment
            :file-list="recordForm.attachments"
            @change="handleRecordAttachmentChange"
          />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="recordDialogVisible = false">取消</el-button>
        <el-button
          type="primary"
          @click="handleSaveRecord"
          :loading="recordSaveLoading"
          >保存</el-button
        >
      </span>
    </el-dialog>
    <!-- 附件预览对话框 -->
    <attachment-preview
      :visible="attachmentPreviewVisible"
      :file-list="currentAttachmentList"
      :title="attachmentPreviewTitle"
      @close="attachmentPreviewVisible = false"
    />
  </div>
</template>
<script>
import BaseStage from './BaseStage.vue';
import { getMaintenanceDetail, updateMaintenance } from "./api//mockMaintenanceApi";
import {
  listCultureResults,
  addCultureResult,
  updateCultureResult,
  deleteCultureResult
} from "./api/mockMaintenanceApi";
import {
  listNursingRecords,
  addNursingRecord,
  updateNursingRecord,
  deleteNursingRecord
} from "./api//mockMaintenanceApi";
import Pagination from "@/components/Pagination";
import UploadAttachment from "@/components/UploadAttachment";
import AttachmentPreview from "@/components/AttachmentPreview";
import LiverKidneyPanel from "./components/LiverKidneyPanel.vue";
import BloodRoutinePanel from "./components/BloodRoutinePanel.vue";
import UrineRoutinePanel from "./components/UrineRoutinePanel.vue";
export default {
  name: 'DonorMaintenanceStage',
  components: { BaseStage },
  dicts: ['sys_user_sex'],
  props: {
    stageData: {
      type: Object,
      default: () => ({})
    },
    caseInfo: {
      type: Object,
      default: () => ({})
    }
  name: "MaintenanceDetail",
  components: {
    Pagination,
    UploadAttachment,
    AttachmentPreview,
    LiverKidneyPanel,
    BloodRoutinePanel,
    UrineRoutinePanel
  },
  data() {
    return {
      maintenanceEvents: [
      isEdit: true,
      form: {
        id: undefined,
        caseNo: "",
        donorName: "",
        gender: "",
        age: "",
        diagnosis: "",
        hospitalName: "",
        patientStatus: "1",
        admissionTime: "",
        dischargeTime: "",
        coordinator: "",
        bloodType: "",
        rhFactor: "",
        specialMedicalHistory: "",
        incompleteReason: ""
      },
      activeTab: "culture",
      // 培养结果相关数据
      // 培养结果相关数据
      cultureList: [
        {
          time: '2023-12-01 08:30:00',
          content: '供者基本信息录入',
          type: 'primary'
          id: 1,
          cultureType: "血培养",
          sampleTime: "2024-12-19 10:30:00",
          result: "阴性",
          bacteria: "",
          drugSensitivity: "",
          testingInstitution: "青岛大学附属医院",
          specimenType: "血液",
          remarks: "常规检测",
          attachments: [
            {
              id: 1,
              fileName: "血培养报告.pdf",
              fileUrl:
                "http://localhost:8080/profile/upload/2025/12/27/1.COPO供体评估表.pdf",
              fileSize: 1024000,
              uploadTime: "2024-12-19 11:00:00"
            }
          ]
        },
        {
          time: '2023-12-01 09:15:00',
          content: '医疗档案建立',
          type: 'success'
          id: 3,
          cultureType: "血培养",
          sampleTime: "2024-12-20 09:15:00",
          result: "阴性",
          bacteria: "",
          drugSensitivity: "",
          testingInstitution: "广州检测中心",
          specimenType: "尿液",
          remarks: "清洁中段尿标本",
          attachments: []
        },
        {
          time: '2023-12-01 10:00:00',
          content: '初步评估完成',
          type: 'success'
          id: 2,
          cultureType: "痰培养结果",
          sampleTime: "2024-12-19 14:20:00",
          result: "阳性",
          bacteria: "金黄色葡萄球菌",
          drugSensitivity: "对青霉素敏感,对头孢类中介",
          testingInstitution: "上海医学检验所",
          specimenType: "痰液",
          remarks: "药敏试验完成",
          attachments: [
            {
              id: 2,
              fileName: "痰培养结果.jpg",
              fileUrl:
                "https://img95.699pic.com/photo/40142/8262.jpg_wh860.jpg",
              fileSize: 512000,
              uploadTime: "2024-12-19 15:30:00"
            },
            {
              id: 3,
              fileName: "药敏报告.pdf",
              fileUrl:
                "http://localhost:8080/profile/upload/2025/12/27/(吴龙8.7)每日工作总结.pdf",
              fileSize: 768000,
              uploadTime: "2024-12-19 16:00:00"
            }
          ]
        },
        {
          id: 4,
          cultureType: "真菌培养",
          sampleTime: "2024-12-20 11:45:00",
          result: "阳性",
          bacteria: "大肠杆菌",
          drugSensitivity: "对左氧氟沙星敏感",
          testingInstitution: "深圳人民医院",
          specimenType: "伤口分泌物",
          remarks: "术后伤口感染监测",
          attachments: [
            {
              id: 4,
              fileName: "真菌培养.pdf",
              fileUrl: "/reports/culture4.pdf",
              fileSize: 890000,
              uploadTime: "2024-12-20 13:20:00"
            }
          ]
        }
      ],
      maintenanceRecords: [
      cultureLoading: false,
      cultureTotal: 5,
      cultureQueryParams: {
        pageNum: 1,
        pageSize: 10
      },
      cultureDialogVisible: false,
      cultureDialogTitle: "",
      cultureSaveLoading: false,
      cultureForm: {
        id: undefined,
        cultureType: "",
        sampleTime: "",
        result: "阴性",
        attachments: [] // 新增附件字段
      },
      cultureRules: {
        cultureType: [
          { required: true, message: "请选择培养类型", trigger: "change" }
        ],
        sampleTime: [
          { required: true, message: "请选择采样时间", trigger: "change" }
        ],
        result: [
          { required: true, message: "请选择培养结果", trigger: "change" }
        ]
      },
      cultureTypeOptions: [
        { value: "1", label: "血培养" },
        { value: "2", label: "痰培养" },
        { value: "3", label: "尿培养" },
        { value: "4", label: "伤口分泌物" },
        { value: "5", label: "脑脊液培养" },
        { value: "6", label: "其他" }
      ],
      // 护理核查记录相关数据
      recordList: [
        {
          item: '基本信息',
          content: '供者身份信息确认与录入',
          operator: '张医生',
          time: '2023-12-01 08:30:00',
          status: 'completed'
          id: 1,
          recordTime: "2024-12-19 08:30:00",
          recorder: "张护士",
          temperature: 36.8,
          heartRate: 78,
          bloodPressure: "120/80",
          respirationRate: 18,
          oxygenSaturation: 98,
          urineOutput: 60,
          cvp: 8,
          checkRecord: "患者生命体征平稳,意识清楚,配合治疗",
          remarks: "夜间睡眠良好",
          attachments: [
            {
              id: 1,
              fileName: "早班护理记录.jpg",
              fileUrl: "/records/nursing1.jpg",
              fileSize: 1024000,
              uploadTime: "2024-12-19 09:00:00"
            }
          ]
        },
        {
          item: '医疗档案',
          content: '病史资料收集与整理',
          operator: '李护士',
          time: '2023-12-01 09:15:00',
          status: 'completed'
          id: 2,
          recordTime: "2024-12-19 14:30:00",
          recorder: "李护士",
          temperature: 37.2,
          heartRate: 82,
          bloodPressure: "118/76",
          respirationRate: 16,
          oxygenSaturation: 97,
          urineOutput: 45,
          cvp: 7.5,
          checkRecord: "患者午后体温略有升高,观察中",
          remarks: "建议增加水分摄入",
          attachments: []
        },
        {
          item: '初步评估',
          content: '捐献适宜性初步评估',
          operator: '王主任',
          time: '2023-12-01 10:00:00',
          status: 'completed'
          id: 3,
          recordTime: "2024-12-19 20:30:00",
          recorder: "王护士",
          temperature: 36.9,
          heartRate: 75,
          bloodPressure: "122/78",
          respirationRate: 17,
          oxygenSaturation: 98,
          urineOutput: 55,
          cvp: 8.2,
          checkRecord: "晚间生命体征稳定,患者休息良好",
          remarks: "夜间监测无异常",
          attachments: [
            {
              id: 2,
              fileName: "晚班护理记录.pdf",
              fileUrl: "/records/nursing3.pdf",
              fileSize: 890000,
              uploadTime: "2024-12-19 21:00:00"
            },
            {
              id: 3,
              fileName: "体征监测表.xlsx",
              fileUrl: "/records/monitoring3.xlsx",
              fileSize: 256000,
              uploadTime: "2024-12-19 21:15:00"
            }
          ]
        },
        {
          id: 4,
          recordTime: "2024-12-20 08:30:00",
          recorder: "赵护士",
          temperature: 36.7,
          heartRate: 80,
          bloodPressure: "119/77",
          respirationRate: 18,
          oxygenSaturation: 99,
          urineOutput: 65,
          cvp: 7.8,
          checkRecord: "晨间生命体征正常,患者精神状态良好",
          remarks: "准备今日检查",
          attachments: []
        },
        {
          id: 5,
          recordTime: "2024-12-20 12:30:00",
          recorder: "刘护士",
          temperature: 37.1,
          heartRate: 85,
          bloodPressure: "121/79",
          respirationRate: 19,
          oxygenSaturation: 96,
          urineOutput: 40,
          cvp: 8.5,
          checkRecord: "午间体温略有波动,继续观察",
          remarks: "已通知医生",
          attachments: [
            {
              id: 4,
              fileName: "午间护理记录.jpg",
              fileUrl: "/records/nursing5.jpg",
              fileSize: 765000,
              uploadTime: "2024-12-20 13:00:00"
            }
          ]
        }
      ]
      ],
      recordLoading: false,
      recordTotal: 4,
      recordQueryParams: {
        pageNum: 1,
        pageSize: 10
      },
      recordDialogVisible: false,
      recordDialogTitle: "",
      recordSaveLoading: false,
      recordForm: {
        id: undefined,
        recordTime: "",
        recorder: "",
        checkRecord: "", // 改为单字段记录
        attachments: [] // 新增附件字段
      },
      recordRules: {
        recordTime: [
          { required: true, message: "请选择核查时间", trigger: "change" }
        ],
        recorder: [
          { required: true, message: "请输入核查人", trigger: "blur" }
        ],
        checkRecord: [
          { required: true, message: "请输入核查记录", trigger: "blur" }
        ]
      },
      // 附件预览相关
      attachmentPreviewVisible: false,
      currentAttachmentList: [],
      attachmentPreviewTitle: ""
    };
  },
  created() {
    const id = this.$route.query.id;
    // this.isEdit = this.$route.query.edit === "true";
    if (id) {
      this.getDetail(id);
      this.getCultureList();
      this.getRecordList();
    }
  },
  methods: {
    // 获取详情
    getDetail(id) {
      getMaintenanceDetail(id).then(response => {
        if (response.code === 200) {
          this.form = response.data;
        }
      });
    },
    // 培养记录附件变更
    handleCultureAttachmentChange(fileList) {
      this.cultureForm.attachments = fileList;
    },
    // 护理记录附件变更
    handleRecordAttachmentChange(fileList) {
      this.recordForm.attachments = fileList;
    },
    // 查看培养记录附件
    handleViewCultureAttachments(row) {
      console.log(22, row.attachments);
      this.currentAttachmentList = row.attachments || [];
      this.attachmentPreviewTitle = `培养记录附件 - ${row.cultureType}`;
      this.attachmentPreviewVisible = true;
    },
    handleTabClick(tab) {
      this.$nextTick(() => {
        console.log(tab.name, 88);
        const tableRef=null;
        if (tab.name == "liverKidney") {
           tableRef = this.$refs.liverKidney; // 请替换为您的表格 ref
        } else if (tab.name == "bloodRoutine") {
           tableRef = this.$refs.bloodRoutine; // 请替换为您的表格 ref
        } else if (tab.name == "bloodRoutine") {
           tableRef = this.$refs.bloodRoutine; // 请替换为您的表格 ref
        }
        // 如果是 el-table,尝试调用其 doLayout 方法
        if (tableRef && tableRef.doLayout) {
          tableRef.doLayout();
        }
        // 或者,更通用的强制重新渲染方式
        this.$forceUpdate(); // 慎用,可能引发其他问题[1](@ref)
      });
    },
    // 查看护理记录附件
    handleViewRecordAttachments(row) {
      this.currentAttachmentList = row.attachments || [];
      this.attachmentPreviewTitle = `护理核查记录附件 - ${row.recorder}`;
      this.attachmentPreviewVisible = true;
    },
    // 培养记录相关方法
    getCultureList() {
      this.cultureLoading = true;
      listCultureResults(this.form.id, this.cultureQueryParams)
        .then(response => {
          if (response.code === 200) {
            // this.cultureList = response.data.rows;
            // this.cultureTotal = response.data.total;
          }
          this.cultureLoading = false;
        })
        .catch(() => {
          this.cultureLoading = false;
        });
    },
    handleAddCulture() {
      this.cultureDialogTitle = "新增培养记录";
      this.cultureForm = {
        id: undefined,
        cultureType: "",
        sampleTime: "",
        result: "阴性",
        bacteria: "",
        drugSensitivity: "",
        testingInstitution: "",
        specimenType: "",
        remarks: ""
      };
      this.cultureDialogVisible = true;
      this.$nextTick(() => {
        this.$refs.cultureForm && this.$refs.cultureForm.clearValidate();
      });
    },
    handleEditCulture(row) {
      this.cultureDialogTitle = "编辑培养记录";
      this.cultureForm = { ...row };
      this.cultureDialogVisible = true;
      this.$nextTick(() => {
        this.$refs.cultureForm && this.$refs.cultureForm.clearValidate();
      });
    },
    handleViewCulture(row) {
      this.$alert(
        `
        <div>
          <p><strong>培养类型:</strong>${this.getCultureTypeLabel(
            row.cultureType
          )}</p>
          <p><strong>采样时间:</strong>${row.sampleTime}</p>
          <p><strong>培养结果:</strong>${row.result}</p>
          <p><strong>检测机构:</strong>${row.testingInstitution}</p>
        </div>
      `,
        "培养记录详情",
        {
          dangerouslyUseHTMLString: true,
          customClass: "detail-dialog"
        }
      );
    },
    toggleEditMode() {
      this.isEdit = !this.isEdit;
      // if (!this.isEdit) {
      //   this.saveAllData();
      // }
    },
    handleLiverKidneyDataChange(data) {
      console.log("肝功能肾功能数据变更:", data);
      // 处理数据保存或临时存储
    },
    handleBloodRoutineDataChange(data) {
      console.log("血常规功能数据变更:", data);
      // 处理数据保存或临时存储
    },
    handleUrineRoutineDataChange(data) {
      console.log("尿常规功能数据变更:", data);
      // 处理数据保存或临时存储
    },
    // 保存培养记录
    handleSaveCulture() {
      this.$refs.cultureForm.validate(valid => {
        if (valid) {
          this.cultureSaveLoading = true;
          const api = this.cultureForm.id
            ? updateCultureResult
            : addCultureResult;
          const requestData = {
            ...this.cultureForm,
            maintenanceId: this.form.id
          };
          api(requestData)
            .then(response => {
              if (response.code === 200) {
                this.$message.success(
                  this.cultureForm.id ? "修改成功" : "新增成功"
                );
                this.cultureDialogVisible = false;
                this.getCultureList();
              }
              this.cultureSaveLoading = false;
            })
            .catch(() => {
              this.cultureSaveLoading = false;
            });
        }
      });
    },
    handleDeleteCulture(row) {
      this.$confirm("确定要删除这条培养记录吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          deleteCultureResult(row.id).then(response => {
            if (response.code === 200) {
              this.$message.success("删除成功");
              this.getCultureList();
            }
          });
        })
        .catch(() => {});
    },
    getCultureTypeLabel(value) {
      const type = this.cultureTypeOptions.find(item => item.value === value);
      return type ? type.label : "未知";
    },
    // 护理核查记录相关方法
    getRecordList() {
      this.recordLoading = true;
      listNursingRecords(this.form.id, this.recordQueryParams)
        .then(response => {
          if (response.code === 200) {
            // this.recordList = response.data.rows;
            // this.recordTotal = response.data.total;
          }
          this.recordLoading = false;
        })
        .catch(() => {
          this.recordLoading = false;
        });
    },
    handleAddRecord() {
      this.recordDialogTitle = "新增护理核查记录";
      this.recordForm = {
        id: undefined,
        recordTime: new Date()
          .toISOString()
          .replace("T", " ")
          .substring(0, 19),
        recorder: "当前用户", // 实际项目中从用户信息获取
        temperature: 36.5,
        heartRate: 80,
        bloodPressure: "120/80",
        respirationRate: 18,
        oxygenSaturation: 98,
        urineOutput: 50,
        cvp: 8,
        remarks: ""
      };
      this.recordDialogVisible = true;
      this.$nextTick(() => {
        this.$refs.recordForm && this.$refs.recordForm.clearValidate();
      });
    },
    handleEditRecord(row) {
      this.recordDialogTitle = "编辑护理核查记录";
      this.recordForm = { ...row };
      this.recordDialogVisible = true;
      this.$nextTick(() => {
        this.$refs.recordForm && this.$refs.recordForm.clearValidate();
      });
    },
    handleViewRecord(row) {
      this.$alert(
        `
        <div>
          <p><strong>核查时间:</strong>${row.recordTime}</p>
          <p><strong>核查人:</strong>${row.recorder}</p>
          <p><strong>生命体征:</strong></p>
          <ul>
            <li>体温:${row.temperature}℃</li>
            <li>心率:${row.heartRate}次/分</li>
            <li>血压:${row.bloodPressure}mmHg</li>
            <li>呼吸:${row.respirationRate}次/分</li>
            <li>血氧饱和度:${row.oxygenSaturation}%</li>
            <li>尿量:${row.urineOutput}ml/h</li>
          </ul>
          <p><strong>备注:</strong>${row.remarks || "无"}</p>
        </div>
      `,
        "护理核查记录详情",
        {
          dangerouslyUseHTMLString: true,
          customClass: "detail-dialog"
        }
      );
    },
    handleSaveRecord() {
      this.$refs.recordForm.validate(valid => {
        if (valid) {
          this.recordSaveLoading = true;
          const api = this.recordForm.id
            ? updateNursingRecord
            : addNursingRecord;
          const requestData = {
            ...this.recordForm,
            maintenanceId: this.form.id
          };
          api(requestData)
            .then(response => {
              if (response.code === 200) {
                this.$message.success(
                  this.recordForm.id ? "修改成功" : "新增成功"
                );
                this.recordDialogVisible = false;
                this.getRecordList();
              }
              this.recordSaveLoading = false;
            })
            .catch(() => {
              this.recordSaveLoading = false;
            });
        }
      });
    },
    handleDeleteRecord(row) {
      this.$confirm("确定要删除这条护理核查记录吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          deleteNursingRecord(row.id).then(response => {
            if (response.code === 200) {
              this.$message.success("删除成功");
              this.getRecordList();
            }
          });
        })
        .catch(() => {});
    },
    // 保存基本信息
    handleSave() {
      this.$refs.form.validate(valid => {
        if (valid) {
          updateMaintenance(this.form).then(response => {
            if (response.code === 200) {
              this.$message.success("保存成功");
              this.isEdit = false;
            }
          });
        }
      });
    }
  }
};
</script>
<style scoped>
.card-header {
  font-weight: 600;
  color: #303133;
.maintenance-detail {
  padding: 20px;
}
.info-card, .timeline-card {
  height: 100%;
.detail-card {
  margin-bottom: 20px;
}
.culture-card {
  margin-bottom: 20px;
}
.record-card {
  margin-bottom: 20px;
}
.detail-title {
  font-size: 16px;
  font-weight: bold;
}
.maintenance-detail {
  padding: 20px;
}
.detail-card {
  margin-bottom: 20px;
}
.culture-card {
  margin-bottom: 20px;
}
.record-card {
  margin-bottom: 20px;
}
.detail-title {
  font-size: 16px;
  font-weight: bold;
}
.medical-panel {
  padding: 20px;
}
.attachment-section {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #ebeef5;
  border-radius: 4px;
}
.attachment-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: #409eff;
}
.required-item::before {
  content: "*";
  color: #f56c6c;
  margin-right: 4px;
}
.assessment-card {
  margin-bottom: 20px;
}
.medical-table {
  width: 100%;
  margin-bottom: 20px;
}
.dynamic-column {
  min-width: 120px;
}
.fixed-width .el-button {
  margin: 0 2px;
}
/* 详情对话框样式 */
:deep(.detail-dialog) {
  width: 500px;
}
:deep(.detail-dialog .el-message-box__content) {
  line-height: 1.8;
}
:deep(.detail-dialog ul) {
  margin: 10px 0;
  padding-left: 20px;
}
:deep(.detail-dialog li) {
  margin-bottom: 5px;
}
</style>