han il y a 2 ans
Parent
commit
05cabc3e0a

+ 40 - 0
src/api/biz/archives/patrolWardApi.ts

@@ -7,8 +7,33 @@ enum Api {
   archivesPatrolWardAdd = '/archives/patrolWard/add',
   archivesPatrolWardEdit = '/archives/patrolWard/edit',
   archivesPatrolWardRemove = '/archives/patrolWard/removeByIds',
+  archivesPatrolWardQueryCheckRoomRecord = '/archives/patrolWard/queryCheckRoomRecord',
+  archivesPatrolWardQueryPersonNumber = '/archives/patrolWard/queryPersonNumber',
+  archivesPatrolWardFollowOrNo = '/archives/patrolWard/followOrNo',
 }
 
+/**
+ *
+ * @author fan
+ * @date  2023/06/30 17:39
+ * @description: 根据条件查询查房列表,权限 - biz:patrolward:query
+ * @method: POST
+ * @param:
+ *       {String}  updatorName     updator_name
+ * @return:
+ *       {String}  patientBasicId  基础病历id
+ *       {String}  scheduledId  排床id
+ *       {Date}  patrolTime  查房时间
+ *       {String}  content  查房内容
+ *       {String}  updatorName  updator_name
+ */
+
+export const archivesPatrolWardQueryCheckRoomRecord = (params?: object) => {
+  return defHttp.post({
+    url: Api.archivesPatrolWardQueryCheckRoomRecord,
+    params: setParams(params),
+  });
+};
 /**
  *
  * @author fan
@@ -91,3 +116,18 @@ export const archivesPatrolWardEdit = (params?: object) => {
 export const archivesPatrolWardRemove = (params: Array<string | number>) => {
   return defHttp.post({ url: Api.archivesPatrolWardRemove, params: params });
 };
+
+/**
+ * @description: 查房页面各条件人员数量,权限 - biz:patrolward:querypersonnumber
+ * @method: get
+ */
+export const archivesPatrolWardQueryPersonNumber = () => {
+  return defHttp.get({ url: Api.archivesPatrolWardQueryPersonNumber });
+};
+/**
+ * @description: 关注或取消关注,权限 - biz:patrolward:followOrNo
+ * @method: get
+ */
+export const archivesPatrolWardFollowOrNo = () => {
+  return defHttp.post({ url: Api.archivesPatrolWardFollowOrNo });
+};

+ 124 - 0
src/views/biz/visit/check/data.ts

@@ -0,0 +1,124 @@
+import dayjs from 'dayjs';
+import { DescItem } from '/@/components/Description';
+import { BasicColumn, FormSchema } from '/@/components/Table';
+
+export const BasicTab = [
+  {
+    key: '0',
+    label: '全部',
+    value: 128,
+    hasValue: true,
+    hasBracket: true,
+  },
+  {
+    key: '1',
+    label: '透中患者',
+    value: 12,
+    hasValue: true,
+    prefixColor: '#1BC1B3',
+    hasBracket: true,
+  },
+  {
+    key: '2',
+    label: '非透中患者',
+    value: 18,
+    hasValue: true,
+    prefixColor: '#D3D8DD',
+    hasBracket: true,
+  },
+  {
+    key: '3',
+    label: '新患者',
+    value: 18,
+    hasValue: true,
+    prefixColor: '#F7B500',
+    hasBracket: true,
+  },
+  {
+    key: '4',
+    label: '关注',
+    value: 18,
+    hasValue: true,
+    prefixColor: '#33CCFF',
+    hasBracket: true,
+  },
+];
+export const BasicTabActive = BasicTab[0].key;
+
+export const columns: BasicColumn[] = [
+  {
+    title: '姓名',
+    dataIndex: 'name',
+    width: 150,
+    align: 'left',
+  },
+  {
+    title: '信息',
+    dataIndex: 'gender',
+    width: 150,
+    align: 'left',
+  },
+  {
+    title: '查房时间',
+    dataIndex: 'patrolTime',
+    width: 200,
+    align: 'left',
+  },
+  {
+    title: '最新查房内容',
+    dataIndex: 'content',
+    align: 'left',
+  },
+  {
+    title: '记录人',
+    dataIndex: 'recorder',
+    width: 120,
+    align: 'left',
+  },
+];
+
+// 表单新增编辑
+export const dataFormSchema: FormSchema[] = [
+  {
+    label: '查房时间',
+    field: 'patrolTime',
+    required: true,
+    component: 'DatePicker',
+    componentProps: ({ formModel }) => {
+      return {
+        placeholder: '请输入查房时间',
+        getPopupContainer: () => document.body,
+        valueFormat: 'YYYY-MM-DD HH:mm:ss',
+        showTime: true,
+        disabledDate: current => {
+          return current < dayjs(formModel.accessSetUpTime).subtract(1, 'day').endOf('day');
+        },
+      };
+    },
+  },
+  {
+    label: '记录',
+    field: 'content',
+    required: true,
+    component: 'InputTextArea',
+    componentProps: {
+      placeholder: '请输入查房内容',
+    },
+  },
+];
+
+// 表单详情查看
+export const viewSchema: DescItem[] = [
+  {
+    label: '查房时间',
+    field: 'patrolTime',
+  },
+  {
+    label: '查房内容',
+    field: 'content',
+  },
+  {
+    label: '记录人',
+    field: 'recorder',
+  },
+];

+ 76 - 0
src/views/biz/visit/check/formModal.vue

@@ -0,0 +1,76 @@
+<template>
+  <BasicModal
+    v-bind="$attrs"
+    destroyOnClose
+    @register="registerModal"
+    :title="getTitle"
+    :width="width"
+    @ok="handleSubmit"
+    :showFooter="true"
+  >
+    <BasicForm @register="registerForm" layout="vertical" />
+  </BasicModal>
+</template>
+<script lang="ts" setup>
+  import { ref, computed, unref } from 'vue';
+  import { BasicModal } from '/@/components/Modal';
+  import { useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { dataFormSchema } from './data';
+
+  import {
+    archivesPatrolWardAdd,
+    archivesPatrolWardEdit,
+    archivesPatrolWardDetail,
+  } from '/@/api/biz/archives/patrolWardApi';
+
+  const emit = defineEmits(['success', 'register']);
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '新增查房' : '编辑查房'));
+  const width = '45%';
+  const isUpdate = ref(false);
+  const rowId = ref();
+
+  const { createMessage } = useMessage();
+  const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
+    labelWidth: 100,
+    schemas: dataFormSchema,
+    showActionButtonGroup: false,
+    actionColOptions: {
+      span: 23,
+    },
+  });
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
+    await resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+
+    if (unref(isUpdate)) {
+      const resData = await archivesPatrolWardDetail(data.record.id);
+      rowId.value = resData.id;
+      await setFieldsValue({
+        ...resData,
+      });
+    }
+  });
+
+  // 提交按钮事件
+  async function handleSubmit() {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+      !unref(isUpdate)
+        ? await archivesPatrolWardAdd({ ...values })
+        : await archivesPatrolWardEdit({ ...values, id: rowId.value });
+      !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
+      closeModal();
+      emit('success', {
+        isUpdate: unref(isUpdate),
+        values: { ...values, id: rowId.value },
+      });
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  }
+</script>

+ 261 - 3
src/views/biz/visit/check/index.vue

@@ -1,7 +1,265 @@
 <template>
-  <div> 占位符 </div>
+  <div class="m-4">
+    <div>
+      <XTTitle title="查房" @click="callTitleClick" />
+      <div class="flex justify-between my-4">
+        <XTTab
+          type="check"
+          :width="160"
+          :selected="activeKey"
+          :data="tabData"
+          @item-click="callTab"
+        />
+        <XTForm :form-data="formData" @change="callFormChange" @click="callFormClick" />
+      </div>
+      <div class="flex mb-2" v-if="siftData.length">
+        <Sift :data="siftData" @close="callClose" />
+      </div>
+      <BasicTable @register="registerTable">
+        <template #bodyCell="{ column, record }">
+          <template v-if="column.key === 'name'">
+            <span :class="['table-dot', 'table-dot--' + record.status]" />
+            <span>{{ record.name }}</span>
+          </template>
+          <template v-if="column.key === 'patrolTime'">
+            {{ record.patrolTime ? dayjs(record.patrolTime).format('YYYY-MM-DD') : '' }}
+          </template>
+
+          <template v-if="column.key === 'action'">
+            <TableAction
+              :dropDownActions="[
+                {
+                  auth: 'storage:config:edit',
+                  tooltip: '查房记录',
+                  label: '查房记录',
+                  ifShow: !record.master,
+                },
+                {
+                  auth: 'storage:config:edit',
+                  tooltip: '编辑',
+                  label: '编辑',
+                  onClick: handleEdit.bind(null, record),
+                },
+                {
+                  auth: 'storage:config:remove',
+                  tooltip: '取消关注',
+                  label: '取消关注',
+                  color: 'error',
+                  // popConfirm: {
+                  //   title: '是否确定要取消关注?',
+                  //   placement: 'left',
+                  //   confirm: handleDelete.bind(null, record),
+                  // },
+                },
+              ]"
+              :actions="[
+                {
+                  auth: 'sys:log:query',
+                  // icon: 'icon-eye|iconfont',
+                  tooltip: '查房',
+                  label: '查房',
+                  onClick: handleView.bind(null, record),
+                },
+              ]"
+            />
+          </template>
+        </template>
+      </BasicTable>
+    </div>
+    <FormModal @register="registerModal" @success="handleSuccess" />
+    <ViewDrawer @register="registerDrawerView" @success="handleSuccess" />
+  </div>
 </template>
 
-<script setup lang="ts"></script>
+<script setup lang="ts">
+  import { XTTitle } from '/@/components/XTTitle/index';
+  import { XTTab } from '/@/components/XTTab/index';
+  import { XTForm } from '/@/components/XTForm/index';
+  import { Sift } from '/@/components/XTList/index';
+  import { BasicTable, useTable, TableAction } from '/@/components/TableCard';
+  import { BasicTab, BasicTabActive, columns } from './data';
+  import { ref } from 'vue';
+  // import { useRouter } from 'vue-router';
+  import {
+    archivesPatrolWardQueryCheckRoomRecord,
+    archivesPatrolWardQueryPersonNumber,
+  } from '/@/api/biz/archives/patrolWardApi';
+  // import { formatDictColor, formatDictFontColor, formatDictValue } from '/@/utils';
+  import { onMounted, reactive } from 'vue';
+  import dayjs from 'dayjs';
+  import { useModal } from '/@/components/Modal';
+  import FormModal from './formModal.vue';
+  import ViewDrawer from './viewDrawer.vue';
+  import { useDrawer } from '@/components/Drawer';
+
+  // const bizDictOptions = reactive<any>({});
+  // 路由跳转
+  // const router = useRouter();
+  const activeKey = ref(BasicTabActive);
+  const tabData = ref(BasicTab);
+  const [registerModal, { openModal }] = useModal();
+  const [registerDrawerView, { openDrawer, openDrawer: openDrawerView }] = useDrawer();
+
+  onMounted(async () => {
+    const personNumber = await archivesPatrolWardQueryPersonNumber();
+    console.log('🚀 ~ file: index.vue:104 ~ onMounted ~ stats:', personNumber);
+    tabData.value = tabData.value.map(ele => {
+      if (ele.key == '0') {
+        ele.value = personNumber.all;
+      }
+      if (ele.key == '1') {
+        ele.value = personNumber.dialysisPatients;
+      }
+      if (ele.key == '2') {
+        ele.value = personNumber.noDialysisPatients;
+      }
+      if (ele.key == '3') {
+        ele.value = personNumber.newPatient;
+      }
+      if (ele.key == '4') {
+        ele.value = personNumber.attention;
+      }
+      return ele;
+    });
+    console.log('🚀 ~ file: index.vue:118 ~ onMounted ~ tabData.value:', tabData.value);
+  });
+  const [registerTable, { reload }] = useTable({
+    api: archivesPatrolWardQueryCheckRoomRecord,
+    // exportAuthList: ['sys:log:export'],
+    rowKey: 'id',
+    columns,
+    showIndexColumn: true,
+    bordered: true,
+    actionColumn: {
+      width: 200,
+      title: '操作',
+      dataIndex: 'action',
+    },
+    beforeFetch: handleBeforeFetch,
+    afterFetch: handleAfterFetch,
+  });
+  // 筛选数据
+  const siftData = ref([]);
+
+  // formdata
+  const formData = [
+    {
+      name: 'tableSort',
+      componentType: 'Select',
+      placeholder: '请选择',
+      width: 120,
+      defaultValue: 'patrolTime',
+      dicts: [
+        { label: '按查房时间', value: 'patrolTime' },
+        { label: '按姓氏', value: 'patientNamePinyin' },
+      ],
+    },
+    {
+      name: 'name',
+      componentType: 'Input',
+      placeholder: '请输入患者姓名',
+      width: 200,
+      prefix: 'icon-xt-search',
+    },
+  ];
+
+  const formValue = reactive({
+    name: '',
+  }) as any;
+
+  // 表格请求之前,对参数进行处理, 添加默认 排序
+  function handleBeforeFetch(params) {
+    // return { ...params, orders: tableSort.value };
+    const sift = {};
+    siftData.value.forEach(ele => {
+      sift[ele.field] = ele.isDict ? ele.dict : ele.value;
+    });
+    return {
+      ...params,
+      queryType: activeKey.value == '0' ? '0' : activeKey.value,
+      name: formValue.name,
+      orders: [{ field: 'patrolTime', direction: 'DESC' }],
+      sortType: 'st_patrol_time',
+      ...sift,
+    };
+  }
+
+  function handleAfterFetch(data) {
+    return data;
+  }
+
+  // 详情按钮事件
+  function handleView(record: Recordable) {
+    console.log(record);
+    openDrawerView(true, {
+      record,
+    });
+  }
+
+  // 编辑按钮事件
+  function handleEdit(record: Recordable) {
+    openModal(true, {
+      record,
+      isUpdate: true,
+    });
+  }
+
+  // 弹窗回调事件
+  async function handleSuccess({ isUpdate, values }) {
+    console.log(isUpdate);
+    console.log(values);
+    await reload();
+  }
+  // 回调
+  async function callTab(data) {
+    activeKey.value = data.value;
+    await reload();
+  }
+
+  function callTitleClick(data) {
+    if (data.type == 'add') {
+      openDrawer(true, {
+        isUpdate: false,
+        record: data,
+      });
+    }
+  }
+
+  async function callFormChange(data) {
+    formValue.name = data.name ? data.name : '';
+    await reload();
+  }
+
+  async function callFormClick(data) {
+    if (data.name == 'filter') {
+      const record = [];
+      siftData.value.forEach(ele => {
+        const obj = {
+          field: ele.field,
+          value: ele.value,
+        } as any;
+        if (ele.isDict) {
+          obj.value = ele.dict;
+        }
+        record.push(obj);
+      });
+      openDrawer(true, {
+        record,
+      });
+    }
+  }
 
-<style lang="less" scoped></style>
+  async function callClose(data) {
+    if (data.type == 'clear') {
+      console.log('清空全部');
+      siftData.value = [];
+    }
+    if (data.type == 'close') {
+      console.log('删除部分条件');
+      siftData.value = siftData.value.filter(ele => {
+        return ele.field != data.item?.field;
+      });
+    }
+    await reload();
+  }
+</script>

+ 46 - 0
src/views/biz/visit/check/viewDrawer.vue

@@ -0,0 +1,46 @@
+<template>
+  <BasicDrawer
+    v-bind="$attrs"
+    destroyOnClose
+    @register="registerDrawer"
+    :title="getTitle"
+    :width="width"
+  >
+    <Description @register="registerDesc" :data="descData" />
+  </BasicDrawer>
+</template>
+<script lang="ts" setup>
+  import { onBeforeMount, ref } from 'vue'; // onBeforeMount,
+  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
+  import { Description, useDescription } from '/@/components/Description';
+  import { viewSchema } from './data';
+
+  import { archivesPatrolWardDetail } from '/@/api/biz/archives/patrolWardApi';
+  import { listDictModel } from '/@/api/common';
+  import { formatDictValue } from '/@/utils';
+
+  const descData = ref({});
+  const getTitle = '查看查房记录';
+  const width = '45%';
+
+  const typeOptions = ref();
+  onBeforeMount(async () => {
+    typeOptions.value = await listDictModel({ dictCode: 'sys_login_log_type' });
+  });
+  const [registerDrawer] = useDrawerInner(async data => {
+    console.log('::::::::::', data.record);
+    const resData = await archivesPatrolWardDetail(data.record.id);
+    descData.value = {
+      ...resData,
+      type: formatDictValue(typeOptions.value, resData.type),
+    };
+  });
+  const [registerDesc] = useDescription({
+    schema: viewSchema,
+    column: 2,
+    size: 'middle',
+    labelStyle: {
+      width: '120px',
+    },
+  });
+</script>