You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
6.1 KiB

3 months ago
import dayjs from 'dayjs'
const app = getApp<IAppOption>()
Page({
data: {
toastShow: false,
toastType: 'patientDetailSafeDoctor',
toastParams: {} as any,
showTel: false,
doctor: {},
hospital: {},
id: '',
remark: '',
detail: {} as any,
popupRemarkShow: false,
remarkFocus: false,
popupEditShow: false,
antibodyTypeRangeList: [
{
id: '1',
value: 'AchR',
},
{
id: '2',
value: 'MuSK',
},
{
id: '3',
value: 'LRP4',
},
{
id: '4',
value: 'RyR',
},
],
thyroidAbnormalRangeList: [
{
id: '1',
value: '是',
},
{
id: '2',
value: '否',
},
],
previousConvulsionRangeList: [
{
id: '1',
value: '是',
},
{
id: '2',
value: '否',
},
],
traditionalImmunosuppressantRangeList: [
{
id: '1',
value: '他克莫司',
},
{
id: '2',
value: '硫唑嘌呤',
},
{
id: '3',
value: '吗替麦考酚酯',
},
{
id: '4',
value: '其它',
},
],
medicalInsuranceTypeRangeList: [
{
id: '1',
value: '城市职工',
},
{
id: '2',
value: '城市居民',
},
{
id: '3',
value: '新农合',
},
],
2 months ago
ageRangeMap: {
1: '<40岁',
2: '40-49岁',
3: '50-59岁',
4: '60-69岁',
5: '70-79岁',
6: '80岁以上',
},
diagnosisTimeRangeMap: {
1: '6个月以内',
2: '6个月-3年',
3: '3年以上',
},
3 months ago
},
onLoad(option) {
3 months ago
this.setData({
id: option.id,
})
app.waitLogin().then(async (_res) => {
this.getDoctorDetail()
await this.getDetail()
})
},
getDoctorDetail() {
wx.ajax({
method: 'GET',
2 months ago
url: '?r=igg4/doctor/account/info',
3 months ago
data: {},
}).then((res) => {
this.setData({
doctor: res.doctor,
hospital: res.hospital,
toastShow: true,
toastType: 'patientDetailSafeDoctor',
toastParams: {
Name: res.doctor.Name,
HospitalName: res.hospital.Name,
},
})
})
},
getDetail() {
return wx
.ajax({
method: 'GET',
2 months ago
url: '?r=igg4/doctor/patient/info',
3 months ago
data: { patientId: this.data.id },
})
.then((res) => {
if (res.LastAdlTime) {
res.LastAdlTimeName = dayjs(res.LastAdlTime).from(dayjs().format('YYYY-MM-DD')).replace(' ', '')
}
if (res.LastUseDrugsTime) {
res.LastUseDrugsTimeName =
dayjs().format('YYYY-MM-DD') === res.LastUseDrugsTime
? ''
: dayjs(res.LastUseDrugsTime).from(dayjs().format('YYYY-MM-DD')).replace(' ', '')
}
2 months ago
res.AgeRangeName = this.data.ageRangeMap[res.AgeRange] || ''
res.DiagnosisTimeRangeName = this.data.diagnosisTimeRangeMap[res.DiagnosisTimeRange] || ''
if (res.HealthQA && res.HealthQA.hasSubmitted && res.HealthQA.questions) {
res.HealthQA.questions.forEach((q: any) => {
q.isAnswerArray = Array.isArray(q.AnswerText)
if (q.isAnswerArray) {
q.AnswerTextArr = q.AnswerText.filter((a: any) => a !== null && a !== undefined)
q.AnswerTextStr = q.AnswerTextArr.join('、') + (q.OtherText ? `${q.OtherText}` : '')
2 months ago
} else {
q.AnswerTextStr = q.AnswerText || ''
if (q.AnswerTextStr && q.OtherText) {
q.AnswerTextStr += `${q.OtherText}`
}
2 months ago
}
})
}
3 months ago
this.setData({
detail: {
...res,
hideName: res.Name.length <= 2 ? res.Name.charAt(0) + '*' : res.Name.charAt(0) + '*' + res.Name.charAt(res.Name.length - 1),
hideTelephone: res.Telephone ? res.Telephone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '',
3 months ago
},
})
})
},
handleRemark() {
3 months ago
this.setData({
popupRemarkShow: true,
remark: this.data.detail.DoctorRemark,
})
setTimeout(() => {
this.setData({
remarkFocus: true,
})
}, 300)
},
handleRemarkClose() {
this.setData({
popupRemarkShow: false,
remarkFocus: false,
remark: '',
})
},
handleRemarkSubmit() {
if (!this.data.remark) {
wx.showToast({
icon: 'none',
title: '请输入备注',
})
2 months ago
return
3 months ago
}
wx.ajax({
method: 'POST',
2 months ago
url: '?r=igg4/doctor/patient/remark',
3 months ago
data: {
PatientId: this.data.id,
DoctorRemark: this.data.remark,
},
}).then((_res) => {
this.handleRemarkClose()
this.getDetail()
})
},
handleEditUser() {
this.setData({
popupEditShow: true,
})
},
handleUserCancel() {
this.setData({
popupEditShow: false,
})
},
handleUserSubmit() {
this.handleUserCancel()
this.handlePatientUpdate()
},
handleRadio(e) {
const { id, key } = e.currentTarget.dataset
this.setData({
[`detail.${key}`]: id,
})
},
handlePatientUpdate() {
const { detail } = this.data
wx.ajax({
method: 'POST',
2 months ago
url: '?r=igg4/doctor/patient/update',
3 months ago
data: {
PatientId: detail.PatientId,
AntibodyType: detail.AntibodyType,
ThyroidAbnormal: detail.ThyroidAbnormal,
PreviousConvulsion: detail.PreviousConvulsion,
TraditionalImmunosuppressant: detail.TraditionalImmunosuppressant,
MedicalInsuranceType: detail.MedicalInsuranceType,
3 months ago
},
}).then(() => {
wx.showToast({
icon: 'none',
title: '更新成功',
})
this.getDetail()
})
},
handleSend() {
wx.navigateTo({
url: `/doctor/pages/d_interactiveDoctor/index?patientId=${this.data.detail.PatientId}`,
})
},
handleToggleTel() {
3 months ago
this.setData({
showTel: !this.data.showTel,
3 months ago
})
},
handleToastOk() {
this.setData({
toastShow: false,
})
},
handleToastCancel() {
wx.navigateBack()
},
})