This commit is contained in:
haomingming
2023-03-28 20:52:22 +08:00
parent 69df3bf6b3
commit 5ba50e4e61
58 changed files with 1122 additions and 347 deletions
+169 -25
View File
@@ -20,7 +20,7 @@ Page({
drug_content_show: false,
search_drug_list_empty: true,
search_drug_list: [],
select_drug_name: "",
product_name: "",
select_drug_id: "",
save_durg_product_id: "",
save_durg_prescription_product_num: "",
@@ -30,9 +30,11 @@ Page({
save_durg_frequency_use: "",
save_durg_available_days: "",
order_inquiry_id: "",
order_prescription_id: "",
doctor_advice: "",
doctors_advice_focus: false,
case_detail: {}
case_detail: {},
sub_disabled: false,
},
onDoctorsAdviceFocus(){
this.setData({
@@ -41,21 +43,28 @@ Page({
},
onLoad(options){
let order_inquiry_id = options.order_inquiry_id;
let order_prescription_id = options.order_prescription_id ;
//获取患者问诊病例
api.getDoctorInquiryCase({order_inquiry_id: order_inquiry_id}).then(response => {
console.log(response);
this.setData({
case_detail: response.data
})
}).then(res => {
//有处方id,才去请求详情
if(order_prescription_id){
this.getDoctorPrescriptionInfo(order_inquiry_id, order_prescription_id);
}
}).catch(errors => {console.error(errors);})
this.setData({
order_inquiry_id: order_inquiry_id
order_inquiry_id: order_inquiry_id,
order_prescription_id: order_prescription_id,
})
},
select_drug(e){
this.setData({
drug_content_show: true,
select_drug_name: e.currentTarget.dataset.product_name,
product_name: e.currentTarget.dataset.product_name,
select_drug_id: e.currentTarget.dataset.product_id,
save_durg_product_id: e.currentTarget.dataset.product_id
});
@@ -110,7 +119,7 @@ Page({
this.delDrugBox(product_id);
let save_durg = {};
save_durg.select_drug_name = this.data.select_drug_name;
save_durg.product_name = this.data.product_name;
save_durg.product_id = this.data.save_durg_product_id;
save_durg.prescription_product_num = this.data.save_durg_prescription_product_num;
save_durg.single_unit = this.data.save_durg_single_unit;
@@ -123,7 +132,7 @@ Page({
this.setData({
drugs_box_item_list: list,
drugs_popshow: false,
select_drug_name: "",
product_name: "",
drug_content_show: false,
search_drug_list: [],
save_durg_product_id: "",
@@ -154,8 +163,8 @@ Page({
search(){
//搜索诊断
let params = {};
params.disease_class_name = this.data.disease_class_name;
api.getBasicDiseaseSearch(params).then(response => {
params.icd_keyword = this.data.disease_class_name;
api.getBasicIcdSearch(params).then(response => {
console.log(response);
this.setData({
zhenduan_search_list: response.data
@@ -167,7 +176,7 @@ Page({
searchDrug(){
//搜索药品
let params = {};
params.product_keyword = this.data.select_drug_name;
params.product_keyword = this.data.product_name;
api.getBasicProductSearch(params).then(response => {
console.log(response);
if(response.data.length > 0){
@@ -197,17 +206,17 @@ Page({
})
},
addZhenDuan(e){
let disease_class_name = e.currentTarget.dataset.disease_class_name;
let disease_class_id = e.currentTarget.dataset.disease_class_id;
console.log("disease_class_name: ", disease_class_name);
console.log("disease_class_id: ", disease_class_id);
let icd_name = e.currentTarget.dataset.icd_name;
let icd_id = e.currentTarget.dataset.icd_id;
console.log("icd_name: ", icd_name);
console.log("icd_id: ", icd_id);
let disease_obj = {};
disease_obj.disease_class_name = disease_class_name;
disease_obj.disease_class_id = disease_class_id;
disease_obj.icd_name = icd_name;
disease_obj.icd_id = icd_id;
let list = this.data.zhenduan_list;
let find_index = list.findIndex(item => {
return item.disease_class_id == disease_class_id
return item.icd_id == icd_id
});
if(find_index == -1){
list.push(disease_obj);
@@ -245,7 +254,7 @@ Page({
console.log(drug);
this.setData({
drugs_popshow: true,
select_drug_name: drug.select_drug_name,
product_name: drug.product_name,
drug_content_show: true,
save_durg_product_id: drug.product_id,
save_durg_prescription_product_num: drug.prescription_product_num,
@@ -280,37 +289,172 @@ Page({
doctor_advice: e.detail.value
})
},
postDoctorPrescription(){//新增处方
postDoctorPrescription(e){//新增处方
let sub_disabled = this.data.sub_disabled;
if(sub_disabled) return
console.log("postDoctorPrescription postDoctorPrescription");
//先置灰,避免重复提交
this.setData({
sub_disabled: true
})
let params = {};
params.order_inquiry_id = this.data.order_inquiry_id;
params.doctor_advice = this.data.doctor_advice;
let prescription_icd = [];
this.data.zhenduan_list.forEach(item => {
prescription_icd.push(item.disease_class_id);
prescription_icd.push(item.icd_id);
})
params.prescription_icd = prescription_icd;
params.prescription_product = this.data.drugs_box_item_list;
console.log(params);
if(prescription_icd.length == 0){
wx.showToast({
title: '请选择诊断',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
if(params.prescription_product.length == 0){
wx.showToast({
title: '请选择药品',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
if(this.data.doctor_advice == ""){
wx.showToast({
title: '请填写医嘱',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
if(this.data.doctor_advice.length < 5 || this.data.doctor_advice.length > 200){
wx.showToast({
title: '医嘱字数5-20',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
api.postDoctorPrescription(params).then(response => {
console.log(response);
}).catch(errors => {console.error(errors);})
wx.showToast({
title: '提交成功',
icon: "success"
})
}).catch(errors => {
console.error(errors);
this.setData({
sub_disabled: false
})
})
},
putDoctorPrescription(){//修改处方
let sub_disabled = this.data.sub_disabled;
if(sub_disabled) return
console.log("putDoctorPrescription putDoctorPrescription");
//先置灰,避免重复提交
this.setData({
sub_disabled: true
})
let params = {};
params.order_prescription_id = this.data.order_prescription_id;
params.doctor_advice = this.data.doctor_advice;
let prescription_icd = [];
this.data.zhenduan_list.forEach(item => {
prescription_icd.push(item.icd_id);
})
params.prescription_icd = prescription_icd;
params.prescription_product = this.data.drugs_box_item_list;
console.log(params);
if(prescription_icd.length == 0){
wx.showToast({
title: '请选择诊断',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
if(params.prescription_product.length == 0){
wx.showToast({
title: '请选择药品',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
if(this.data.doctor_advice == ""){
wx.showToast({
title: '请填写医嘱',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
if(this.data.doctor_advice.length < 5 || this.data.doctor_advice.length > 200){
wx.showToast({
title: '医嘱字数5-20',
icon: "error"
})
this.setData({
sub_disabled: false
})
return;
}
api.putDoctorPrescription(params).then(response => {
console.log(response);
}).catch(errors => {console.error(errors);})
wx.showToast({
title: '提交成功',
icon: "success"
})
}).catch(errors => {
console.error(errors);
this.setData({
sub_disabled: false
})
})
},
getDoctorPrescriptionInfo(){//获取处方详情
getDoctorPrescriptionInfo(order_inquiry_id, order_prescription_id){//获取处方详情
let params = {};
params.order_inquiry_id = order_inquiry_id;
params.order_prescription_id = order_prescription_id;
api.getDoctorPrescriptionInfo(params).then(response => {
console.log(response);
this.setData({
doctor_advice: response.data.prescription.doctor_advice,
zhenduan_list: response.data.prescription_icd,
drugs_box_item_list: response.data.prescription_product,
})
}).catch(errors => {console.error(errors);})
}
})
+18 -13
View File
@@ -33,7 +33,7 @@
<view class="addzhenduan">+添加诊断</view>
<view slot="label">
<view style="margin-top: 20rpx;" class="label_item" wx:for="{{zhenduan_list}}">
<van-icon name="delete" catchtap="delZhenDuan" color="red" data-disease_class_id="{{item.disease_class_id}}" /><text style="margin-left: 10rpx;">{{item.disease_class_name}}</text>
<van-icon name="delete" catchtap="delZhenDuan" color="red" data-disease_class_id="{{item.icd_id}}" /><text style="margin-left: 10rpx;">{{item.icd_name}}</text>
</view>
</view>
</van-cell>
@@ -45,7 +45,7 @@
<view class="drugs_box">
<view class="drugs_box_item" wx:for="{{ drugs_box_item_list }}" wx:for-item="drugs">
<view class="drugs_name">{{ drugs.select_drug_name }}(数量{{ drugs.prescription_product_num}})</view>
<view class="drugs_name">{{ drugs.product_name }}(数量{{ drugs.prescription_product_num}})</view>
<view class="drugs_guige">用法用量:{{ drugs.single_use }};{{ drugs.frequency_use }};{{ drugs.single_unit }}</view>
<!-- <view class="drugs_dosage">备注:{{ drugs.drugs_dosage }}</view> -->
<view class="btn">
@@ -56,16 +56,18 @@
</view>
<view class="adddrugs_btn">
<van-button bind:click="showPopup" color="rgba(35,209,215,0.28); font-size:30rpx; border-radius: 10rpx;" type="primary" block>+添加药品</van-button>
<van-button bind:click="showPopup" color="rgba(44,241,248,0.28);" custom-style="color:#3CC7C0; font-size:30rpx; border-radius: 10rpx;" type="primary" block>+添加药品</van-button>
</view>
<form bindsubmit="{{ order_prescription_id == ''?'postDoctorPrescription':'putDoctorPrescription' }}">
<view class="txt_title">医嘱</view>
<view class="doctors_advice" bindtap="onDoctorsAdviceFocus">
<textarea auto-height focus="{{doctors_advice_focus}}" maxlength="1000" bindblur="getAdvice" style="width: 100%;" placeholder-style="font-size:24rpx; color:#999" placeholder="请输入医嘱(5-200字)" name="doctors_advice" value="{{doctor_advice}}"></textarea>
</view>
<view class="sub_btn">
<van-button disabled="{{sub_disabled}}" form-type="submit" color="#3CC7C0; font-size:30rpx; border-radius: 10rpx;" type="primary" block>{{ order_prescription_id == ''?'提交审核':'重开处方' }}</van-button>
</view>
<view class="txt_title">医嘱</view>
<view class="doctors_advice" bindtap="onDoctorsAdviceFocus">
<textarea auto-height focus="{{doctors_advice_focus}}" maxlength="1000" bindblur="getAdvice" style="width: 100%;" placeholder-style="font-size:24rpx; color:#999" placeholder="请输入医嘱"></textarea>
</view>
<view class="sub_btn">
<van-button bind:click="postDoctorPrescription" color="#3CC7C0; font-size:30rpx; border-radius: 10rpx;" type="primary" block>提交审核</van-button>
</view>
</form>
<van-popup
@@ -81,7 +83,7 @@
<view class="search_drug">
<view class="search_drug_btn">
<text class="search_drug_btn_title">药品名称</text>
<van-search model:value="{{ select_drug_name }}"
<van-search model:value="{{ product_name }}"
class="search_drug_btn_input"
clearable shape="round"
placeholder="请输入药品名称或拼音码搜索"
@@ -206,10 +208,13 @@
bind:change="onZhenDuanChange"
/>
<view class="zhenduan_data_list">
<view bindtap="addZhenDuan" class="zhenduan_item" data-disease_class_name="{{item.disease_class_name}}" data-disease_class_id="{{item.disease_class_id}}" wx:for="{{zhenduan_search_list}}">
{{item.disease_class_name}}
<view bindtap="addZhenDuan" class="zhenduan_item" data-icd_name="{{item.icd_name}}" data-icd_id="{{item.icd_id}}" wx:for="{{zhenduan_search_list}}">
{{item.icd_name}}
</view>
</view>
</van-popup>
<van-toast id="van-toast" />
</view>
<view style="height: 50rpx;">
</view>