fix: 修复患者就诊历史

This commit is contained in:
2025-12-25 14:28:25 +08:00
parent bbb78c77ff
commit 55e9241c4f
7 changed files with 169 additions and 34 deletions

View File

@@ -248,7 +248,7 @@ import {
storeList
} from '../../request/api/api'
import { getPlatformQualificationsApi } from '../../request/api/platform'
import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi, getHomeZonesApi } from "@/request/api/product";
import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi, getHomeZonesApi, checkOnlineConsultationConfigApi } from "@/request/api/product";
import request from "@/request/api/request";
export default {
@@ -318,20 +318,36 @@ export default {
url: '/pages/Inquiries/Inquiries?type=' + type
})
},
golist(type) {
async golist(type) {
if (type === 3) {
// 检查是否配置了在线复诊负责人
if (!this.defaultDoctorId) {
// 检查药店在线复诊配置(委托诊所和医生)
try {
const storeId = uni.getStorageSync('store_id');
const res = await checkOnlineConsultationConfigApi({ store_id: storeId });
if (!res.data?.result?.can_use) {
uni.showToast({
title: res.data?.result?.message || '该药店暂不支持在线复诊功能',
icon: 'none',
duration: 2000
});
return;
}
// 使用接口返回的医生ID
const doctorId = res.data.result.doctor_id || this.defaultDoctorId;
// 获取委托诊所ID如果有委托诊所则使用委托诊所ID否则使用当前诊所ID
const delegateStoreId = res.data.result.delegate_store_id || storeId;
return uni.navigateTo({
url: '/subPackages/product/product?doctor_id=' + doctorId + '&register_type=3&delegate_store_id=' + delegateStoreId
});
} catch (error) {
console.error('检查在线复诊配置失败:', error);
uni.showToast({
title: '该门店暂不支持在线复诊',
title: '网络异常,请稍后重试',
icon: 'none',
duration: 2000
});
return;
}
return uni.navigateTo({
url: '/subPackages/product/product?doctor_id=' + this.defaultDoctorId + '&register_type=3'
})
}
uni.navigateTo({
url: '/pages/Inquiries/Inquiries?type=' + type
@@ -592,19 +608,34 @@ export default {
});
},
// 直接购买
buyProduct(item) {
// 检查是否配置了在线复诊负责人
if (!this.defaultDoctorId) {
async buyProduct(item) {
// 检查药店在线复诊配置(委托诊所和医生)
try {
const storeId = uni.getStorageSync('store_id');
const res = await checkOnlineConsultationConfigApi({ store_id: storeId });
if (!res.data?.result?.can_use) {
uni.showToast({
title: res.data?.result?.message || '该药店暂不支持在线复诊功能',
icon: 'none',
duration: 2000
});
return;
}
// 使用接口返回的医生ID
const doctorId = res.data.result.doctor_id || this.defaultDoctorId;
// 获取委托诊所ID如果有委托诊所则使用委托诊所ID否则使用当前诊所ID
const delegateStoreId = res.data.result.delegate_store_id || storeId;
uni.navigateTo({
url: `/subPackages/product/product?doctor_id=${doctorId}&register_type=3&delegate_store_id=${delegateStoreId}`
});
} catch (error) {
console.error('检查在线复诊配置失败:', error);
uni.showToast({
title: '该门店暂不支持在线复诊',
title: '网络异常,请稍后重试',
icon: 'none',
duration: 2000
});
return;
}
uni.navigateTo({
url: `/subPackages/product/product?doctor_id=${this.defaultDoctorId}&register_type=3`
});
},
// 预览资质证明
previewQualification(item) {

View File

@@ -60,4 +60,13 @@ export async function getChatRegisterInfoApi(params) {
export function upLoadChatFileApi(params) {
return console.log('aaaaaaaaaaaaaaaaaaa', uploadFile('/chat-friends/upload-chat-file', params))
return uploadFile('/chat-friends/upload-chat-file', params)
}
/**
* 获取医生信息
* @param params { doctor_id: string }
* @returns {Promise<*>}
*/
export async function getDoctorInfoApi(params) {
return await get('/chat-friends/get-doctor-info', params, 3)
}

View File

@@ -47,4 +47,13 @@ export async function getHomeZonesApi(params) {
*/
export async function updateIntroductionImagesApi(params) {
return await post('/product/update-introduction-images', params, 3)
}
/**
* 检查药店在线复诊配置(委托诊所和医生)
* @param params { store_id: number }
* @returns {Promise<*>}
*/
export async function checkOnlineConsultationConfigApi(params) {
return await get('/store/check-online-consultation-config', params, 3)
}

View File

@@ -524,7 +524,7 @@
*/
import { webSocketManager } from '@/utils/ws/websocket';
import { ChatManager } from '@/store/chat/chat.js';
import {getChatRegisterInfoApi, sendToUserApi, upLoadChatFileApi} from "@/request/api/im";
import {getChatRegisterInfoApi, sendToUserApi, upLoadChatFileApi, getDoctorInfoApi} from "@/request/api/im";
import { checkDev } from '@/utils/utils';
// 根据环境获取上传URL
@@ -657,13 +657,19 @@ export default {
this.messages = ChatManager.getRoomMessages(option.room_id);
}
// 5. 设置导航栏标题
uni.setNavigationBarTitle({
title: `${this.doctorUserInfo.nick_name}医生的对话`,
success: () => {
console.log('修改标题成功');
}
});
// 5. 检查医生信息是否完整如果不完整则从API获取
const nickName = this.doctorUserInfo.nick_name;
if (!nickName || nickName === 'undefined' || nickName === 'null') {
this.fetchDoctorInfo(doctorId);
} else {
// 设置导航栏标题
uni.setNavigationBarTitle({
title: `${nickName}医生的对话`,
success: () => {
console.log('修改标题成功');
}
});
}
// 6. 初次渲染滚动到底部
// Fix: 页面加载时延时触发滚动到锚点
@@ -718,6 +724,49 @@ export default {
},
methods: {
/**
* 获取医生信息
* 当进入聊天页面时如果医生信息不完整undefined则调用此方法获取
*/
async fetchDoctorInfo(doctorId) {
try {
// 移除可能存在的前缀
const cleanDoctorId = String(doctorId).replace('doctor-', '');
const res = await getDoctorInfoApi({ doctor_id: cleanDoctorId });
if (res.data && res.data.result) {
const doctorInfo = res.data.result;
// 更新医生信息
this.doctorUserInfo = {
...this.doctorUserInfo,
nick_name: doctorInfo.nick_name || '医生',
avatar: doctorInfo.avatar || this.doctorAvatar,
department: doctorInfo.department || '',
title: doctorInfo.title || ''
};
// 更新医生头像
if (doctorInfo.avatar) {
this.doctorAvatar = doctorInfo.avatar;
}
// 更新导航栏标题
uni.setNavigationBarTitle({
title: `${this.doctorUserInfo.nick_name}医生的对话`,
success: () => {
console.log('修改标题成功');
}
});
}
} catch (error) {
console.error('获取医生信息失败:', error);
// 即使获取失败,也设置一个默认标题
uni.setNavigationBarTitle({
title: '与医生的对话'
});
}
},
/**
* 检查隐私授权
* 微信小程序从2023年9月起要求在使用敏感API前获取用户隐私授权

View File

@@ -188,6 +188,7 @@ export default {
heathList: [], // 健康信息
rInfo: [], // 健康信息
registerType: "0", // 新增挂号类型0线下/1线上
delegateStoreId: '', // 委托诊所ID购药时使用
}
},
onLoad(e) {
@@ -212,6 +213,8 @@ export default {
this.rInfo = {}
}
}
// 获取委托诊所ID如果有
this.delegateStoreId = e.delegate_store_id || '';
console.log(e)
},
@@ -335,12 +338,16 @@ export default {
title: "加载中...",
mask: true
});
// 如果是购药类型(register_type=3)且有委托诊所ID则使用委托诊所ID否则使用当前门店ID
const storeId = (this.registerType === '3' && this.delegateStoreId)
? this.delegateStoreId
: (uni.getStorageSync('store_id') || '11001');
registe({
method: "post",
data: {
user_id: uni.getStorageSync('user_id'),
user_patient_id: this.actived,
store_id: uni.getStorageSync('store_id') || '11001',
store_id: storeId,
service_user_id: this.Did,
register_type: this.registerType // 新增:挂号类型参数
}

View File

@@ -192,6 +192,7 @@ export default {
doctorId: 0,
r_type: 0,
delegateStoreId: '', // 委托诊所ID
cartCount: 0,
cartPosition: { x: 0, y: 0 },
cartMove: { startX: 0, startY: 0, moving: false },
@@ -219,6 +220,8 @@ export default {
onLoad(e) {
this.doctorId = e.doctor_id;
this.r_type = e.register_type;
// 获取委托诊所ID如果有
this.delegateStoreId = e.delegate_store_id || '';
// 根据首页传入的专区类型初始化分类默认OTC
if (e.zone_type) {
this.selectedCategory = e.zone_type;
@@ -327,9 +330,12 @@ export default {
},
handClickProduct(item) {
uni.navigateTo({
url: `/subPackages/product/symptoms?id=${item.drug.id}&drug_name=${item.drug.drug_name}&is_otc=${item.drug.is_otc}&image=${item.drug.image}&price=${item.price}`
});
// 传递委托诊所ID如果有
let url = `/subPackages/product/symptoms?id=${item.drug.id}&drug_name=${item.drug.drug_name}&is_otc=${item.drug.is_otc}&image=${item.drug.image}&price=${item.price}`;
if (this.delegateStoreId) {
url += `&delegate_store_id=${this.delegateStoreId}`;
}
uni.navigateTo({ url });
},
// 悬浮球逻辑

View File

@@ -298,7 +298,7 @@
<script>
// 完整引入原有API
import { getOrderTextApi, getStoreDrugDetailApi } from "@/request/api/product";
import { getOrderTextApi, getStoreDrugDetailApi, checkOnlineConsultationConfigApi } from "@/request/api/product";
import { genOrderApi } from "@/request/api/order";
import { getCartCountsApi, saveCartApi } from "@/request/api/cart";
import { sendToUserApi } from "@/request/api/im";
@@ -358,6 +358,7 @@ export default {
showIllnessPicker: false,
orderText: '本次商品物流配送,由萧康医药提供服务。',
introductionImages: [], // 商品介绍图数组
delegateStoreId: '', // 委托诊所ID
};
},
computed: {
@@ -384,6 +385,8 @@ export default {
this.productDetail.drug_name = options.drug_name || '';
this.productDetail.image = options.image || '';
this.productDetail.price = parseFloat(options.price || 0);
// 获取委托诊所ID如果有
this.delegateStoreId = options.delegate_store_id || '';
this.getDetail();
} else {
const savedId = uni.getStorageSync('symptoms_id');
@@ -528,9 +531,30 @@ export default {
this.closePrescriptionFormPopup();
try {
// 1. 获取默认医生ID根据门店配置
const doctorRes = await this.getDefaultDoctorId();
const doctorId = doctorRes.data.result?.doctor_id;
const storeId = uni.getStorageSync('store_id');
let delegateStoreId = this.delegateStoreId;
let doctorId = null;
// 如果没有传入委托诊所ID需要先检查在线复诊配置
if (!delegateStoreId) {
const configRes = await checkOnlineConsultationConfigApi({ store_id: storeId });
if (!configRes.data?.result?.can_use) {
uni.showToast({
title: configRes.data?.result?.message || '该门店暂不支持在线复诊功能',
icon: 'none',
duration: 2000
});
this.submitted = false;
return;
}
// 获取委托诊所ID和医生ID
delegateStoreId = configRes.data.result.delegate_store_id || storeId;
doctorId = configRes.data.result.doctor_id;
} else {
// 如果已有委托诊所ID获取默认医生ID
const doctorRes = await this.getDefaultDoctorId();
doctorId = doctorRes.data.result?.doctor_id;
}
// 检查是否配置了在线复诊负责人
if (!doctorId) {
@@ -575,10 +599,10 @@ export default {
created_at: new Date().toLocaleString('zh-CN')
};
// 4. 跳转到就诊人选择页面,传递 register_type=3患者就诊信息
// 4. 跳转到就诊人选择页面,传递 register_type=3患者就诊信息和委托诊所ID
// 用户选择就诊人后,会创建挂号记录并跳转到 register.vue
uni.navigateTo({
url: `/subPackages/doctor/doctor-userinfo?id=${doctorId}&r_type=3&r_info=${encodeURIComponent(JSON.stringify(rInfo))}`
url: `/subPackages/doctor/doctor-userinfo?id=${doctorId}&r_type=3&r_info=${encodeURIComponent(JSON.stringify(rInfo))}&delegate_store_id=${delegateStoreId}`
});
} catch (error) {
console.error('提交处方药信息失败:', error);