|
@@ -0,0 +1,168 @@
|
|
|
|
|
+import type { TransformList, TransformRecord } from '#/api';
|
|
|
|
|
+
|
|
|
|
|
+/** 点评专家(接口就绪后替换为真实请求) */
|
|
|
|
|
+export namespace PrescriptionReviewModel {
|
|
|
|
|
+ export interface ReviewExpert extends TransformRecord {
|
|
|
|
|
+ access: string;
|
|
|
|
|
+ name: string;
|
|
|
|
|
+ hospitalName: string;
|
|
|
|
|
+ phone: string;
|
|
|
|
|
+ /** 0 启用,1 禁用 */
|
|
|
|
|
+ status: 0 | 1;
|
|
|
|
|
+ institutionId?: string;
|
|
|
|
|
+ pid?: string;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+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,后期对接后端分页接口) */
|
|
|
|
|
+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 },
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/** 点评专家状态更改(当前为本地 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);
|
|
|
|
|
+}
|