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.
 
 
 

87 lines
2.0 KiB

const {getapi, postapi, putapi, deletapi} = require('../api/api');
// 这种方式一般不推荐使用,因为同步(阻塞)方式 响应页面响应
//获取登记人员 所登记的组合项目
const getPrAsb = async (id) =>{
let result = {
code: -1,
message:'',
data:[]
}
if(!id) return result
try {
let res = await getapi(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${id}`)
if(res.code != -1){
// console.log(`getPrAsb:PatientRegisterId=${id}:data:`,res.data)
result.code = 1
result.message = "success"
res.data.forEach(e => {
e.standTotal = e.amount * e.standardPrice
e.total = e.amount * e.chargePrice
result.data.push(e)
});
}
} catch (error) {
result.message = error
}
return result
};
async function savePeoplePhoto(peopleId, photoBase64) {
let lres = { code: -1, msg: '' }
if (!peopleId) return { code: -1, msg: '人员ID不能为空' }
if (!photoBase64 || photoBase64.indexOf('data:image') < 0) return { code: -1, msg: '图像数据不是合法的base64编码数据' }
let uploadPhoto = {
patientRegisterId: peopleId,
photo: photoBase64.split(",")[1],
};
try {
lres = await postapi(`/api/app/patient-register/up-load-img`, uploadPhoto)
let body = {
patientRegisterId: peopleId,
photo: lres.data,
}
await postapi(`/api/app/patient-register/update-photo`, body)
} catch (error) {
lres = { code: -1, msg: error }
}
return lres
};
// 照片是相对路径时,加刷新标识
function photoParse(photo) {
let sysConfig = JSON.parse(window.sessionStorage.getItem('sysConfig'))
//console.log(sysConfig,photo)
let lphoto = '' //data:image、UpLoad/、/pic/Photo.jpg
if (!photo) return '/pic/Photo.jpg'
if (photo.toLowerCase().indexOf("http") > - 1) {
lphoto = photo
} else {
lphoto = sysConfig.apiurl + '/' + photo + '?' + new Date().getTime()
}
//console.log(lphoto)
return lphoto
};
module.exports = {
getPrAsb,savePeoplePhoto,photoParse
}