Quellcode durchsuchen

医生端新增患者信息表

cgp vor 3 Tagen
Ursprung
Commit
bc97c2c052
3 geänderte Dateien mit 546 neuen und 0 gelöschten Zeilen
  1. 62 0
      src/api/patientInfo.js
  2. 13 0
      src/router/index.js
  3. 471 0
      src/views/patientInfo/index.vue

+ 62 - 0
src/api/patientInfo.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询患者列表
+export function listPatientInfo(query) {
+  return request({
+    url: '/app/patientInfo/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询患者详情
+export function getPatientInfo(id) {
+  return request({
+    url: '/app/patientInfo/' + id,
+    method: 'get'
+  })
+}
+
+// 查询当前登录医生详情(姓名、执业证号、签名图片)
+export function getDoctorBaseInfo() {
+  return request({
+    url: '/app/patientInfo/getDoctorBaseInfo',
+    method: 'get'
+  })
+}
+
+// 新增患者
+export function addPatientInfo(data) {
+  return request({
+    url: '/app/patientInfo',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改患者
+export function updatePatientInfo(data) {
+  return request({
+    url: '/app/patientInfo',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除患者
+export function delPatientInfo(ids) {
+  return request({
+    url: '/app/patientInfo/' + ids,
+    method: 'delete'
+  })
+}
+
+// 导出患者
+export function exportPatientInfo(query) {
+  return request({
+    url: '/app/patientInfo/export',
+    method: 'post',
+    params: query,
+    responseType: 'blob'
+  })
+}

+ 13 - 0
src/router/index.js

@@ -215,6 +215,19 @@ export const constantRoutes = [
       }
     ]
   },
+  {
+    path: '/patientInfo',
+    component: Layout,
+    redirect: 'noredirect',
+    children: [
+      {
+        path: 'Index',
+        component: (resolve) => require(['@/views/patientInfo/index'], resolve),
+        name: '患者信息表',
+        meta: { title: '患者信息表', icon: 'tab', affix: false }
+      }
+    ]
+  },
   {
     path: '/doctorArticle',
     component: Layout,

+ 471 - 0
src/views/patientInfo/index.vue

@@ -0,0 +1,471 @@
+<template>
+  <div class="app-container">
+    <!-- 搜索栏 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
+      <el-form-item label="患者姓名" prop="patientName">
+        <el-input v-model="queryParams.patientName" placeholder="请输入患者姓名" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="电话" prop="phone">
+        <el-input v-model="queryParams.phone" placeholder="请输入电话" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="接诊医生" prop="receptionDoctor">
+        <el-input v-model="queryParams.receptionDoctor" placeholder="请输入接诊医生" clearable size="small" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="接诊时间">
+        <el-date-picker
+          v-model="dateRange"
+          size="small"
+          style="width: 240px"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="['00:00:00', '23:59:59']"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 工具栏 -->
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <!-- 表格 -->
+    <el-table v-loading="loading" :data="patientList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="患者姓名" align="center" prop="patientName" />
+      <el-table-column label="性别" align="center" prop="sex" :formatter="sexFormat" />
+      <el-table-column label="年龄" align="center" prop="age" />
+      <el-table-column label="电话" align="center" prop="phone" />
+      <el-table-column label="接诊时间" align="center" prop="receptionTime" width="180">
+        <template slot-scope="scope">{{ parseTime(scope.row.receptionTime) }}</template>
+      </el-table-column>
+      <el-table-column label="接诊医生" align="center" prop="receptionDoctor" />
+      <el-table-column label="所在市" align="center" prop="city" />
+      <el-table-column label="诊断" align="center" prop="diagnosis" show-overflow-tooltip />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body :close-on-click-modal="false">
+      <el-form ref="form" :model="form" :rules="rules" label-width="100px" size="small">
+        <!-- 第一排:患者姓名、性别、年龄、电话 -->
+        <div style="display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 15px;">
+          <el-form-item label="患者姓名" prop="patientName" style="flex: 2; margin-bottom: 0;">
+            <el-input v-model="form.patientName" placeholder="请输入患者姓名" />
+          </el-form-item>
+          <el-form-item label="性别" prop="sex" style="flex: 1.5; margin-bottom: 0;">
+            <el-select
+              v-model="form.sex"
+              placeholder="请选择性别"
+              popper-append-to-body
+              style="width: 100%"
+              @change="onSexChange"
+            >
+              <el-option
+                v-for="dict in sexOptions"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="年龄" prop="age" style="flex: 1; margin-bottom: 0;">
+            <el-input-number v-model="form.age" :min="18" :max="200" placeholder="年龄" />
+          </el-form-item>
+          <el-form-item label="电话" prop="phone" style="flex: 2.5; margin-bottom: 0;">
+            <el-input v-model="form.phone" placeholder="请输入电话" />
+          </el-form-item>
+        </div>
+
+        <!-- 第二排:接诊时间、接诊医生、所在市 -->
+        <div style="display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 15px;">
+          <el-form-item label="接诊时间" prop="receptionTime" style="flex: 1.5; margin-bottom: 0;">
+            <el-date-picker
+              v-model="form.receptionTime"
+              type="datetime"
+              placeholder="选择接诊时间"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              style="width: 100%"
+            />
+          </el-form-item>
+          <el-form-item label="接诊医生" prop="receptionDoctor" style="flex: 1; margin-bottom: 0;">
+            <el-input v-model="form.receptionDoctor" placeholder="请输入接诊医生" />
+          </el-form-item>
+          <el-form-item label="所在市" prop="city" style="flex: 2; margin-bottom: 0;">
+            <el-input v-model="form.city" placeholder="请输入所在市" />
+          </el-form-item>
+        </div>
+
+        <!-- 第三排:现病史(独占) -->
+        <div style="margin-bottom: 15px;">
+          <el-form-item label="现病史" prop="presentIllness" style="margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.presentIllness" placeholder="请输入现病史" :rows="2" />
+          </el-form-item>
+        </div>
+
+        <!-- 第四排:既往史(独占) -->
+        <div style="margin-bottom: 15px;">
+          <el-form-item label="既往史" prop="pastHistory" style="margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.pastHistory" placeholder="请输入既往史" :rows="2" />
+          </el-form-item>
+        </div>
+
+        <!-- 第五排:过敏史(独占) -->
+        <div style="margin-bottom: 15px;">
+          <el-form-item label="过敏史" prop="allergyHistory" style="margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.allergyHistory" placeholder="请输入过敏史" :rows="2" />
+          </el-form-item>
+        </div>
+
+        <!-- 第六排:诊断、证型 -->
+        <div style="display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 15px;">
+          <el-form-item label="诊断" prop="diagnosis" style="flex: 1; margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.diagnosis" placeholder="请输入诊断" :rows="2" />
+          </el-form-item>
+          <el-form-item label="证型" prop="syndromeType" style="flex: 1; margin-bottom: 0;">
+            <el-input v-model="form.syndromeType" placeholder="请输入证型" />
+          </el-form-item>
+        </div>
+
+        <!-- 第七排:证型调理(独占) -->
+        <div style="margin-bottom: 15px;">
+          <el-form-item label="证型调理" prop="syndromeRegulation" style="margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.syndromeRegulation" placeholder="请输入证型调理" :rows="2" />
+          </el-form-item>
+        </div>
+
+        <!-- 第八排:诊疗意见(独占) -->
+        <div style="margin-bottom: 15px;">
+          <el-form-item label="诊疗意见" prop="treatmentOpinion" style="margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.treatmentOpinion" placeholder="请输入诊疗意见" :rows="2" />
+          </el-form-item>
+        </div>
+
+        <!-- 第九排:注意禁忌(独占) -->
+        <div style="margin-bottom: 15px;">
+          <el-form-item label="注意禁忌" prop="precautions" style="margin-bottom: 0;">
+            <el-input type="textarea" v-model="form.precautions" placeholder="请输入注意禁忌" :rows="2" />
+          </el-form-item>
+        </div>
+
+        <!-- 第十排:医师签名、执业证编号 -->
+        <div style="display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 0;">
+          <el-form-item label="医师签名" prop="doctorSignature" style="flex: 1; margin-bottom: 0;">
+            <img v-if="form.doctorSignature" :src="form.doctorSignature" style="max-height: 40px;" />
+            <span v-else>暂无签名</span>
+            <input type="hidden" v-model="form.doctorSignature" />
+          </el-form-item>
+          <el-form-item label="执业证编号" prop="practiceCertificateNo" style="flex: 1; margin-bottom: 0;">
+            <el-input v-model="form.practiceCertificateNo" placeholder="请输入执业证编号" />
+          </el-form-item>
+        </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  listPatientInfo,
+  getPatientInfo,
+  addPatientInfo,
+  updatePatientInfo,
+  delPatientInfo,
+  exportPatientInfo,
+  getDoctorBaseInfo
+} from '@/api/patientInfo'
+import { parseTime } from "../../utils/common";
+
+export default {
+  name: "Patient",
+  data() {
+    // 自定义年龄验证器(备用,el-input-number 已设 min,此规则确保即使组件异常也能拦截)
+    const validateAge = (rule, value, callback) => {
+      if (value === null || value === undefined || value === '') {
+        callback(new Error('年龄不能为空'));
+      } else if (value < 18) {
+        callback(new Error('年龄必须大于等于18岁'));
+      } else {
+        callback();
+      }
+    };
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 患者表格数据
+      patientList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 日期范围
+      dateRange: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        patientName: null,
+        phone: null,
+        receptionDoctor: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        patientName: [{ required: true, message: "患者姓名不能为空", trigger: "blur" }],
+        sex: [{ required: true, message: "请选择性别", trigger: "change" }],
+        age: [
+          { required: true, message: "年龄不能为空", trigger: "blur" },
+          { validator: validateAge, trigger: "blur" }
+        ],
+        phone: [{ required: true, message: "电话不能为空", trigger: "blur" }],
+        receptionTime: [{ required: true, message: "接诊时间不能为空", trigger: "blur" }],
+        receptionDoctor: [{ required: true, message: "接诊医生不能为空", trigger: "blur" }],
+        city: [{ required: true, message: "所在市不能为空", trigger: "blur" }],
+        presentIllness: [{ required: true, message: "现病史不能为空", trigger: "blur" }],
+        pastHistory: [{ required: true, message: "既往史不能为空", trigger: "blur" }],
+        allergyHistory: [{ required: true, message: "过敏史不能为空", trigger: "blur" }],
+        diagnosis: [{ required: true, message: "诊断不能为空", trigger: "blur" }],
+        syndromeType: [{ required: true, message: "证型不能为空", trigger: "blur" }],
+        syndromeRegulation: [{ required: true, message: "证型调理不能为空", trigger: "blur" }],
+        treatmentOpinion: [{ required: true, message: "诊疗意见不能为空", trigger: "blur" }],
+        precautions: [{ required: true, message: "注意禁忌不能为空", trigger: "blur" }],
+      },
+      // 性别选项
+      sexOptions: [
+        { label: '女', value: '0' },
+        { label: '男', value: '1' },
+        { label: '未知', value: '2' }
+      ],
+      // 当前医生信息
+      currentDoctor: {
+        doctorId: null,
+        doctorName: '',
+        practiseCode: '',
+        signUrl: ''
+      }
+    }
+  },
+  created() {
+    this.getList()
+    this.fetchDoctorInfo();
+  },
+  methods: {
+    /** 获取当前登录医生信息 */
+    fetchDoctorInfo() {
+      getDoctorBaseInfo().then(response => {
+        const doc = response.data;
+        if (doc) {
+          this.currentDoctor = {
+            doctorId: doc.doctorId,
+            doctorName: doc.doctorName || '',
+            practiseCode: doc.practiseCode || '',
+            signUrl: doc.signUrl || ''
+          };
+        }
+      }).catch(() => {
+        this.$modal.msgError("获取医生信息失败");
+      });
+    },
+    onSexChange(val) {
+      this.$set(this.form, 'sex', val);
+    },
+    parseTime,
+    /** 查询患者列表 */
+    getList() {
+      this.loading = true;
+      listPatientInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+        const data = response.data;
+        this.patientList = data.list;
+        this.total = data.total;
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    // 性别格式化
+    sexFormat(row) {
+      return this.sexOptions.find(o => o.value === row.sex)?.label ?? row.sex;
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        patientName: null,
+        sex: null,
+        age: null,
+        phone: null,
+        receptionTime: null,
+        receptionDoctor: null,
+        city: null,
+        presentIllness: null,
+        pastHistory: null,
+        allergyHistory: null,
+        diagnosis: null,
+        syndromeType: null,
+        syndromeRegulation: null,
+        treatmentOpinion: null,
+        precautions: null,
+        doctorSignature: null,
+        practiceCertificateNo: null,
+        doctorId: null,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id);
+      this.single = selection.length !== 1;
+      this.multiple = !selection.length;
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      // 回填当前医生信息
+      this.form.receptionDoctor = this.currentDoctor.doctorName;
+      this.form.practiceCertificateNo = this.currentDoctor.practiseCode;
+      this.form.doctorSignature = this.currentDoctor.signUrl;
+      this.form.doctorId = this.currentDoctor.doctorId;
+      this.open = true;
+      this.title = "添加患者信息";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids[0];
+      getPatientInfo(id).then(response => {
+        this.form = response.data;
+        // 确保性别为字符串(匹配下拉选项值)
+        if (this.form.sex !== undefined && this.form.sex !== null) {
+          this.form.sex = String(this.form.sex);
+        }
+        this.open = true;
+        this.title = "修改患者信息";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updatePatientInfo(this.form).then(() => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addPatientInfo(this.form).then(() => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids.join(",");
+      this.$modal.confirm('是否确认删除该患者信息?').then(function() {
+        return delPatientInfo(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.$modal.confirm('是否确认导出所有患者信息?').then(() => {
+        return exportPatientInfo(this.addDateRange(this.queryParams, this.dateRange));
+      }).then(response => {
+        this.download(response.msg, "患者信息数据.xlsx");
+      }).catch(() => {});
+    },
+    /** 通用下载方法 */
+    download(content, fileName) {
+      const blob = new Blob([content]);
+      const url = window.URL.createObjectURL(blob);
+      const a = document.createElement('a');
+      a.href = url;
+      a.download = fileName;
+      a.click();
+      window.URL.revokeObjectURL(url);
+    },
+    /** 添加日期范围参数 */
+    addDateRange(params, dateRange) {
+      if (dateRange && dateRange.length === 2) {
+        params.beginTime = dateRange[0];
+        params.endTime = dateRange[1];
+      }
+      return params;
+    }
+  }
+}
+</script>
+
+<style scoped>
+.mb8 {
+  margin-bottom: 8px;
+}
+</style>