Browse Source

采集信息详情页

cgp 2 tuần trước cách đây
mục cha
commit
631273080b

+ 9 - 1
src/api/collection.js

@@ -23,4 +23,12 @@ export function doctorConfirm(data) {
     method: 'put',
     data: data
   })
-}
+}
+
+// 根据用户Id查询用户采集详情
+export function getCollectionByUserId(userId) {
+  return request({
+    url: '/app/collection/getCollectionByUserId/' + userId,
+    method: 'get'
+  })
+}

+ 8 - 0
src/api/his/prescribe.js

@@ -92,3 +92,11 @@ export function exportMessageFeedback(query) {
     params: query
   })
 }
+// 查询常用语列表
+export function getPrescribeCommonList(params) {
+  return request({
+    url: '/app/prescribe/common/getPrescribeCommonList',
+    method: 'get',
+    params: params
+  })
+}

+ 102 - 0
src/views/components/collection/collectionDetail.vue

@@ -0,0 +1,102 @@
+<template>
+  <div class="app-container">
+    <!-- 可选:添加 loading 提示 -->
+    <el-form ref="form" :model="form" label-width="140px" v-loading="loading">
+      <div v-for="(answer, index) in form.answers" :key="index">
+        <div style="margin-bottom: 20px; margin-top: 20px;">
+          <span style="font-size: 15px; font-weight: bold; margin-left: 31px">
+            {{ answer.title }}
+          </span>
+        </div>
+        <div style="margin-left: 31px;">
+          <!-- flag 控制是否可编辑 -->
+          <el-checkbox-group
+            :disabled="answer.flag || false"
+            v-model="form.answers[index].value"
+            size="mini"
+          >
+            <el-checkbox
+              v-for="dict in answer.options"
+              :key="dict.value"
+              :label="dict.value"
+            >
+              {{ dict.name }}
+            </el-checkbox>
+          </el-checkbox-group>
+        </div>
+      </div>
+
+      <!-- 如果没有数据 -->
+      <div v-if="!form.answers || form.answers.length === 0" style="text-align: center; color: #999; padding: 20px;">
+        暂无采集信息
+      </div>
+    </el-form>
+  </div>
+</template>
+
+<script>
+// 假设你有一个根据 userId 获取采集信息的接口
+import { getCollectionByUserId } from "@/api/collection"; // ✅ 确保这个方法存在
+
+export default {
+  name: "CollectionDetail",
+  props: {
+    userId: {
+      type: [String, Number],
+      required: true
+    },
+    prescribeId: {
+      type: [String, Number],
+      required: true
+    }
+  },
+  data() {
+    return {
+      form: {
+        answers: []
+      },
+      loading: false,
+      questionOptions: [],
+      privatePackageOptions: [],
+      codeImage: null
+    };
+  },
+  watch: {
+    userId: {
+      handler(newVal) {
+        if (newVal) {
+          this.fetchCollectionInfo(newVal);
+        }
+      },
+      immediate: true
+    }
+  },
+  methods: {
+    fetchCollectionInfo(userId) {
+      this.loading = true;
+      console.log("传入的用户信息:", userId)
+      getCollectionByUserId(userId)
+        .then(res => {
+          const data = res.data;
+          if (data && Array.isArray(data.answers)) {
+            this.form = data;
+          } else {
+            this.form = { answers: [] };
+          }
+        })
+        .catch(err => {
+          console.error("获取采集信息失败:", err);
+          this.$message.warning("暂无采集信息");
+          this.form = { answers: [] };
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    }
+  }
+};
+</script>
+
+<style scoped>
+/* 可添加一些样式优化 */
+</style>

+ 17 - 2
src/views/components/patient/patientDetails.vue

@@ -31,6 +31,17 @@
         </el-descriptions-item>
       </el-descriptions>
     </div>
+    <div class="my-content" v-if="item!=null" >
+      <div class="my-title">
+        采集信息详情
+        <!-- 传入 userId -->
+        <collection-detail
+          v-if="item.userId"
+          :userId="item.userId"
+          :prescribeId="0"
+        />
+      </div>
+    </div>
     <div class="my-content" v-if="item!=null" >
         <div class="my-title">
               问诊订单
@@ -45,15 +56,19 @@
 </template>
 
 <script>
+import collectionDetail from '@/views/components/collection/collectionDetail.vue';
   import { getPatientByPatientId } from "@/api/patient";
   export default {
+    components: {
+      collectionDetail // 注册引入的组件
+    },
     name: "patientdetails",
     props:["data"],
     data() {
       return {
         sexOptions: [],
         item:null,
-        
+
       }
     },
     created() {
@@ -93,4 +108,4 @@
     max-width: 500px;
     min-width: 100px;
   }
-</style>
+</style>

+ 197 - 7
src/views/his/prescribe/index.vue

@@ -216,12 +216,43 @@
             <el-form-item label="过敏史" prop="historyAllergic">
               <el-input v-model="form.historyAllergic" placeholder="请输入过敏史" />
             </el-form-item>
+            <!-- 诊断 -->
             <el-form-item label="诊断" prop="diagnose">
-              <el-input v-model="form.diagnose" placeholder="请输入诊断" />
+              <el-input v-model="form.diagnose" placeholder="请输入诊断">
+                <i
+                  slot="suffix"
+                  class="el-icon-search el-input__icon"
+                  style="cursor: pointer;"
+                  @click="handlePrescribeCommonWorlds('diagnose', 1)"
+                ></i>
+              </el-input>
             </el-form-item>
+
+            <!-- 备注 -->
             <el-form-item label="备注" prop="remark">
-              <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
+              <div style="display: flex; align-items: center;">
+                <el-input
+                  v-model="form.remark"
+                  type="textarea"
+                  placeholder="请输入备注"
+                  style="flex: 1;"
+                ></el-input>
+                <i
+                  class="el-icon-search"
+                  style="margin-left: 8px; cursor: pointer; font-size: 18px; color: #909399;"
+                  @click="handlePrescribeCommonWorlds('remark', 2)"
+                ></i>
+              </div>
             </el-form-item>
+            <!-- 定位在右下角的按钮 -->
+            <el-button
+              type="primary"
+              size="mini"
+              style="position: absolute; bottom: 5px; right: 20px;"
+              @click="openCollectionInfo"
+            >
+              查看采集信息
+            </el-button>
           </el-form>
         </el-tab-pane>
         <!-- Tab 2: 处方药品信息 -->
@@ -290,7 +321,22 @@
             />
           </div>
         </el-tab-pane>
+        <!-- Tab 3: 用户信息采集 -->
+        <el-tab-pane label="采集信息详情" name="userCollection">
+          <collectionDetail
+            :userId="form.userId"
+            :prescribeId="form.prescribeId"
+            v-if="form.userId"
+          />
+        </el-tab-pane>
       </el-tabs>
+      <!-- 查看采集信息的弹窗 -->
+      <el-dialog :visible.sync="collectionDialogVisible" title="用户信息采集详情" width="800px" append-to-body>
+        <collectionDetail :userId="form.userId" :prescribeId="form.prescribeId" v-if="collectionDialogVisible"/>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="collectionDialogVisible = false">关 闭</el-button>
+        </span>
+      </el-dialog>
       <span slot="footer" class="dialog-footer">
         <el-button @click="open = false">关 闭</el-button>
         <el-button type="primary" @click="submitForm" v-if="currentConfirm === 0">保 存</el-button>
@@ -315,31 +361,82 @@
         <el-form-item label="每次用药数量" prop="usagePerUseCount">
           <el-input v-model="drugForm.usagePerUseCount" placeholder="请输入每次用药数量" />
         </el-form-item>
-       
+
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="drugOpen = false">取 消</el-button>
         <el-button type="primary" @click="submitDrugForm">确 定</el-button>
       </span>
     </el-dialog>
+
+    <!-- ✅ 新增:常用语选择对话框 -->
+    <el-dialog
+      :title="suggestDialogTitle"
+      :visible.sync="showSuggestDialog"
+      width="600px"
+      append-to-body
+      @closed="clearSuggestList"
+    >
+      <el-table
+        :data="suggestList"
+        height="300"
+        border
+        @row-click="handleSuggestRowClick"
+      >
+        <el-table-column type="index" width="50" />
+        <el-table-column label="内容" prop="textContent" show-overflow-tooltip />
+        <el-table-column label="操作" width="80" align="center">
+          <template slot-scope="scope">
+            <el-button type="text" size="small" @click.stop="handleAddSuggest(scope.row)">
+              添加
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <pagination
+        v-show="suggestTotal > 0"
+        :total="suggestTotal"
+        :page.sync="suggestQuery.pageNum"
+        :limit.sync="suggestQuery.pageSize"
+        @pagination="getSuggestList"
+      />
+    </el-dialog>
   </div>
 </template>
 <script>
-import {
-  listPrescribe,
+import collectionDetail from '@/views/components/collection/collectionDetail.vue';
+import {listPrescribe,
   getPrescribe,
   delPrescribe,
   addPrescribe,
   updatePrescribe,
   exportPrescribe,
   exportMessageFeedback,
-  confirmPrescribe
+  confirmPrescribe,
+  getPrescribeCommonList
 } from '@/api/his/prescribe'
 import { listPrescribeDrug, addPrescribeDrug, updatePrescribeDrug, deletePrescribeDrug } from "@/api/his/prescribeDrug";
 export default {
+  components: {
+    collectionDetail // 注册引入的组件
+  },
   name: "Prescribe",
   data() {
     return {
+      collectionDialogVisible: false, // 控制采集信息弹窗显示
+      searchTimer: null, // 防抖定时器
+      suggestList: [],   // 常用语建议列表
+      suggestTotal: 0,   // 分页总数
+      showSuggestDialog: false, // 是否显示建议对话框
+      suggestQuery: {    // 建议查询参数
+        pageNum: 1,
+        pageSize: 10,
+        commonType: null,
+        textContent: ''
+      },
+      suggestSource: '', // 记录来源字段 'diagnose' 或 'remark'
+      suggestRow: null,  // 如果是备注,记录具体行
       // 原有数据保持不变
       loading: false,
       ids: [],
@@ -419,6 +516,14 @@ export default {
       }
     };
   },
+  computed:{
+    // 动态标题
+    suggestDialogTitle() {
+      if (this.suggestSource === 'diagnose') return '选择常用诊断内容';
+      if (this.suggestSource === 'remark') return '选择常用备注内容';
+      return '选择常用内容';
+    }
+  },
   created() {
     this.getList();
   },
@@ -431,6 +536,82 @@ export default {
     }
   },
   methods: {
+    /**
+     * 搜索关键词常用语方法 - 支持不同来源和类型
+     * @param {string} type - 字段类型: 'diagnose' | 'remark'
+     * @param {number} commonType - 1=病情诊断,2=备注
+     */
+    handlePrescribeCommonWorlds(type, commonType) {
+      const value = type === 'diagnose' ? this.form.diagnose : this.form.remark;
+      if (!value || !value.trim()) {
+        this.showSuggestDialog = false;
+        return;
+      }
+
+      this.suggestQuery.commonType = commonType;
+      this.suggestQuery.textContent = value.trim();
+      this.suggestQuery.pageNum = 1;
+      this.suggestSource = type;
+
+      this.getSuggestList().then(() => {
+        this.showSuggestDialog = this.suggestList.length > 0;
+      });
+    },
+
+    /**
+     * 获取常用语列表(支持分页)
+     */
+    async getSuggestList() {
+      try {
+        const response = await getPrescribeCommonList(this.suggestQuery);
+        if (response && response.data && Array.isArray(response.data.list)) {
+          this.suggestList = response.data.list;
+          this.suggestTotal = response.data.total;
+        } else {
+          this.suggestList = [];
+          this.suggestTotal = 0;
+        }
+      } catch (error) {
+        console.error("获取常用语失败:", error);
+        this.$message.warning("获取常用语失败");
+        this.suggestList = [];
+        this.suggestTotal = 0;
+      }
+    },
+
+    /**
+     * 点击建议行(双击或点击添加)
+     */
+    handleSuggestRowClick(row) {
+      this.handleAddSuggest(row);
+    },
+
+    /**
+     * 添加建议内容到对应字段
+     */
+    handleAddSuggest(row) {
+      const text = row.textContent;
+      console.log("当前入参suggestSource:", this.suggestSource)
+      if (this.suggestSource === 'diagnose') {
+        this.form.diagnose = text;
+      } else if (this.suggestSource === 'remark') {
+        this.form.remark = text;
+      }
+
+      // 关闭对话框
+      this.showSuggestDialog = false;
+      this.clearSuggestList();
+    },
+
+    /**
+     * 清空建议数据
+     */
+    clearSuggestList() {
+      this.suggestList = [];
+      this.suggestTotal = 0;
+      this.suggestQuery.pageNum = 1;
+      this.suggestQuery.textContent = '';
+    },
     /** 查询处方列表 */
     getList() {
       this.loading = true;
@@ -518,7 +699,7 @@ export default {
         } else {
           this.title = "查看处方";
         }
-        
+
         this.activeTab = 'basic';
         // 如果有prescribeId,则可以查询药品列表
         if (this.form.prescribeId) {
@@ -662,6 +843,14 @@ export default {
         }
       });
     },
+    /** 患者信息采集详情页面 */
+    openCollectionInfo() {
+      if (!this.form.userId) {
+        this.$message.warning("患者ID未填写!");
+        return;
+      }
+      this.collectionDialogVisible = true;
+    },
     // 表单重置
     reset() {
       this.form = {
@@ -672,6 +861,7 @@ export default {
         storeOrderId: undefined,
         orderCode: undefined,
         patientId: undefined,
+        userId: undefined,
         patientName: undefined,
         patientAge: undefined,
         patientGender: "1",