|
|
@@ -1,61 +1,81 @@
|
|
|
import PageContainerBehavior from "../../core/behavior/page-container.behavior";
|
|
|
-import { DraggableSheetBehavior, getDraggableSheetContext } from "../../core/behavior/draggableSheet.behavior";
|
|
|
+import {
|
|
|
+ DraggableSheetBehavior,
|
|
|
+ getDraggableSheetContext,
|
|
|
+} from "../../core/behavior/draggableSheet.behavior";
|
|
|
import { login } from "../../lib/logic";
|
|
|
import { useRouteQuery } from "../../utils/route-query";
|
|
|
import { appUpdate } from "../../lib/wx/update";
|
|
|
|
|
|
-const { shared, Easing, timing } = wx.worklet
|
|
|
+const { shared, Easing, timing } = wx.worklet;
|
|
|
const offset = shared(0);
|
|
|
|
|
|
-const menus = ['shareAppMessage', 'shareTimeline'];
|
|
|
+const menus = ["shareAppMessage", "shareTimeline"];
|
|
|
|
|
|
// pages/home/home.ts
|
|
|
-import { getPatients, healthReportMethod, healthIndexMethod, getSolarTerms, getShortScienceList, getPatientDescription } from "./request";
|
|
|
-import { toCertificationPage } from "./router";
|
|
|
+import {
|
|
|
+ getPatients,
|
|
|
+ healthReportMethod,
|
|
|
+ healthIndexMethod,
|
|
|
+ getSolarTerms,
|
|
|
+ getShortScienceList,
|
|
|
+ getPatientDescription,
|
|
|
+ getNotDealLists,
|
|
|
+} from "./request";
|
|
|
+import { toCertificationPage, toChats } from "./router";
|
|
|
import { useLocation } from "../../lib/use/use-location";
|
|
|
|
|
|
Page({
|
|
|
behaviors: [
|
|
|
PageContainerBehavior,
|
|
|
- DraggableSheetBehavior('.draggable-sheet-wrapper'),
|
|
|
+ DraggableSheetBehavior(".draggable-sheet-wrapper"),
|
|
|
],
|
|
|
+
|
|
|
onLoad(options) {
|
|
|
appUpdate();
|
|
|
-
|
|
|
const query = useRouteQuery(options.scene!);
|
|
|
- if (query.ys) wx.setStorageSync('doctorId', query.ys);
|
|
|
+ if (query.ys) wx.setStorageSync("doctorId", query.ys);
|
|
|
|
|
|
this.initFabAnimated();
|
|
|
},
|
|
|
onShow() {
|
|
|
wx.showShareMenu({ withShareTicket: true, menus }).then();
|
|
|
this.load();
|
|
|
+ // 获取未处理随访列表
|
|
|
+ this.getNotDealList();
|
|
|
},
|
|
|
onHide() {
|
|
|
wx.hideShareMenu({ menus }).then();
|
|
|
- offset.value = timing(0, { duration: 100, easing: (<any>Easing).linear }, () => { 'worklet' });
|
|
|
+ offset.value = timing(
|
|
|
+ 0,
|
|
|
+ { duration: 100, easing: (<any>Easing).linear },
|
|
|
+ () => {
|
|
|
+ "worklet";
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
onShareAppMessage(opts): WechatMiniprogram.Page.ICustomShareContent {
|
|
|
- console.log(opts.target)
|
|
|
+ console.log(opts.target);
|
|
|
return {
|
|
|
title: `健康为基,从容赏生活之美`,
|
|
|
imageUrl: `https://wx.hzliuzhi.com/media/healthManager/wx/share.jpg`,
|
|
|
path: `/pages/home/home`,
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
onShareTimeline() {
|
|
|
return {
|
|
|
title: `健康为基,从容赏生活之美`,
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
data: {
|
|
|
- patients: [] as (App.Patient.Model & { isDefault: 'Y' | 'N' })[],
|
|
|
+ popupList: [] as AnyArray,
|
|
|
+ isShowPopup: false,
|
|
|
+ patients: [] as (App.Patient.Model & { isDefault: "Y" | "N" })[],
|
|
|
patient: null as App.Patient.Model | null,
|
|
|
- patientDescription: '',
|
|
|
-
|
|
|
- healthId: '',
|
|
|
- healthReport: { data: null, message: '' },
|
|
|
- healthIndex: { data: [], message: '' },
|
|
|
+ patientDescription: "",
|
|
|
+ healthId: "",
|
|
|
+ healthReport: { data: null, message: "" },
|
|
|
+ healthIndex: { data: [], message: "" },
|
|
|
|
|
|
position: {} as AnyObject,
|
|
|
|
|
|
@@ -68,194 +88,287 @@ Page({
|
|
|
|
|
|
_loaded: false,
|
|
|
},
|
|
|
+ onClose() {
|
|
|
+ this.setData({
|
|
|
+ isShowPopup: false,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getNotDealList() {
|
|
|
+ getNotDealLists().then((res) => {
|
|
|
+ if (res.length > 0) {
|
|
|
+ this.setData({
|
|
|
+ popupList: res,
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ isShowPopup: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onVisibleChange(e: { detail: { visible: any } }) {
|
|
|
+ this.setData({
|
|
|
+ isShowPopup: e.detail.visible,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 诊疗随访提醒
|
|
|
+ goComplete(e: { currentTarget: { dataset: { page: string; id: number } } }) {
|
|
|
+ wx.setStorageSync("isAnalysis", 2);
|
|
|
+ let page = e.currentTarget.dataset.page;
|
|
|
+ let id = e.currentTarget.dataset.id;
|
|
|
+ console.log("page", page);
|
|
|
+ if (page === "/module/chats/pages/index/index") {
|
|
|
+ wx.setStorageSync("workId", id);
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `${page}?component=questionnaire&messageType=1&id=${id}`,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ console.log("home中的id", id);
|
|
|
+ // wx.navigateTo({ url: `${page}?id=${id}` });
|
|
|
+ wx.navigateTo({ url: `/module/follow/pages/evaluation/report?id=${id}` });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 随访评估报告已出
|
|
|
+ goSeeFollowReport() {
|
|
|
+ wx.navigateTo({ url: "/module/follow/pages/evaluation/report" });
|
|
|
+ },
|
|
|
async load(forceLogin = false) {
|
|
|
try {
|
|
|
await login(forceLogin);
|
|
|
- wx.showLoading({ title: '加载中' });
|
|
|
+ wx.showLoading({ title: "加载中" });
|
|
|
const { patient } = await getPatients(/*this.data.patientId*/);
|
|
|
if (!patient) await toCertificationPage();
|
|
|
else {
|
|
|
this.setData({ patient });
|
|
|
this.observerPatient(patient);
|
|
|
- };
|
|
|
+ }
|
|
|
wx.hideLoading();
|
|
|
} catch (error) {
|
|
|
- await wx.showModal({
|
|
|
- title: `加载失败`,
|
|
|
- content: `${error?.errMsg ?? error?.message ?? ''}`,
|
|
|
- showCancel: false,
|
|
|
- confirmText: `重新加载`
|
|
|
- }).catch(() => { });
|
|
|
+ await wx
|
|
|
+ .showModal({
|
|
|
+ title: `加载失败`,
|
|
|
+ content: `${error?.errMsg ?? error?.message ?? ""}`,
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: `重新加载`,
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
this.load(true);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!this.data._loaded) {
|
|
|
this.loadScienceList();
|
|
|
- useLocation().then((location) => { this.setData({ location }) }).catch(() => { });
|
|
|
- getSolarTerms().then((solarTerms) => { this.setData({ solarTerms }) }).catch(() => { });
|
|
|
+ useLocation()
|
|
|
+ .then((location) => {
|
|
|
+ this.setData({ location });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ getSolarTerms()
|
|
|
+ .then((solarTerms) => {
|
|
|
+ this.setData({ solarTerms });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
this.setData({ _loaded: true });
|
|
|
}
|
|
|
},
|
|
|
|
|
|
async _getHealthReport() {
|
|
|
- wx.showLoading({ title: '加载中' });
|
|
|
- this.setData({ 'healthReport.loading': true, })
|
|
|
+ wx.showLoading({ title: "加载中" });
|
|
|
+ this.setData({ "healthReport.loading": true });
|
|
|
try {
|
|
|
const data = await healthReportMethod();
|
|
|
this.setData({
|
|
|
- 'healthReport.data': data,
|
|
|
- 'healthReport.loading': false,
|
|
|
+ "healthReport.data": data,
|
|
|
+ "healthReport.loading": false,
|
|
|
healthId: data?.healthAnalysisReportId,
|
|
|
});
|
|
|
} catch (error) {
|
|
|
this.setData({
|
|
|
- 'healthReport.data': [],
|
|
|
- 'healthReport.loading': false,
|
|
|
- 'healthReport.message': error.errMsg,
|
|
|
- healthId: '',
|
|
|
+ "healthReport.data": [],
|
|
|
+ "healthReport.loading": false,
|
|
|
+ "healthReport.message": error.errMsg,
|
|
|
+ healthId: "",
|
|
|
});
|
|
|
}
|
|
|
wx.hideLoading();
|
|
|
},
|
|
|
async _getAbnormalHealthIndex() {
|
|
|
- this.setData({ 'healthIndex.loading': true, })
|
|
|
+ this.setData({ "healthIndex.loading": true });
|
|
|
try {
|
|
|
const data = await healthIndexMethod();
|
|
|
this.setData({
|
|
|
- 'healthIndex.data': data.map((item: AnyObject) => item.abnormalDesc).filter(Boolean),
|
|
|
- 'healthIndex.loading': false,
|
|
|
+ "healthIndex.data": data
|
|
|
+ .map((item: AnyObject) => item.abnormalDesc)
|
|
|
+ .filter(Boolean),
|
|
|
+ "healthIndex.loading": false,
|
|
|
});
|
|
|
} catch (error) {
|
|
|
this.setData({
|
|
|
- 'healthIndex.data': [],
|
|
|
- 'healthIndex.loading': false,
|
|
|
- 'healthIndex.message': error.errMsg,
|
|
|
+ "healthIndex.data": [],
|
|
|
+ "healthIndex.loading": false,
|
|
|
+ "healthIndex.message": error.errMsg,
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
onBodyModel(event: WechatMiniprogram.TouchEvent) {
|
|
|
- if (event.detail?.position === 'LB') { this.toReportPage(); }
|
|
|
- else if (event.detail?.position === 'LT') {
|
|
|
+ if (event.detail?.position === "LB") {
|
|
|
+ this.toReportPage();
|
|
|
+ } else if (event.detail?.position === "LT") {
|
|
|
const report = this.data.healthReport.data as unknown as AnyObject;
|
|
|
this.setData({
|
|
|
position: {
|
|
|
- LT: ['willillState', 'willillDegree', 'willillSocial', 'willillFunction'].map(key => {
|
|
|
- const title = report[`${key}Name`]
|
|
|
- const description = report[`${key}Description`]
|
|
|
- return title || description ? { title, description } : null
|
|
|
- }).filter(Boolean)
|
|
|
+ LT: [
|
|
|
+ "willillState",
|
|
|
+ "willillDegree",
|
|
|
+ "willillSocial",
|
|
|
+ "willillFunction",
|
|
|
+ ]
|
|
|
+ .map((key) => {
|
|
|
+ const title = report[`${key}Name`];
|
|
|
+ const description = report[`${key}Description`];
|
|
|
+ return title || description ? { title, description } : null;
|
|
|
+ })
|
|
|
+ .filter(Boolean),
|
|
|
},
|
|
|
});
|
|
|
this.showDraggableSheet();
|
|
|
- }
|
|
|
- else if (event.detail?.position === 'RT') {
|
|
|
+ } else if (event.detail?.position === "RT") {
|
|
|
const report = this.data.healthReport.data as unknown as AnyObject;
|
|
|
- const get = (key: string) => ({ [key]: report[key] })
|
|
|
+ const get = (key: string) => ({ [key]: report[key] });
|
|
|
this.setData({
|
|
|
position: {
|
|
|
RT: {
|
|
|
- ...get('constitutionGroupName'),
|
|
|
- ...get('constitutionGroupDefinition'),
|
|
|
- ...get('faceImg'),
|
|
|
- ...get('faceAnalysisResult'),
|
|
|
- ...get('tongueAnalysisResult'),
|
|
|
- ...get('upImg'),
|
|
|
- ...get('downImg'),
|
|
|
- }
|
|
|
+ ...get("constitutionGroupName"),
|
|
|
+ ...get("constitutionGroupDefinition"),
|
|
|
+ ...get("faceImg"),
|
|
|
+ ...get("faceAnalysisResult"),
|
|
|
+ ...get("tongueAnalysisResult"),
|
|
|
+ ...get("upImg"),
|
|
|
+ ...get("downImg"),
|
|
|
+ },
|
|
|
},
|
|
|
});
|
|
|
this.showDraggableSheet();
|
|
|
- }
|
|
|
- else if (event.detail?.position === 'RB') {
|
|
|
+ } else if (event.detail?.position === "RB") {
|
|
|
const report = this.data.healthReport.data as unknown as AnyObject;
|
|
|
- const get = (key: string) => ({ [key]: report[key] })
|
|
|
+ const get = (key: string) => ({ [key]: report[key] });
|
|
|
this.setData({
|
|
|
position: {
|
|
|
RB: {
|
|
|
- ...get('diagnoseSyndromeSummary'),
|
|
|
- ...get('diagnoseSyndromes'),
|
|
|
- ...get('factorItemSummary'),
|
|
|
- ...get('factorItems'),
|
|
|
- }
|
|
|
+ ...get("diagnoseSyndromeSummary"),
|
|
|
+ ...get("diagnoseSyndromes"),
|
|
|
+ ...get("factorItemSummary"),
|
|
|
+ ...get("factorItems"),
|
|
|
+ },
|
|
|
},
|
|
|
});
|
|
|
this.showDraggableSheet();
|
|
|
- }
|
|
|
- else if (event.detail?.position === 'CT') {
|
|
|
+ } else if (event.detail?.position === "CT") {
|
|
|
this.setData({
|
|
|
- position: { CT: this.data.healthIndex.data.map((item, index) => `${index + 1}、${item}`) }
|
|
|
+ position: {
|
|
|
+ CT: this.data.healthIndex.data.map(
|
|
|
+ (item, index) => `${index + 1}、${item}`
|
|
|
+ ),
|
|
|
+ },
|
|
|
});
|
|
|
this.showDraggableSheet();
|
|
|
}
|
|
|
},
|
|
|
|
|
|
initFabAnimated() {
|
|
|
- (<any>this).applyAnimatedStyle('.fab-wrapper', () => {
|
|
|
- 'worklet'
|
|
|
+ (<any>this).applyAnimatedStyle(".fab-wrapper", () => {
|
|
|
+ "worklet";
|
|
|
return { right: `${Math.min(offset.value, 36) - 36}px` };
|
|
|
});
|
|
|
- (<any>this).applyAnimatedStyle('.fab-1', () => {
|
|
|
- 'worklet'
|
|
|
+ (<any>this).applyAnimatedStyle(".fab-1", () => {
|
|
|
+ "worklet";
|
|
|
return { transform: `translateY(${-offset.value}px)` };
|
|
|
});
|
|
|
- (<any>this).applyAnimatedStyle('.fab-2', () => {
|
|
|
- 'worklet'
|
|
|
- return { transform: `translateX(${-offset.value}px) translateY(${-offset.value / 2}px)` };
|
|
|
+ (<any>this).applyAnimatedStyle(".fab-2", () => {
|
|
|
+ "worklet";
|
|
|
+ return {
|
|
|
+ transform: `translateX(${-offset.value}px) translateY(${
|
|
|
+ -offset.value / 2
|
|
|
+ }px)`,
|
|
|
+ };
|
|
|
});
|
|
|
- (<any>this).applyAnimatedStyle('.fab-3', () => {
|
|
|
- 'worklet'
|
|
|
- return { transform: `translateX(${-offset.value}px) translateY(${offset.value / 2}px)` };
|
|
|
+ (<any>this).applyAnimatedStyle(".fab-3", () => {
|
|
|
+ "worklet";
|
|
|
+ return {
|
|
|
+ transform: `translateX(${-offset.value}px) translateY(${
|
|
|
+ offset.value / 2
|
|
|
+ }px)`,
|
|
|
+ };
|
|
|
});
|
|
|
- (<any>this).applyAnimatedStyle('.fab-4', () => {
|
|
|
- 'worklet'
|
|
|
+ (<any>this).applyAnimatedStyle(".fab-4", () => {
|
|
|
+ "worklet";
|
|
|
return { transform: `translateY(${offset.value}px)` };
|
|
|
});
|
|
|
},
|
|
|
onFabTap() {
|
|
|
const value = Math.abs(offset.value - 72);
|
|
|
- offset.value = timing(value, { duration: 500, easing: (<any>Easing).linear }, () => {
|
|
|
- 'worklet'
|
|
|
- if (offset.value > 0) offset.value = 72
|
|
|
- })
|
|
|
+ offset.value = timing(
|
|
|
+ value,
|
|
|
+ { duration: 500, easing: (<any>Easing).linear },
|
|
|
+ () => {
|
|
|
+ "worklet";
|
|
|
+ if (offset.value > 0) offset.value = 72;
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
async toChatsPage() {
|
|
|
if (!this.data.patient?.patientId) {
|
|
|
try {
|
|
|
await this.load();
|
|
|
} catch (error) {
|
|
|
- wx.showModal({ title: '出错了', content: error?.errMsg ?? error?.message ?? '错误,请重试', showCancel: false })
|
|
|
+ wx.showModal({
|
|
|
+ title: "出错了",
|
|
|
+ content: error?.errMsg ?? error?.message ?? "错误,请重试",
|
|
|
+ showCancel: false,
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- wx.navigateTo({ url: `/module/chats/pages/index/index` })
|
|
|
+ wx.setStorageSync("isAnalysis", 1);
|
|
|
+ const page = "/module/chats/pages/index/index";
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `${page}?component=guide&isShowGuide=true`,
|
|
|
+ });
|
|
|
+ wx.setStorageSync("isAnalysis", 3);
|
|
|
+ // wx.navigateTo({ url: `/module/chats/pages/index/index` })
|
|
|
+ // toChats("guide");
|
|
|
},
|
|
|
toHealthPage() {
|
|
|
- wx.navigateTo({ url: `/module/health/pages/home/home` })
|
|
|
+ wx.navigateTo({ url: `/module/health/pages/home/home` });
|
|
|
},
|
|
|
toDietTonicPage() {
|
|
|
- wx.navigateTo({ url: `/module/article/pages/diet-list/diet-list?classify=tonic` })
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/module/article/pages/diet-list/diet-list?classify=tonic`,
|
|
|
+ });
|
|
|
},
|
|
|
toDietTeaPage() {
|
|
|
- wx.navigateTo({ url: `/module/article/pages/diet-list/diet-list?classify=tea` })
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/module/article/pages/diet-list/diet-list?classify=tea`,
|
|
|
+ });
|
|
|
},
|
|
|
toSciencePage() {
|
|
|
- wx.navigateTo({ url: `/module/article/pages/science-list/science-list` })
|
|
|
+ wx.navigateTo({ url: `/module/article/pages/science-list/science-list` });
|
|
|
},
|
|
|
toSchemePage() {
|
|
|
const id = this.data.healthId;
|
|
|
- if (id) wx.navigateTo({ url: `/module/health/pages/scheme/scheme?id=${id}` })
|
|
|
- else wx.showToast({ title: '暂无调理方案', icon: 'none' });
|
|
|
+ if (id)
|
|
|
+ wx.navigateTo({ url: `/module/health/pages/scheme/scheme?id=${id}` });
|
|
|
+ else wx.showToast({ title: "暂无调理方案", icon: "none" });
|
|
|
},
|
|
|
toReportPage() {
|
|
|
const id = this.data.healthId;
|
|
|
- if (id) wx.navigateTo({ url: `/module/health/pages/report/report?id=${id}` })
|
|
|
- else wx.showToast({ title: '暂无分析报告', icon: 'none' });
|
|
|
+ if (id)
|
|
|
+ wx.navigateTo({ url: `/module/health/pages/report/report?id=${id}` });
|
|
|
+ else wx.showToast({ title: "暂无分析报告", icon: "none" });
|
|
|
},
|
|
|
onDraggableSizeUpdate(e) {
|
|
|
- 'worklet'
|
|
|
+ "worklet";
|
|
|
if (e.pixels < 1) {
|
|
|
- wx.worklet.runOnJS(this.hideDraggableSheet.bind(this))()
|
|
|
+ wx.worklet.runOnJS(this.hideDraggableSheet.bind(this))();
|
|
|
}
|
|
|
},
|
|
|
showDraggableSheet() {
|
|
|
@@ -264,7 +377,7 @@ Page({
|
|
|
pixels: 600,
|
|
|
animated: true,
|
|
|
duration: 300,
|
|
|
- easingFunction: 'ease'
|
|
|
+ easingFunction: "ease",
|
|
|
});
|
|
|
this.setData({ sheet: true });
|
|
|
},
|
|
|
@@ -274,29 +387,30 @@ Page({
|
|
|
size: 0,
|
|
|
animated: true,
|
|
|
duration: 300,
|
|
|
- easingFunction: 'ease'
|
|
|
+ easingFunction: "ease",
|
|
|
});
|
|
|
}
|
|
|
- this.setData({ position: {}, sheet: false })
|
|
|
+ this.setData({ position: {}, sheet: false });
|
|
|
},
|
|
|
|
|
|
async loadScienceList() {
|
|
|
try {
|
|
|
const { data } = await getShortScienceList();
|
|
|
- this.setData({ scienceList: data })
|
|
|
- } catch (error) {
|
|
|
-
|
|
|
- }
|
|
|
+ this.setData({ scienceList: data });
|
|
|
+ } catch (error) {}
|
|
|
},
|
|
|
|
|
|
- observerPatient(model: { patientId: string, sex: '0' | '1' }) {
|
|
|
- wx.setStorageSync('patientId', model.patientId);
|
|
|
+ observerPatient(model: { patientId: string; sex: "0" | "1" }) {
|
|
|
+ wx.setStorageSync("patientId", model.patientId);
|
|
|
this._getHealthReport();
|
|
|
this._getAbnormalHealthIndex();
|
|
|
- const patientIcon = { 0: 'gender-male', 1: 'gender-female' }[model.sex];
|
|
|
- const patientIconColor = { 0: '#0f40f5', 1: '#E560B3' }[model.sex];
|
|
|
- this.setData({ patientIcon, patientIconColor })
|
|
|
+ const patientIcon = { 0: "gender-male", 1: "gender-female" }[model.sex];
|
|
|
+ const patientIconColor = { 0: "#0f40f5", 1: "#E560B3" }[model.sex];
|
|
|
|
|
|
- getPatientDescription(model).then((patientDescription) => { this.setData({ patientDescription }) })
|
|
|
+ this.setData({ patientIcon, patientIconColor });
|
|
|
+
|
|
|
+ getPatientDescription(model).then((patientDescription) => {
|
|
|
+ this.setData({ patientDescription });
|
|
|
+ });
|
|
|
},
|
|
|
-})
|
|
|
+});
|