From 5cfc97edd66731e2ebeea36072ec160a25a7bbf3 Mon Sep 17 00:00:00 2001
From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com>
Date: 星期四, 23 十一月 2023 18:21:44 +0800
Subject: [PATCH] qxtj

---
 src/views/doctor/check/index.vue |  329 +++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 298 insertions(+), 31 deletions(-)

diff --git a/src/views/doctor/check/index.vue b/src/views/doctor/check/index.vue
index aa8c1d8..3e6e008 100644
--- a/src/views/doctor/check/index.vue
+++ b/src/views/doctor/check/index.vue
@@ -18,24 +18,14 @@
         <el-radio-button label="0">鏈</el-radio-button>
         <el-radio-button label="1">宸叉</el-radio-button>
       </el-radio-group>
-      <el-row :gutter="10" class="mb8" style="margin:8px 10px;">
-      <el-col :span="1.5">
-        <el-button type="primary"
-          size="mini"
-          @click="radioChange"
-          v-hasPermi="['system:notice:add']"
-        >浼氳瘖鐢宠</el-button>
-      </el-col>
-    </el-row>
     </div>
-
 
     <template>
       <el-table :data="tableList" v-loading="loading" ref="table" height="536px" style="margin: 20px; width: 98%"
         border="">
         <!-- <template slot="empty">鏁版嵁姝e湪鍔犺浇涓�</template> -->
-        <el-table-column label="浣撴鍙�" align="center" prop="tjNumber" width="180px" />
-        <el-table-column label="濮撳悕" align="center" prop="cusName" width="100px" />
+        <el-table-column label="浣撴鍙�" align="center" prop="tjNumber" width="160px" />
+        <el-table-column label="濮撳悕" align="center" prop="cusName" width="90px" />
         <el-table-column label="鎬у埆" align="center" prop="cusSex" width="60px">
           <template slot-scope="scope">
             <span v-if="scope.row.cusSex == '0'">鐢�</span>
@@ -44,27 +34,18 @@
             <span v-if="scope.row.cusSex == '9'">鏈鏄庢�у埆</span>
           </template>
         </el-table-column>
-        <el-table-column label="鍑虹敓鏃ユ湡" align="center" prop="cusBrithday" width="120px" />
-        <el-table-column label="鐢佃瘽" align="center" prop="cusPhone" width="120px" />
-        <!-- <el-table-column
-          label="鐘舵��"
-          align="center"
-          prop="tjStatus"
-          :show-overflow-tooltip="true"
-          width="80px"
-        >
-          <template slot-scope="scope">
-            <span>{{ scope.row.tjStatus == "1" ? "宸叉" : "鏈" }}</span>
-          </template>
-        </el-table-column> -->
-
+        <el-table-column label="鍑虹敓鏃ユ湡" align="center" prop="cusBrithday" width="100px" />
+        <el-table-column label="鐢佃瘽" align="center" prop="cusPhone" width="100px" />
         <el-table-column label="浣撴绫诲瀷" align="center" prop="tjType" width="80px" />
         <el-table-column label="鐧昏鏃堕棿" align="center" prop="createTime" width="160px" />
-        <el-table-column label="浣撴鏃堕棿" align="center" prop="tjTime" width="120px" />
+        <el-table-column label="浣撴鏃堕棿" align="center" prop="tjTime" width="100px" />
         <el-table-column label="鏈椤�" prop="notCheckeds" :show-overflow-tooltip="true" />
-        <el-table-column label="鎿嶄綔" align="center" width="80px">
+        <el-table-column label="鎿嶄綔" align="center" width="130px">
           <template slot-scope="scope">
-            <el-button type="primary" size="mini" @click="handleClick(scope.row)">璇︽儏</el-button>
+            <el-button type="primary" icon="el-icon-first-aid-kit" size="mini" @click="Changeapplyfor(scope.row)"
+              title="浼氳瘖鐢宠" v-if="tjStatus == '1'"></el-button>
+            <el-button type="primary" icon="el-icon-share" size="mini" @click="handleClick(scope.row)"
+              title="璇︽儏"></el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -76,6 +57,89 @@
         </div>
       </div>
     </template>
+
+    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
+      <el-row>
+        <el-col :span="7" v-if="hzlogList.length >= 1">
+          <h3>浼氳瘖鐢宠璁板綍</h3>
+          <el-table :data="hzlogList" style="width: 100%" border>
+            <el-table-column label="鐢宠浜�" align="center" prop="hzDoctorName" width="100px" />
+            <el-table-column label="绉戝" align="center" prop="hzDeptName" width="260px" />
+          </el-table>
+        </el-col>
+        <el-col :span="16">
+          <!-- :rules="rules" -->
+          <el-form ref="form" :model="form" label-width="80px">
+            <el-form-item label="濮撳悕" prop="cusName">
+              <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" disabled />
+            </el-form-item>
+            <el-form-item label="浣撴鍙�" prop="tjNumber">
+              <el-input v-model="form.tjNumber" placeholder="璇疯緭鍏ヤ綋妫�鍙�" disabled />
+            </el-form-item>
+            <el-form-item label="浼氳瘖绉戝" prop="hzType">
+              <el-radio-group v-model="form.hzType">
+                <el-radio-button label="0">鍏ㄩ櫌浼氳瘖</el-radio-button>
+                <el-radio-button label="1">绉戝浼氳瘖</el-radio-button>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item label="閫夋嫨绉戝" v-if="form.hzType == '1'">
+              <el-select v-model="form.hzDeptId" multiple filterable style="width: 100%">
+                <el-option v-for="item in deptList" :key="item.deptId" :label="item.deptName"
+                  :value="item.deptId"></el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="鐢宠浜�" prop="hzDoctorId">
+              <el-select v-model="form.hzDoctorId" placeholder="璇烽�夋嫨" style="width: 100%" filterable>
+                <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId">
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <!-- <el-form-item label="鐢宠鏃堕棿" prop="createTime">
+              <el-date-picker v-model="form.createTime" type="datetime" placeholder="閫夋嫨鐢宠鏃堕棿">
+              </el-date-picker>
+            </el-form-item> -->
+          </el-form>
+        </el-col>
+      </el-row>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFormapply">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+
+    <el-dialog :title="title" :visible.sync="foropen" width="1000px" append-to-body>
+      <el-row>
+        <el-col :span="8" v-if="hasdeptList.length >= 1">
+          <h3 style="text-align: center;">浼氳瘖鐢宠璁板綍</h3>
+          <el-table :data="hasdeptList" style="width: 100%" border ref="tab" @selection-change="handleSelectionChange">
+            <el-table-column type="selection" width="50" align="center" />
+            <el-table-column label="鐢宠浜�" align="center" prop="hzDoctorName" width="100px" />
+            <el-table-column label="绉戝" align="center" prop="hzDeptName" width="260px" />
+          </el-table>
+        </el-col>
+        <el-col :span="16" style="padding: 0 10px;">
+          <h3 style="text-align: center;">浼氳瘖鎰忚</h3>
+          <div v-if="hzReplyLogsList.length >= 1" style="margin-bottom: 10px;">
+            <div v-for="(item, index) in hzReplyLogsList" :key="index"
+              style="padding-bottom:5px;border-bottom: 1px solid black;">
+              <!-- <div>浼氳瘖绉戝锛歿{ item.replyDeptName }}</div> -->
+              <div> 鍖荤敓锛歿{ item.hzDoctorName }} </div>
+              <div>鍥炲锛歿{ item.replyContent }}</div>
+            </div>
+          </div>
+          <el-input type="textarea" :rows="2" placeholder="璇疯緭鍏ュ唴瀹�" v-model="textarea">
+          </el-input>
+          <div style="padding: 10px 10px;">
+            <el-button type="primary" @click="submitFormreply">鍥炲</el-button>
+          </div>
+        </el-col>
+      </el-row>
+      <!-- <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFormapply">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div> -->
+    </el-dialog>
+
     <!-- 鐐瑰嚮鍙宠竟寮瑰嚭灞� -->
     <el-drawer :visible.sync="drawer" :with-header="false" size="70%" :before-close="handleClose">
       <div style="font-size: 14px">
@@ -128,6 +192,9 @@
             </td>
           </tr>
         </table>
+      </div>
+      <div style="margin: 10px 10px;" v-if="hasdeptList.length >= 1">
+        <el-button type="primary" size="mini" @click="Changeapply()">浼氳瘖鐢宠</el-button>
       </div>
 
       <template>
@@ -229,6 +296,12 @@
         </table>
 
         <div slot="footer" class="dialog-footers">
+          <!-- <el-button type="primary"
+          size="mini"
+          @click="radioChange"
+          v-hasPermi="['system:notice:add']"
+          v-show="tjStatus == '1'"
+        >浼氳瘖鐢宠</el-button> -->
           <el-button type="primary" @click="determine" v-show="tjStatus == '0'">鎻� 浜�</el-button>
         </div>
       </div>
@@ -280,6 +353,7 @@
 
 <script>
 import Public from "@/components/public";
+import { getInfo } from "@/api/login";
 import {
   getProList,
   getSons,
@@ -288,7 +362,12 @@
   getParentId,
   getDeptAdvice,
 } from "@/api/doctor/check";
+import {
+  addReplylog, hzHasDept
+} from "@/api/hosp/replylog";
+import { listHzlog, addHzlog } from "@/api/hosp/hzlog";
 import { listUser } from "@/api/system/user";
+import { getChildList } from "@/api/system/dept";
 export default {
   dicts: ["sys_user_sex", "sys_yes_no", "tj_result_type"],
   name: "check",
@@ -298,7 +377,13 @@
       selected: false,
       // 閬僵灞�
       loading: false,
+      open: false,
+      foropen: false,
+      cateringList: [],
       orderDetailId: "",
+      textarea: "",
+      title: "",
+      hzlogList: [],
       // proDefault: "",
       // dataList: [],
       rows: [],
@@ -316,8 +401,13 @@
       drawerList: [],
       // 鑾峰彇淇℃伅闆嗗悎
       tableList: [],
+      deptList: [],
       tableAll: {},
       row: {},
+      allList: [],
+      form: {
+        createTime: new Date()
+      },
       // 鍖荤敓
       doctorName: "",
       // 鐖堕」
@@ -330,6 +420,8 @@
       userList: null,
       // 鐖堕」鐩垪琛�
       Parent: [],
+      hzReplyLogsList: [],
+      hasdeptList: [],
       radio: "",
       nums: "",
       proParentList: [],
@@ -341,6 +433,9 @@
       summaryAll: [],
       tjOrderDetailList: [],
       tjOrderDetail: [],
+      deptId: "",
+      userId: "",
+      nickName: "",
       date: new Date(new Date().getTime() + 8 * 3600 * 1000)
         .toJSON()
         .substr(0, 19)
@@ -388,6 +483,12 @@
           this.userList = response.rows;
         }
       );
+      getInfo().then((response) => {
+        this.form.hzDoctorId = response.user.userId;
+        this.deptId = response.user.deptId;
+        this.userId = response.user.userId;
+        this.nickName = response.user.nickName;
+      });
     },
     handleClose() {
       this.$tab.refreshPage();
@@ -524,8 +625,148 @@
       this.submitForm();
     },
 
+    Changeapplyfor(row) {
+      this.open = true;
+      this.form = row
+      getChildList().then(res => {
+        this.deptList = res.data;
+      })
+
+      this.Hzlog(this.form.tjNumber)
+    },
+
+    Hzlog(val) {
+      let data = {
+        tjNumber: val
+      }
+      listHzlog(data).then(response => {
+        this.hzlogList = response.rows;
+        this.hzlogList.forEach(item => {
+          item.hzDeptName = ""
+          if (item.hzType == "0") {
+            item.hzDeptName = "鍏ㄩ櫌浼氳瘖"
+          } else {
+            item.hzDeptIdList.forEach(item1 => {
+              this.deptList.forEach(item2 => {
+                if (item1 == item2.deptId) {
+                  item.hzDeptName += item2.deptName + ","
+                }
+              })
+            })
+          }
+        })
+      });
+    },
+
+    submitFormapply() {
+      let data = {}
+      this.userList.forEach(item1 => {
+        if (this.form.hzDoctorId == item1.userId) {
+          this.form.hzDoctorName = item1.nickName
+        }
+      })
+      if (this.form.hzDeptId) {
+        // let hzDeptId = ""
+        // this.form.hzDeptId.forEach(item => {
+        //   hzDeptId += item + ','
+        // })
+        data = {
+          tjNumber: this.form.tjNumber,
+          userId: this.form.cusId,
+          userName: this.form.cusName,
+          hzDeptIdList: this.form.hzDeptId,
+          hzDoctorId: this.form.hzDoctorId,
+          hzType: this.form.hzType,
+          orderId: this.form.orderId,
+          hzDoctorName: this.form.hzDoctorName
+        }
+      } else {
+        data = {
+          tjNumber: this.form.tjNumber,
+          userId: this.form.cusId,
+          userName: this.form.cusName,
+          hzDoctorId: this.form.hzDoctorId,
+          hzType: this.form.hzType,
+          orderId: this.form.orderId,
+          hzDoctorName: this.form.hzDoctorName
+        }
+      }
+
+      addHzlog(data).then(res => {
+        if (res.code == 200) {
+          this.$modal.msgSuccess("鐢宠鎴愬姛");
+          this.form = {}
+          this.Hzlog()
+          this.radioChange(1)
+        }
+      })
+      this.open = false;
+    },
+    cancel() {
+      this.open = false;
+      this.foropen = false
+    },
+
+    Changeapply() {
+      this.foropen = true
+      this.Hzlog(this.tableAll.tjNumber)
+
+    },
+    submitFormreply() {
+      let data = {
+        hzId: this.allList[0].id,
+        orderId: this.allList[0].orderId,
+        tjNumber: this.allList[0].tjNumber,
+        userId: this.allList[0].userId,
+        userName: this.allList[0].userName,
+        replyContent: this.textarea,
+        hzDoctorId: this.allList[0].hzDoctorId,
+        hzDoctorName: this.allList[0].hzDoctorName,
+        hzType: this.allList[0].hzType,
+        replyDoctorName: this.nickName,
+        replyDeptId: this.deptId,
+        replyDoctorId: this.userId
+
+      }
+      addReplylog(data).then(res => {
+        this.$modal.msgSuccess("鍥炲鎴愬姛");
+        this.getDept(this.allList[0].tjNumber)
+      })
+    },
+
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      if (selection.length > 1) {
+        const newRows = selection.filter((it, index) => {
+          if (index == selection.length - 1) {
+            this.$refs.tab.toggleRowSelection(it, true);
+            return true;
+          } else {
+            this.$refs.tab.toggleRowSelection(it, false);
+            return false;
+          }
+        });
+      //   this.allList = []
+      //   if(newRows[0].hzReplyLogsList){
+      //     this.hzReplyLogsList = newRows[0].hzReplyLogsList  
+      //   }
+      //  console.log(this.hzReplyLogsList)
+      //   this.allList = newRows
+      }else{
+        this.allList = []
+        if(selection[0].hzReplyLogsList){
+          this.hzReplyLogsList = selection[0].hzReplyLogsList  
+        }else{
+          this.hzReplyLogsList = []
+        }
+       console.log(this.hzReplyLogsList)
+        this.allList = selection
+      }
+    },
+
     // 鐐瑰嚮璇︽儏
     handleClick(row) {
+      this.getDept(row.tjNumber)
       this.loading = true;
       this.drawer = true;
       this.tableAll = row;
@@ -535,7 +776,6 @@
       if (this.tableAll.cusSex === 1) {
         this.tableAll.cusSex = "濂�";
       }
-
       this.tjNumber = row.tjNumber;
       let num = 0;
       getParentList(this.tjNumber).then((response) => {
@@ -601,7 +841,6 @@
           num = num + 1;
         });
       });
-
       getDeptAdvice().then((response) => {
         this.deptAdviceList = response.data;
       });
@@ -621,6 +860,34 @@
       //   })
       // });
     },
+
+    getDept(val) {
+      let data = {
+        tjNumber: val,
+        deptId: this.deptId
+      }
+      hzHasDept(data).then(res => {
+        if (res.data) {
+          this.hasdeptList = res.data
+          this.hasdeptList.forEach(item => {
+            item.hzDeptName = ""
+            if (item.hzType == "0") {
+              item.hzDeptName = "鍏ㄩ櫌浼氳瘖"
+            } else {
+              item.hzDeptIdList.forEach(item1 => {
+                this.deptList.forEach(item2 => {
+                  if (item1 == item2.deptId) {
+                    item.hzDeptName += item2.deptName + ","
+                  }
+                })
+              })
+            }
+          })
+        }
+
+      })
+    },
+
     // 鎸夐挳鐐瑰嚮浜嬩欢
     radioChange1(proParentId, item) {
       this.$confirm(

--
Gitblit v1.8.0