import PageContainerBehavior from "../../../../core/behavior/page-container.behavior"; import I18nBehavior from "../../../../i18n/behavior"; // module/health/pages/home/home.ts import { toPatientPage } from "../../router"; import { healthIndexMethod, healthPatientMethod } from "../../request"; import { healthIndex2Progress } from "../../tools/health-index"; Component({ behaviors: [ I18nBehavior, PageContainerBehavior, ], lifetimes: { attached() { this.getHealthPatient(); this.getHealthIndex(); } }, properties: {}, data: { i18n: { health: { title: '档案', __showScheme__: false, __showFollowRecord__: false, __showFollowEvaluation__: false, __showRecord__: false, __showNodrugTherapy__: false, __showChatRecord__: false, } }, // healthId: '', healthPatient: { data: null, loading: false, message: '' }, healthIndex: { data: [], loading: false, message: '' }, }, methods: { async getHealthPatient() { this.setData({ 'healthPatient.loading': true, }) try { const data = await healthPatientMethod(); this.setData({ 'healthPatient.data': data, 'healthPatient.loading': false, }); } catch (error) { this.setData({ 'healthPatient.data': [], 'healthPatient.loading': false, 'healthPatient.message': error.errMsg, }); } }, async getHealthIndex(id?: string) { this.setData({ 'healthIndex.loading': true, }) try { const data = await healthIndexMethod(id); this.setData({ 'healthIndex.data': healthIndex2Progress(data), 'healthIndex.loading': false, }); } catch (error) { this.setData({ 'healthIndex.data': [], 'healthIndex.loading': false, 'healthIndex.message': error.errMsg, }); } }, toPatientPage: toPatientPage, toHealthIndexListPage() { wx.navigateTo({ url: `/module/charts/record-index/record-index` }) }, } })