Bläddra i källkod

feat(@six/smart-pharmacy): 智慧药事系统第二版-点评专家接口对接

cmj 2 veckor sedan
förälder
incheckning
cf2a434842

+ 24 - 142
apps/smart-pharmacy/src/api/method/prescription-review.ts

@@ -1,5 +1,10 @@
 import type { TransformList, TransformRecord } from '#/api';
 
+import {
+  listUsersMethod,
+  updateUserStatusMethod,
+} from '#/api/method/system';
+
 /** 处方点评(接口就绪后替换为真实请求) */
 export namespace PrescriptionReviewModel {
   export interface ReviewExpert extends TransformRecord {
@@ -194,157 +199,34 @@ export namespace PrescriptionReviewModel {
   }
 }
 
-const MOCK_EXPERTS: PrescriptionReviewModel.ReviewExpert[] = [
-  {
-    id: '1',
-    access: 'za00011',
-    name: '孙明1',
-    hospitalName: '蒋村社区卫生服务中心',
-    phone: '13112342344',
-    status: 1,
-    institutionId: 'org-1',
-    createUser: '张三',
-    createTime: '2023-05-15 13:35',
-  },
-  {
-    id: '2',
-    access: 'za00012',
-    name: '孙明2',
-    hospitalName: '蒋村社区卫生服务中心',
-    phone: '13156782344',
-    status: 0,
-    institutionId: 'org-1',
-    createUser: '张三',
-    createTime: '2023-05-16 09:20',
-  },
-  {
-    id: '3',
-    access: 'za00013',
-    name: '李华',
-    hospitalName: '西溪社区卫生服务中心',
-    phone: '13298765432',
-    status: 0,
-    institutionId: 'org-2',
-    createUser: '李四',
-    createTime: '2023-06-01 10:15',
-  },
-  {
-    id: '4',
-    access: 'za00014',
-    name: '王芳',
-    hospitalName: '西溪社区卫生服务中心',
-    phone: '13387654321',
-    status: 1,
-    institutionId: 'org-2',
-    createUser: '李四',
-    createTime: '2023-06-02 14:40',
-  },
-  {
-    id: '5',
-    access: 'za00015',
-    name: '赵强',
-    hospitalName: '蒋村社区卫生服务中心',
-    phone: '13567891234',
-    status: 0,
-    institutionId: 'org-1',
-    createUser: '王五',
-    createTime: '2023-07-10 08:50',
-  },
-  {
-    id: '6',
-    access: 'za00016',
-    name: '周敏',
-    hospitalName: '文新社区卫生服务中心',
-    phone: '13678901234',
-    status: 1,
-    institutionId: 'org-3',
-    createUser: '王五',
-    createTime: '2023-07-11 16:25',
-  },
-  {
-    id: '7',
-    access: 'za00017',
-    name: '吴磊',
-    hospitalName: '文新社区卫生服务中心',
-    phone: '13789012345',
-    status: 0,
-    institutionId: 'org-3',
-    createUser: '赵六',
-    createTime: '2023-08-05 11:30',
-  },
-  {
-    id: '8',
-    access: 'za00018',
-    name: '郑洁',
-    hospitalName: '蒋村社区卫生服务中心',
-    phone: '13890123456',
-    status: 0,
-    institutionId: 'org-1',
-    createUser: '赵六',
-    createTime: '2023-08-06 15:45',
-  },
-  {
-    id: '9',
-    access: 'za00019',
-    name: '钱伟',
-    hospitalName: '西溪社区卫生服务中心',
-    phone: '13901234567',
-    status: 1,
-    institutionId: 'org-2',
-    createUser: '张三',
-    createTime: '2023-09-12 09:10',
-  },
-  {
-    id: '10',
-    access: 'za00020',
-    name: '孙丽',
-    hospitalName: '文新社区卫生服务中心',
-    phone: '13012345678',
-    status: 0,
-    institutionId: 'org-3',
-    createUser: '李四',
-    createTime: '2023-09-13 13:55',
-  },
-];
-
-function filterExperts(
-  items: PrescriptionReviewModel.ReviewExpert[],
-  query?: Partial<PrescriptionReviewModel.ReviewExpert>,
-) {
-  const institutionId = query?.institutionId;
-  if (!institutionId) return items;
-  return items.filter((item) => item.institutionId === String(institutionId));
-}
-
-/** 点评专家列表(当前为本地 mock,后期对接后端分页接口) */
+/** 点评专家列表(userType=01) */
 export function listReviewExpertsMethod(
   page = 1,
   size = 10,
-  query?: Partial<PrescriptionReviewModel.ReviewExpert>,
-): Promise<TransformList<PrescriptionReviewModel.ReviewExpert>> {
-  const filtered = filterExperts(MOCK_EXPERTS, query);
-  const start = (page - 1) * size;
-  const items = filtered.slice(start, start + size);
-  return Promise.resolve({
-    items,
-    total: filtered.length,
-    data: { page, size, total: filtered.length },
-  });
+  query?: Partial<PrescriptionReviewModel.ReviewExpert> & {
+    sititutionId?: string;
+  },
+) {
+  const { institutionId, sititutionId, ...rest } = query ?? {};
+  return listUsersMethod(page, size, {
+    ...rest,
+    userType: '01',
+    sititutionId: sititutionId ?? institutionId,
+  }).then((res) => ({
+    ...res,
+    items: res.items.map((item) => ({
+      ...item,
+      institutionId: item.sititutionId,
+    })) as PrescriptionReviewModel.ReviewExpert[],
+  }));
 }
 
-/** 点评专家状态更改(当前为本地 mock,后期对接后端接口) */
+/** 点评专家状态更改 */
 export function updateReviewExpertStatusMethod(
   expertId: string,
   { status }: { status: 0 | 1 },
 ) {
-  const expert = MOCK_EXPERTS.find(
-    (item) => item.id === expertId || item.pid === expertId,
-  );
-  if (!expert) {
-    return Promise.reject(new Error('专家不存在'));
-  }
-  expert.status = status;
-  return Promise.resolve(true);
+  return updateUserStatusMethod(expertId, { status });
 }
 
 const MOCK_INDICATOR_CATEGORIES: PrescriptionReviewModel.ReviewIndicatorCategory[] =

+ 2 - 2
apps/smart-pharmacy/src/views/prescription-review/expert/data.ts

@@ -14,7 +14,7 @@ export function useReviewExpertSearchFormSchema(): VbenFormSchema[] {
         allowClear: true,
         api: listUsersInstitutionMethodTree,
         childrenField: 'children',
-        class: 'w-full',
+        class: 'w-[300px]',
         dropdownStyle: { maxHeight: 400, overflow: 'auto' },
         labelField: 'name',
         placeholder: '请搜索选择',
@@ -23,7 +23,7 @@ export function useReviewExpertSearchFormSchema(): VbenFormSchema[] {
         treeNodeFilterProp: 'name',
         valueField: 'pid',
       },
-      fieldName: 'institutionId',
+      fieldName: 'sititutionId',
       label: '所属机构',
     },
   ];

+ 2 - 3
apps/smart-pharmacy/src/views/prescription-review/expert/list.vue

@@ -19,7 +19,7 @@ import {
 const [Grid] = useVbenVxeGrid({
   formOptions: {
     schema: useReviewExpertSearchFormSchema(),
-    submitOnChange: false,
+    submitOnChange: true,
     wrapperClass: 'review-expert-search-form',
   },
   gridOptions: {
@@ -27,8 +27,7 @@ const [Grid] = useVbenVxeGrid({
     height: 'auto',
     keepSource: true,
     pagerConfig: {
-      pageSize: 2,
-      layouts: ['PrevPage', 'Jump', 'NextPage'],
+      pageSize: 10,
     },
     proxyConfig: {
       ajax: {