2023-08-28 14:26:56 +08:00

81 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { API } from './../../../utils/network/api'
let api = new API()
const app = getApp()
Page({
data: {
navbarData: {
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
title: '病历信息', //导航栏 中间的标题
},
height: app.globalData.height,
order_inquiry_id: "",
case_detail: {},
imglist: []
},
onLoad(options){
console.log("onLoad", options)
this.setData({
order_inquiry_id: options.order_inquiry_id
})
},
goReport(event){
const url=event.currentTarget.dataset.url;
const randfile = new Date().getTime() + '检测报告';
const newPath = `${wx.env.USER_DATA_PATH}/${randfile}`;
wx.downloadFile({
// 示例 url并非真实存在
url:url,
filePath: newPath,
success: function (res) {
//const filePath = res.tempFilePath
wx.openDocument({
fileType:"pdf",
showMenu:true,
filePath: newPath,
success: function (res) {
console.log('打开文档成功')
},
fail:function(error){
wx.showToast({
title:res,
icon:"none"
})
}
})
},
fail:function(error){
wx.showToast({
title:error,
icon:"none"
})
}
})
},
formatImgList(){
let diagnose_images = this.data.case_detail.diagnose_images?this.data.case_detail.diagnose_images:[];
let img_list = [];
diagnose_images.forEach(item => {
let img = {};
img.isImage = true;
img.url = item;
img_list.push(img);
})
this.setData({
imglist: img_list
})
},
onShow(){
//获取患者问诊病例
api.getDoctorInquiryCase({order_inquiry_id: this.data.order_inquiry_id}).then(response => {
console.log(response);
this.setData({
case_detail: response.data
})
}).then(res => {
this.formatImgList();
}).catch(errors => {console.error(errors);})
},
})