优化
This commit is contained in:
+131
-1
@@ -362,6 +362,38 @@ class API extends HTTP {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取处方详情
|
||||
getDoctorPrescriptionInfo(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/prescription/info`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//修改处方
|
||||
putDoctorPrescription(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/prescription`,
|
||||
method: 'PUT',
|
||||
contentType: 'application/json',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//新增处方
|
||||
postDoctorPrescription(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/prescription`,
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取操作手册列表
|
||||
getBasicOperationManual(params) {
|
||||
@@ -458,7 +490,17 @@ class API extends HTTP {
|
||||
//获取患者问诊病例
|
||||
getDoctorInquiryCase(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/case`,
|
||||
url: `${this.baseUrl}/case`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取患者问诊病例
|
||||
getCase(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/case`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
@@ -474,6 +516,94 @@ class API extends HTTP {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//药师基本资料
|
||||
getPharmacistInfo(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/info`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//药师端-首页
|
||||
getPharmacistIndex(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/index`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取药师审核处方列表
|
||||
getPharmacistPrescription(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/prescription`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取处方详情
|
||||
getPharmacistPrescriptioninfo(params) {
|
||||
let order_prescription_id = params.order_prescription_id;
|
||||
params = {}
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/prescription/info/`+order_prescription_id,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//设置上下线 药师端
|
||||
putPharmacistOnOff(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/on-off`,
|
||||
method: 'PUT',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//药师基本资料
|
||||
getPharmacistInfo(params) {
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/info`,
|
||||
method: 'GET',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//审核处方
|
||||
putPharmacistPrescriptionVerify(params) {
|
||||
let order_prescription_id = params.order_prescription_id;
|
||||
delete params['order_prescription_id'];
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/pharmacist/prescription/verify/`+order_prescription_id,
|
||||
method: 'PUT',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
//医生接诊
|
||||
postDoctorInquiry(params) {
|
||||
console.log("params from api: ", params);
|
||||
let order_inquiry_id = params.order_inquiry_id;
|
||||
console.log("order_inquiry_id: ", order_inquiry_id);
|
||||
delete params['order_inquiry_id'];
|
||||
return this.request({
|
||||
url: `${this.baseUrl}/doctor/inquiry/`+order_inquiry_id,
|
||||
method: 'POST',
|
||||
data: {
|
||||
...params
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-11
@@ -1,5 +1,5 @@
|
||||
const env = require('./config').dev
|
||||
|
||||
const app = getApp()
|
||||
class HTTP {
|
||||
constructor() {
|
||||
this.baseUrl = env.baseUrl,
|
||||
@@ -21,6 +21,7 @@ class HTTP {
|
||||
|
||||
_request(url, resolve, reject, data = {}, method = 'GET', contentType = 'application/x-www-form-urlencoded', showLoading = true) {
|
||||
if(showLoading) wx.showLoading();
|
||||
let usertype = wx.getStorageSync('usertype');
|
||||
wx.request({
|
||||
url: url,
|
||||
method: method,
|
||||
@@ -28,13 +29,13 @@ class HTTP {
|
||||
header: {
|
||||
'content-type': contentType,
|
||||
'appId': this.appId,
|
||||
'Authorization': "Bearer " + wx.getStorageSync('AUTH_TOKEN')
|
||||
'Authorization': "Bearer " + wx.getStorageSync('AUTH_TOKEN_'+usertype)
|
||||
},
|
||||
success: (res) => {
|
||||
console.log("header Authorization: ", res.header.Authorization);
|
||||
var Authorization_token = res.header.Authorization;
|
||||
if(Authorization_token){
|
||||
wx.setStorageSync('AUTH_TOKEN', Authorization_token);//当token快过期时,服务器会返回新token,本地刷新
|
||||
wx.setStorageSync('AUTH_TOKEN_'+usertype, Authorization_token);//当token快过期时,服务器会返回新token,本地刷新
|
||||
}
|
||||
if (res.data) {
|
||||
const code = res.data.code;
|
||||
@@ -42,33 +43,38 @@ class HTTP {
|
||||
resolve(res.data)
|
||||
} else if(code == 401 || code == 403 || code == 405 || code == 406){
|
||||
wx.navigateTo({
|
||||
url: "/Pages/index/index"
|
||||
url: app.globalData.login_url
|
||||
})
|
||||
} else {
|
||||
reject(res.data.message)
|
||||
this._show_error(res.data.message)
|
||||
this._show_error(showLoading, res.data.message)
|
||||
}
|
||||
} else {
|
||||
resolve(res.data)
|
||||
reject(res.data)
|
||||
this._show_error(showLoading, err.data.message)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject()
|
||||
this._show_error(err.data.message)
|
||||
this._show_error(showLoading, err.data.message)
|
||||
},
|
||||
complete: () => {
|
||||
if(showLoading) wx.hideLoading();
|
||||
complete: (res) => {
|
||||
console.log("res from cmplete: ",res)
|
||||
const code = res.data.code;
|
||||
if (code == 200) {
|
||||
if(showLoading) wx.hideLoading();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
_show_error(_message) {
|
||||
_show_error(showLoading, _message) {
|
||||
if(showLoading) wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: `${_message}`,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user