浏览代码

增加总控护士主机注册逻辑,增加总控护士主机与护士主机的管理逻辑,增加护士主机转接时长设置

vothin 3 年之前
父节点
当前提交
bfb9aa3a0d

+ 8 - 0
src/api/ncs_device.js

@@ -178,3 +178,11 @@ export function listByHospital(params) {
   })
 }
 
+export function getManageHostDeviceByHospitalId(hospitalId) {
+  return request({
+    url: `/ncs/device/get_manage_host_device_by_hospital_id/${hospitalId}`,
+    method: 'GET',
+    loading: false
+  })
+}
+

+ 47 - 0
src/api/ncs_group_host_manage.js

@@ -0,0 +1,47 @@
+import request from '@/utils/request'
+
+/** 新增总控护士主机和护士主机的管理关系 */
+export function add(params) {
+  return request({
+    url: '/ncs/group_host_manage',
+    method: 'POST',
+    loading: true,
+    data: params
+  })
+}
+
+/** 删除总控护士主机和护士主机的管理关系 */
+export function remove(id) {
+  return request({
+    url: `/ncs/group_host_manage/${id}`,
+    method: 'DELETE',
+    loading: true
+  })
+}
+
+/** 更新总控护士主机和护士主机的管理关系 */
+export function update(id, params) {
+  return request({
+    url: `/ncs/group_host_manage/${id}`,
+    method: 'put',
+    data: params
+  })
+}
+
+/** 查询某个医院下所有护士主机 */
+export function getGroupHostByHospitalId(hospitalId) {
+  return request({
+    url: `/ncs/group_host_manage/get_group_host_by_hospital_id/${hospitalId}`,
+    method: 'get',
+    loading: false
+  })
+}
+
+export function updateParentById(params) {
+  return request({
+    url: '/ncs/group_host_manage/update_parent_by_id',
+    method: 'POST',
+    loading: true,
+    data: params
+  })
+}

+ 9 - 0
src/api/ncs_systemconfig.js

@@ -54,3 +54,12 @@ export function get(id, params) {
     params
   })
 }
+
+/** 查询单个系统参数 */
+export function getConfig(keyCode) {
+  return request({
+    url: `/ncs/config/get_config/${keyCode}`,
+    method: 'get',
+    loading: false
+  })
+}

+ 125 - 9
src/views/hospital/ncs_device/deviceManager.vue

@@ -19,7 +19,7 @@
         <div class="toolbar-search">
           <en-table-search placeholder="请输入搜索关键字" @search="handlerSearch" />
         </div>
-        <div v-if="hasAdd" class="toolbar-btns">
+        <div class="toolbar-btns">
           <el-button type="primary" size="mini" @click="handleAdd">新增设备</el-button>
         </div>
       </div>
@@ -193,7 +193,7 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row v-if="hasSosDeviceSettings">
+        <el-row v-if="sosDeviceSetting.type === 2">
           <el-col :span="12">
             <el-form-item label="报警时间" prop="setting_time">
               <el-input-number v-model="sosDeviceSetting.setting_time" controls-position="right" :min="0" :max="60" />
@@ -231,6 +231,32 @@
             </el-form-item>
           </el-col>
         </el-row>
+
+        <el-row v-if="groupHostDevices.length > 0">
+          <el-col :span="24">
+            <el-form-item label="护士主机列表">
+              <div class="text item">
+                <el-row>
+                  <el-checkbox-group v-model="newCheckList">
+                    <el-col v-for="(bed,_index) in groupHostDeviceList" :key="_index" :xs="8" :sm="8" :md="6" :lg="6" :xl="6">
+                      <el-checkbox :label="bed.id" @change="handleCheckboxChanged(bed)">
+                        <span v-if="bed.group_id && !bed.checked" style="color: #13ce66">{{ bed.name }}  <span style="color: #302db4">{{ bed.group_name }}</span></span>
+                        <span v-else>{{ bed.name }}</span>
+                      </el-checkbox>
+                    </el-col>
+                  </el-checkbox-group>
+                  <el-col v-for="(bed,_index) in groupHostDeviceList" :key="_index" :xs="8" :sm="8" :md="6" :lg="6" :xl="6">
+                    <!--                    <el-checkbox v-model="bed.checked">-->
+                    <!--                      <span v-if="bed.group_id && !bed.checked" style="color: #13ce66">{{ bed.clerk_name }}  <span style="color: #302db4">{{ bed.group_name }}</span></span>-->
+                    <!--                      <span v-else>{{ bed.clerk_name }}</span>-->
+                    <!--                    </el-checkbox>-->
+                  </el-col>
+                </el-row>
+              </div>
+            </el-form-item>
+
+          </el-col>
+        </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="handlerFormSubmit('deviceEditForm')">确 定</el-button>
@@ -253,6 +279,7 @@ import * as API_Frame from '@/api/ncs_hospitalFrame'
 import { FRAME_TYPE } from '@/utils/enum/FrameTypeEnum'
 import * as shop_API from '@/api/ncs_shop'
 import * as API_SosDeviceSetting from "@/api/ncs_sos_device_settings";
+import * as API_GroupHostManage from "@/api/ncs_group_host_manage";
 export default {
   name: 'DeviceManager',
   components: { ButtonCellRender, ListFilter, RadioFilter },
@@ -390,7 +417,12 @@ export default {
           label: '关爱老人模式'
         }
       ],
-      isLedDevice: false
+      isLedDevice: false,
+      newCheckList: [],
+      newPartIds: [],
+      oldCheckList: [],
+      groupHostDevices: [],
+      groupHostDeviceList: []
     }
   },
   computed: {
@@ -543,9 +575,15 @@ export default {
       })
     },
     /** 将partFrames做分割 */
-    getFramesByType(device_type) {
+    getFramesByType(frame_type) {
+      let list = [];
       if (this.partFrames != null) {
-        this.typeFrames = this.partFrames.filter(item => item.type === device_type)
+        if (frame_type === FRAME_TYPE.HOSPITAL) {
+          list = this.partFrames.filter(item => item.type === frame_type)
+          this.typeFrames = list.concat(this.typeFrames.filter(item => item.type === FRAME_TYPE.PART))
+        } else {
+          this.typeFrames = this.partFrames.filter(item => item.type === frame_type)
+        }
       }
     },
     /**
@@ -689,8 +727,9 @@ export default {
     },
     /** 设备类型选中对应的空间结构  **/
     deviceTypeChangeToFrameTypeChange(val) {
-      if (val === DEVICE_TYPE.NURSE_HOST ||
-          val === DEVICE_TYPE.DOCTOR_HOST ||
+      if (val === DEVICE_TYPE.NURSE_HOST) {
+        this.getFramesByType(FRAME_TYPE.HOSPITAL)
+      } else if (val === DEVICE_TYPE.DOCTOR_HOST ||
           val === DEVICE_TYPE.LED_SCREEN ||
           val === DEVICE_TYPE.LCD_SCREEN ||
           val === DEVICE_TYPE.NURSE_WATCH ||
@@ -720,6 +759,7 @@ export default {
     },
     /** 添加设备事件 **/
     handleAdd() {
+      this.groupHostDevices = []
       this.deviceModel = {
         soft_ver: 'SV1.0',
         hard_ver: 'HV1.0',
@@ -752,7 +792,8 @@ export default {
     },
     /** 修改设备  **/
     handleEdit(params) {
-      this.getRoles({ page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc' })
+      this.groupHostDevices = []
+      this.getRoles({page_size: 200, page_no: 1, fixedCondition: ' shop_id = -1', sort: ' role_id', dir: 'desc'})
       this.getDevices(this.$store.getters.partId)
       this.getSosDeviceSetting(params.id)
       this.deviceTypeChangeToFrameTypeChange(params.device_type)
@@ -768,6 +809,9 @@ export default {
       this.deviceModel = {
         ...params
       }
+      if (params.device_type === DEVICE_TYPE.NURSE_HOST && params.part_id == this.$store.getters.partId) {
+        this.getGroupHost(params.id, params.part_id)
+      }
       this.deviceEditTitle = '修改设备'
       this.deviceDialogVisible = true
       this.deviceTypeDisabled = true // 修改设备时,不能改变设备类型
@@ -777,9 +821,10 @@ export default {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           const _this = this;
+          this.deviceModel.part_id = this.getPartId(this.deviceModel.frame_id)
           /** 新增 */
           if (!this.deviceModel.id) {
-            API_Device.add(this.deviceModel).then(() => {
+            API_Device.add(this.deviceModel).then(r => {
               this.$message.success('保存成功!')
               _this.device = r
               this.sosDeviceSetting.device_id = _this.device.id
@@ -803,6 +848,23 @@ export default {
               this.getList()
             })
 
+            if (this.deviceModel.device_type === DEVICE_TYPE.NURSE_HOST && this.deviceModel.part_id === this.$store.getters.partId) {
+              const addIds = this.newCheckList.filter(function(val) { return _this.oldCheckList.indexOf(val) === -1 })
+              console.log('addIds=', addIds)
+              this.getPartIds(addIds)
+              console.log('partIds=', this.newPartIds)
+              const delIds = this.oldCheckList.filter(function(val) { return _this.newCheckList.indexOf(val) === -1 })
+              console.log('delIds=', delIds)
+              const data = {
+                deviceId: this.deviceModel.id,
+                addIds: addIds.join(','),
+                partIds: this.newPartIds.join(','),
+                delIds: delIds.join(',')
+              }
+              console.log('data==', data)
+              API_GroupHostManage.updateParentById(data)
+            }
+
             if (this.hasSosDeviceSettings) {
               this.sosDeviceSetting.device_id = this.deviceModel.id
               API_SosDeviceSetting.updateByDeviceId(this.deviceModel.id, this.sosDeviceSetting).then(() => {
@@ -821,10 +883,46 @@ export default {
                 this.getList()
               })
             }
+            this.deviceDialogVisible = false
+            this.getList()
           }
         }
       })
     },
+    getGroupHost(id, hospitalId) {
+      const _this = this
+      this.newCheckList = []
+      this.newPartIds = []
+      this.oldCheckList = []
+
+      API_Device.getManageHostDeviceByHospitalId(hospitalId).then(r => {
+        _this.groupHostDevices = r
+        _this.getGroupHostDeviceList(id, hospitalId)
+      })
+    },
+    getGroupHostDeviceList(id, hospitalId) {
+
+      const _this = this
+      API_GroupHostManage.getGroupHostByHospitalId(hospitalId).then(r => {
+        r.forEach(item => {
+          _this.groupHostDevices.forEach(t => {
+            if (t.id === item.manage_host_device_id) {
+              t.group_name = item.host_device_name
+              t.group_id = item.host_device_id
+              if (item.host_device_id === id) {
+                t.checked = true
+                _this.oldCheckList.push(item.manage_host_device_id)
+                _this.newCheckList.push(item.manage_host_device_id)
+              }
+            }
+          })
+        })
+        _this.groupHostDeviceList = _this.groupHostDevices
+      })
+    },
+    handleCheckboxChanged(item) {
+      item.checked = !item.checked
+    },
     /** 分页大小发生改变 */
     handlePageSizeChange(size) {
       this.params.page_size = size
@@ -860,6 +958,24 @@ export default {
       shop_API.getShopList(part_id).then(res => {
         this.shopOptions = res
       })
+    },
+    getPartId(frame_id) {
+      let frame= {}
+      frame = this.partFrames.filter(p => p.id === frame_id)[0]
+      if (frame.part_id != null) {
+        return frame.part_id
+      } else {
+        return this.$store.getters.partId
+      }
+    },
+    getPartIds(addIds) {
+      const partIds = []
+      let device = {}
+      for (let i = 0; i < addIds.length; i++) {
+        device = this.groupHostDevices.filter(p => p.id === addIds[i])[0]
+        partIds.push(device.part_id)
+      }
+      this.newPartIds = partIds
     }
   }
 }

+ 1 - 1
src/views/ncs-device/components/deviceManager.vue

@@ -190,7 +190,7 @@
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row v-if="hasSosDeviceSettings">
+        <el-row v-if="sosDeviceSetting.type === 2">
           <el-col :span="12">
             <el-form-item label="报警时间" prop="setting_time">
               <el-input-number v-model="sosDeviceSetting.setting_time" controls-position="right" :min="0" :max="60" />

+ 22 - 1
src/views/ncs-orginazition/components/partInfoEdit.vue

@@ -254,6 +254,17 @@
                 <el-input-number v-model="formmodel.transfer_duration_leader" :min="1" :max="100" label="护士组长转接时长" />
               </el-form-item>
             </el-col>
+          </el-row>
+
+          <el-row>
+            <el-col :span="8">
+              <el-form-item label="护士主机转接时长" prop="key_val">
+                <el-input-number v-model="systemConfig.key_val" :min="1" :max="60" label="护士主机转接时长" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row>
             <el-col :span="8">
               <el-form-item label="分机通讯方式" prop="communication_mode_bed">
                 <el-radio-group v-model="formmodel.communication_mode_bed">
@@ -347,6 +358,7 @@ import { saveListByCustomer } from '@/api/ncs_customer'
 import Storage from '@/utils/storage'
 import { init485Device, initData } from "@/api/initialize";
 import * as API_Clerk from '@/api/ncs_clerk'
+import * as API_SystemConfig from '@/api/ncs_systemconfig'
 export default {
   name: 'PartInfoEdit',
   props: {
@@ -365,7 +377,8 @@ export default {
       parents: [],
       isShow: false,
       isDisabled: false,
-      partRoles: []
+      partRoles: [],
+      systemConfig: {}
     }
   },
   async mounted() {
@@ -434,6 +447,9 @@ export default {
           this.formmodel.nurse_title = res.nurse_title
           this.formmodel.nurse_valid = res.nurse_valid
           this.formmodel.up_seconds = res.up_seconds
+          API_SystemConfig.getConfig('groupHostTransferSeconds').then(r => {
+            this.systemConfig = r
+          })
           // // 处理护理等级颜色
           // this.$nextTick(() => {
           //   const specialNurseCfg = this.nurseLevel0Config.find(p => p.id === this.formmodel.part_special_care)
@@ -470,6 +486,11 @@ export default {
           }
           API_Part.editPartSetting(this.formmodel, this.partId).then(res => {
             this.$message.success('保存成功!')
+            if (this.systemConfig.id != null) {
+              API_SystemConfig.update(this.systemConfig.id, this.systemConfig).then(res => {
+                this.$message.success('保存成功!')
+              })
+            }
           })
         } else {
           this.$message.error('表单填写错误,请检查!')