Explorar el Código

fix: 预约挂号传递depCode参数

carver hace 2 años
padre
commit
e8a24658a6

+ 173 - 199
antbuilder/industry/hospitalV2/components/hospital-num-source/index.js

@@ -1,211 +1,185 @@
-import { createSubscribe } from 'applet-page-component';
-import * as utils from './../../utils';
-import { getDepDoctorList, getDepOrderSourceRemain } from './service';
+import { createSubscribe } from "applet-page-component";
+import * as utils from "./../../utils";
+import { getDepDoctorList, getDepOrderSourceRemain } from "./service";
 /* 判断日期是不是今天 */
 
-const isToday = date => {
-  const _date = new Date();
+const isToday = (date) => {
+	const _date = new Date();
 
-  const year = _date.getFullYear();
+	const year = _date.getFullYear();
 
-  const month = _date.getMonth() + 1;
+	const month = _date.getMonth() + 1;
 
-  const day = _date.getDate();
+	const day = _date.getDate();
 
-  const check = val => `${val}`.length <= 1 ? `0${val}` : val;
+	const check = (val) => (`${val}`.length <= 1 ? `0${val}` : val);
 
-  return date === [year, check(month), check(day)].join('/');
+	return date === [year, check(month), check(day)].join("/");
 };
 
-const copy = obj => JSON.parse(JSON.stringify(obj));
+const copy = (obj) => JSON.parse(JSON.stringify(obj));
 
 const defaultSource = {
-  normal: {
-    items: [],
-    type: 'normal',
-    name: '普通号'
-  },
-  expert: {
-    items: [],
-    name: '专家号',
-    type: 'expert'
-  }
+	normal: {
+		items: [],
+		type: "normal",
+		name: "普通号",
+	},
+	expert: {
+		items: [],
+		name: "专家号",
+		type: "expert",
+	},
 };
-Component(createSubscribe({
-  /* 分页逻辑 */
-  async onReachBottom() {
-    const {
-      loading,
-      isLastPage
-    } = this.data;
-    if (loading || isLastPage) return;
-    this.pageIndex = this.pageIndex + 1;
-    await this.updateData({
-      loading: true
-    });
-    await this.onSplitPage();
-  }
-
-})({
-  props: {
-    componentData: {}
-  },
-  data: {
-    date: '',
-    loading: true,
-    dateList: [],
-
-    /* 原始的列表 */
-    nativeList: [],
-
-    /* 是否为最后一页 */
-    isLastPage: false,
-    dataSource: copy(defaultSource),
-    headerHeight: utils.getHeaderHeight()
-  },
-
-  async didMount() {
-    await this.onRefresh();
-    await this.fetchDateRemainList();
-  },
-
-  methods: {
-    getQuery() {
-      const {
-        $routeConfig
-      } = this.$page;
-      return $routeConfig.query;
-    },
-
-    updateData(data) {
-      return new Promise(resolve => this.setData(data, resolve));
-    },
-
-    async onChange(date) {
-      await this.onRefresh(date);
-    },
-
-    /* 获取日期列表 */
-    async fetchDateRemainList() {
-      /* 获取日期列表 */
-      const {
-        departmentId
-      } = this.getQuery();
-      const list = await getDepOrderSourceRemain({
-        depId: departmentId
-      });
-      /* 处理数据 */
-
-      const dateList = list.map(item => {
-        const {
-          date
-        } = item;
-
-        const _date = date.replace(/-/g, '/');
-
-        const today = isToday(_date);
-        const day = new Date(_date).getDate();
-        const week = utils.getWeek(_date);
-        return { ...item,
-          date: _date,
-          showDay: day,
-          today,
-          week
-        };
-      });
-      await this.updateData({
-        dateList
-      });
-    },
-
-    /* 数据处理 */
-    formatData(list = []) {
-      const {
-        dataSource
-      } = this.data;
-      list.forEach(item => {
-        const {
-          items
-        } = dataSource[item.type];
-        if (items) items.push(item);
-      });
-      return { ...dataSource
-      };
-    },
-
-    /* 分页显示医生列表 */
-    async onSplitPage() {
-      let total = 0;
-      let dataList = [];
-      let success = true;
-      const {
-        date,
-        isLastPage
-      } = this.data;
-      let {
-        date: curDate = ''
-      } = date || {};
-
-      if (curDate) {
-        const reg = new RegExp('/', 'gm');
-        curDate = curDate.replace(reg, '-');
-      }
-
-      const {
-        departmentId
-      } = this.getQuery();
-      const params = {
-        date: curDate,
-        pageSize: 10,
-        depId: departmentId,
-        pageIndex: this.pageIndex
-      };
-
-      if (!isLastPage) {
-        try {
-          const {
-            list = [],
-            pagination = {}
-          } = await getDepDoctorList(params);
-          dataList = list;
-          total = pagination.total || 0;
-        } catch (e) {
-          success = false;
-        }
-      }
-
-      let state = {
-        loading: false
-      };
-
-      if (success) {
-        const {
-          nativeList
-        } = this.data;
-        const _list = [...nativeList, ...dataList];
-        state = { ...state,
-          nativeList: _list,
-          isLastPage: _list.length >= total,
-          dataSource: this.formatData(dataList)
-        };
-      }
-
-      await this.updateData(state);
-    },
-
-    /* 刷新数据 */
-    async onRefresh(curDate = '') {
-      /* 初始化数据 */
-      this.pageIndex = 1;
-      await this.updateData({
-        date: curDate,
-        loading: true,
-        nativeList: [],
-        isLastPage: false,
-        dataSource: copy(defaultSource)
-      });
-      await this.onSplitPage();
-    }
-
-  }
-}));
+Component(
+	createSubscribe({
+		/* 分页逻辑 */
+		async onReachBottom() {
+			const { loading, isLastPage } = this.data;
+			if (loading || isLastPage) return;
+			this.pageIndex = this.pageIndex + 1;
+			await this.updateData({
+				loading: true,
+			});
+			await this.onSplitPage();
+		},
+	})({
+		props: {
+			componentData: {},
+		},
+		data: {
+			date: "",
+			loading: true,
+			dateList: [],
+
+			/* 原始的列表 */
+			nativeList: [],
+
+			/* 是否为最后一页 */
+			isLastPage: false,
+			dataSource: copy(defaultSource),
+			headerHeight: utils.getHeaderHeight(),
+		},
+
+		async didMount() {
+			await this.onRefresh();
+			await this.fetchDateRemainList();
+		},
+
+		methods: {
+			getQuery() {
+				const { $routeConfig } = this.$page;
+				return $routeConfig.query;
+			},
+
+			updateData(data) {
+				return new Promise((resolve) => this.setData(data, resolve));
+			},
+
+			async onChange(date) {
+				await this.onRefresh(date);
+			},
+
+			/* 获取日期列表 */
+			async fetchDateRemainList() {
+				/* 获取日期列表 */
+				const { departmentId, depCode } = this.getQuery();
+				const list = await getDepOrderSourceRemain({
+					depId: departmentId,
+					depCode,
+				});
+				/* 处理数据 */
+
+				const dateList = list.map((item) => {
+					const { date } = item;
+
+					const _date = date.replace(/-/g, "/");
+
+					const today = isToday(_date);
+					const day = new Date(_date).getDate();
+					const week = utils.getWeek(_date);
+					return { ...item, date: _date, showDay: day, today, week };
+				});
+				await this.updateData({
+					dateList,
+				});
+			},
+
+			/* 数据处理 */
+			formatData(list = []) {
+				const { dataSource } = this.data;
+				list.forEach((item) => {
+					const { items } = dataSource[item.type];
+					if (items) items.push(item);
+				});
+				return { ...dataSource };
+			},
+
+			/* 分页显示医生列表 */
+			async onSplitPage() {
+				let total = 0;
+				let dataList = [];
+				let success = true;
+				const { date, isLastPage } = this.data;
+				let { date: curDate = "" } = date || {};
+
+				if (curDate) {
+					const reg = new RegExp("/", "gm");
+					curDate = curDate.replace(reg, "-");
+				}
+
+				const { departmentId, depCode } = this.getQuery();
+				const params = {
+					date: curDate,
+					pageSize: 10,
+					depId: departmentId,
+					depCode,
+					pageIndex: this.pageIndex,
+				};
+
+				if (!isLastPage) {
+					try {
+						const { list = [], pagination = {} } = await getDepDoctorList(
+							params
+						);
+						dataList = list;
+						total = pagination.total || 0;
+					} catch (e) {
+						success = false;
+					}
+				}
+
+				let state = {
+					loading: false,
+				};
+
+				if (success) {
+					const { nativeList } = this.data;
+					const _list = [...nativeList, ...dataList];
+					state = {
+						...state,
+						nativeList: _list,
+						isLastPage: _list.length >= total,
+						dataSource: this.formatData(dataList),
+					};
+				}
+
+				await this.updateData(state);
+			},
+
+			/* 刷新数据 */
+			async onRefresh(curDate = "") {
+				/* 初始化数据 */
+				this.pageIndex = 1;
+				await this.updateData({
+					date: curDate,
+					loading: true,
+					nativeList: [],
+					isLastPage: false,
+					dataSource: copy(defaultSource),
+				});
+				await this.onSplitPage();
+			},
+		},
+	})
+);

+ 4 - 2
antbuilder/industry/hospitalV2/components/patient-detail-edit/index.js

@@ -23,8 +23,10 @@ Component({
 	didMount() {
 		this.querySingle();
 		this.onEventChange();
-		const page = getCurrentPages();
-		console.log("page ===>", page);
+		// this.$page.updatePatient = this;
+		// const page = getCurrentPages();
+		// console.log("page", this.$page);
+		// console.log("page ===>", page);
 	},
 
 	didUnmount() {

+ 160 - 193
antbuilder/industry/hospitalV2/components/select-department/index.js

@@ -1,194 +1,161 @@
-import history from './../../utils/history';
-import { getContentHeight } from '../../utils';
-import { getDepartmentList } from './service';
-import { queryServiceByCode } from '../../service/common';
-import { reportCmPV_YL } from '../../utils/cloudMonitorHelper';
+import history from "./../../utils/history";
+import { getContentHeight } from "../../utils";
+import { getDepartmentList } from "./service";
+import { queryServiceByCode } from "../../service/common";
+import { reportCmPV_YL } from "../../utils/cloudMonitorHelper";
 Component({
-  props: {
-    componentData: {}
-  },
-  data: {
-    index: 0,
-    show: false,
-    menus: [],
-    cache: {},
-    lastCache: {},
-    loading: true,
-    serviceItem: null,
-    contentHeight: getContentHeight()
-  },
-
-  async didMount() {
-    /* 服务预警, 预约挂号 */
-    reportCmPV_YL({
-      title: '预约挂号'
-    });
-    const {
-      hospitalDistrictId
-    } = this.getQuery();
-
-    try {
-      await this.getServiceDetail(); // eslint-disable-next-line no-empty
-    } catch (e) {}
-
-    await this.fetchMenus(hospitalDistrictId);
-  },
-
-  methods: {
-    updateData(data) {
-      return new Promise(resolve => this.setData(data, resolve));
-    },
-
-    async getServiceDetail() {
-      const code = 'hospital_service_code';
-      const {
-        link,
-        uuid,
-        title,
-        linkType,
-        accessMode,
-        serviceDesc
-      } = await queryServiceByCode(code);
-      const serviceItem = {
-        url: link,
-        accessMode,
-        name: title,
-        serviceDesc,
-        urlType: linkType,
-        serviceUUID: uuid
-      };
-      await this.updateData({
-        serviceItem
-      });
-    },
-
-    getQuery() {
-      const {
-        $routeConfig
-      } = this.$page;
-      return $routeConfig.query;
-    },
-
-    async fetchProxy(func, ...arg) {
-      my.showLoading();
-      await func(...arg).finally(my.hideLoading);
-    },
-
-    /* 检测缓存 */
-    hasCache() {
-      const {
-        index,
-        cache
-      } = this.data;
-      return (cache[index] || []).length > 0;
-    },
-
-    /* 设置缓存 */
-    setCache(list) {
-      const {
-        index: i,
-        cache: _cache
-      } = this.data;
-      const cache = { ..._cache
-      };
-      cache[i] = list;
-      return this.updateData({
-        cache
-      });
-    },
-
-    /* 获取一级列表数据 */
-    async fetchMenus(hospitalDistrictId) {
-      const params = {
-        hospitalDistrictId
-      };
-      const list = await getDepartmentList(params);
-      await this.updateData({
-        menus: list,
-        loading: false
-      });
-      /* 获取一级列表下面的第一项的第一个 */
-
-      const departmentId = this.getDepartmentId(0);
-      await this.fetchDepartments(departmentId, list[0]);
-    },
-
-    /* 获取二级列表 */
-    async fetchDepartments(departmentId, item) {
-      if (this.hasCache()) return;
-      const list = !departmentId ? [item] : await getDepartmentList({
-        parentId: departmentId
-      });
-      this.setCache(list);
-    },
-
-    /* 获取科室id */
-    getDepartmentId(index) {
-      const {
-        menus = []
-      } = this.data;
-      const {
-        hasChildren,
-        departmentId
-      } = menus[index] || {};
-      if (hasChildren) return departmentId;
-    },
-
-    /* 切换科室 */
-    async onTapMenu(i) {
-      const item = this.data.menus[i];
-      await this.updateData({
-        index: i
-      });
-      const departmentId = this.getDepartmentId(i);
-      await this.fetchDepartments(departmentId, item);
-    },
-
-    /* 获取三级列表数据 */
-    async onTapOpenLast(item) {
-      const {
-        departmentId
-      } = item;
-      const {
-        lastCache
-      } = this.data;
-      const cacheList = lastCache[departmentId] || [];
-      if (cacheList.length > 0) return cacheList;
-      my.showLoading();
-      const list = await getDepartmentList({
-        parentId: departmentId
-      }).finally(my.hideLoading);
-      lastCache[departmentId] = list;
-      await this.updateData({
-        lastCache: { ...lastCache
-        }
-      });
-      return list;
-    },
-
-    onTapItem(item) {
-      const query = this.getQuery();
-      const {
-        name: areaName
-      } = query;
-      const {
-        componentData
-      } = this.props;
-      const {
-        departmentId,
-        name: dpName
-      } = item;
-      history.push({
-        query: {
-          departmentId
-        },
-        title: `${dpName}(${areaName})`,
-        pageType: 'hospital-num-source',
-        componentData: { ...componentData,
-          department: item
-        }
-      });
-    }
-
-  }
-});
+	props: {
+		componentData: {},
+	},
+	data: {
+		index: 0,
+		show: false,
+		menus: [],
+		cache: {},
+		lastCache: {},
+		loading: true,
+		serviceItem: null,
+		contentHeight: getContentHeight(),
+	},
+
+	async didMount() {
+		/* 服务预警, 预约挂号 */
+		reportCmPV_YL({
+			title: "预约挂号",
+		});
+		const { hospitalDistrictId } = this.getQuery();
+
+		try {
+			await this.getServiceDetail(); // eslint-disable-next-line no-empty
+		} catch (e) {}
+
+		await this.fetchMenus(hospitalDistrictId);
+	},
+
+	methods: {
+		updateData(data) {
+			return new Promise((resolve) => this.setData(data, resolve));
+		},
+
+		async getServiceDetail() {
+			const code = "hospital_service_code";
+			const { link, uuid, title, linkType, accessMode, serviceDesc } =
+				await queryServiceByCode(code);
+			const serviceItem = {
+				url: link,
+				accessMode,
+				name: title,
+				serviceDesc,
+				urlType: linkType,
+				serviceUUID: uuid,
+			};
+			await this.updateData({
+				serviceItem,
+			});
+		},
+
+		getQuery() {
+			const { $routeConfig } = this.$page;
+			return $routeConfig.query;
+		},
+
+		async fetchProxy(func, ...arg) {
+			my.showLoading();
+			await func(...arg).finally(my.hideLoading);
+		},
+
+		/* 检测缓存 */
+		hasCache() {
+			const { index, cache } = this.data;
+			return (cache[index] || []).length > 0;
+		},
+
+		/* 设置缓存 */
+		setCache(list) {
+			const { index: i, cache: _cache } = this.data;
+			const cache = { ..._cache };
+			cache[i] = list;
+			return this.updateData({
+				cache,
+			});
+		},
+
+		/* 获取一级列表数据 */
+		async fetchMenus(hospitalDistrictId) {
+			const params = {
+				hospitalDistrictId,
+			};
+			const list = await getDepartmentList(params);
+			await this.updateData({
+				menus: list,
+				loading: false,
+			});
+			/* 获取一级列表下面的第一项的第一个 */
+
+			const departmentId = this.getDepartmentId(0);
+			await this.fetchDepartments(departmentId, list[0]);
+		},
+
+		/* 获取二级列表 */
+		async fetchDepartments(departmentId, item) {
+			if (this.hasCache()) return;
+			const list = !departmentId
+				? [item]
+				: await getDepartmentList({
+						parentId: departmentId,
+				  });
+			this.setCache(list);
+		},
+
+		/* 获取科室id */
+		getDepartmentId(index) {
+			const { menus = [] } = this.data;
+			const { hasChildren, departmentId } = menus[index] || {};
+			if (hasChildren) return departmentId;
+		},
+
+		/* 切换科室 */
+		async onTapMenu(i) {
+			const item = this.data.menus[i];
+			await this.updateData({
+				index: i,
+			});
+			const departmentId = this.getDepartmentId(i);
+			await this.fetchDepartments(departmentId, item);
+		},
+
+		/* 获取三级列表数据 */
+		async onTapOpenLast(item) {
+			const { departmentId } = item;
+			const { lastCache } = this.data;
+			const cacheList = lastCache[departmentId] || [];
+			if (cacheList.length > 0) return cacheList;
+			my.showLoading();
+			const list = await getDepartmentList({
+				parentId: departmentId,
+			}).finally(my.hideLoading);
+			lastCache[departmentId] = list;
+			await this.updateData({
+				lastCache: { ...lastCache },
+			});
+			return list;
+		},
+
+		onTapItem(item) {
+			console.log("onTapItem", item);
+			const query = this.getQuery();
+			const { name: areaName } = query;
+			const { componentData } = this.props;
+			const { departmentId, name: dpName, departmentCode: depCode } = item;
+			history.push({
+				query: {
+					departmentId,
+					depCode,
+				},
+				title: `${dpName}(${areaName})`,
+				pageType: "hospital-num-source",
+				componentData: { ...componentData, department: item },
+			});
+		},
+	},
+});