新增
This commit is contained in:
@@ -1,6 +1,29 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view v-if="!dingdan_ok">
|
||||
<!-- 就诊人信息弹窗 -->
|
||||
<view v-if="showPatientModal" class="modal-overlay" @click.self="() => {}">
|
||||
<view class="patient-modal">
|
||||
<view class="modal-title">就诊人信息</view>
|
||||
<view class="patient-info-box">
|
||||
<view class="info-row">{{ formData.patient_name || '-' }} {{ formData.gender === 1 ? '男' : '女' }} {{ formData.age || '-' }}岁</view>
|
||||
<view class="info-row">体重:{{ formData.weight ? formData.weight + ' KG' : '-' }}</view>
|
||||
<view class="info-row">身高:{{ formData.height ? formData.height + ' CM' : '-' }}</view>
|
||||
<view class="info-row">血压:{{ (formData.systolic_pressure && formData.diastolic_pressure) ? (formData.systolic_pressure + '/' + formData.diastolic_pressure + ' mmHg') : '' }} mmHg</view>
|
||||
<view class="info-row">空腹血糖:{{ formData.fasting_blood_sugar ? formData.fasting_blood_sugar + ' mmol/L' : '-' }}</view>
|
||||
<view class="info-row">发现糖尿病患病史:{{ formData.diabetes_discovery_year ? formData.diabetes_discovery_year + ' 年' : '-' }}</view>
|
||||
<view class="info-row">当地医院诊断:{{ getLocalDiagnosisText() }}</view>
|
||||
<view class="info-row">当地就诊医院名称:{{ formData.local_hospital_name || '-' }}</view>
|
||||
<view class="info-row">当地医院就诊时间:{{ formData.diagnosis_date || formData.local_hospital_visit_time || '-' }}</view>
|
||||
</view>
|
||||
<view class="agreement-row">
|
||||
<text>我已阅读并同意</text>
|
||||
<text class="agreement-link" @click="openConsentForm">《互联网诊疗知情同意书》</text>
|
||||
</view>
|
||||
<button class="modal-confirm-btn" :disabled="confirmBtnLoading" :loading="confirmBtnLoading" @click="closePatientModal">点击确认并开始视频问诊</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="false">
|
||||
<!-- 确认成功页面 -->
|
||||
<view v-if="showSuccessPage" class="success-page">
|
||||
<view class="success-icon">✓</view>
|
||||
@@ -338,27 +361,25 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else class="success-container">
|
||||
<view class="success-content">
|
||||
<view class="success-icon-wrapper">
|
||||
<view class="success-icon-circle">
|
||||
<text class="success-icon-check">✓</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="success-title">确认成功</view>
|
||||
<view class="success-message">诊单已确认,感谢您的配合</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted,getCurrentInstance } from "vue";
|
||||
import { onShow, onShareAppMessage } from '@dcloudio/uni-app'
|
||||
import { onShow, onShareAppMessage,onLaunch } from '@dcloudio/uni-app'
|
||||
// 2. 获取组件实例,通过 proxy 访问全局属性
|
||||
import * as GenerateTestUserSig from "@/debug/GenerateTestUserSig-es.js";
|
||||
import { CallManager } from "@/TUICallKit/src/TUICallService/serve/callManager";
|
||||
const { proxy } = getCurrentInstance()
|
||||
const globalData = {
|
||||
SDKAppID: 0,
|
||||
userID: '',
|
||||
userSig: ''
|
||||
};
|
||||
let avatarUrl = ref(""); // 声明为响应式变量
|
||||
uni.CallManager = new CallManager();
|
||||
const formData = ref({
|
||||
patient_name: '',
|
||||
id_card: '',
|
||||
@@ -410,6 +431,8 @@ const formData = ref({
|
||||
remark: ''
|
||||
});
|
||||
let dingdan_ok=ref(false)
|
||||
const showPatientModal = ref(false)
|
||||
const confirmBtnLoading = ref(false) // 防止多次点击
|
||||
// 字典选项
|
||||
const diagnosisTypeOptions = ref([]);
|
||||
const syndromeTypeOptions = ref([]);
|
||||
@@ -436,10 +459,10 @@ onMounted(() => {
|
||||
});
|
||||
onShareAppMessage((res) =>{
|
||||
return {
|
||||
title: '诊单确认',
|
||||
title: '点击进入诊室',
|
||||
path: '/pages/order/monad/monad?id='+diagnosisId+'&share_user_id='+share_user_id,
|
||||
imageUrl: '',
|
||||
desc: '诊单确认',
|
||||
imageUrl: '/static/zs.jpg',
|
||||
desc: '点击进入诊室',
|
||||
success() {
|
||||
uni.showToast({ title: '分享成功', icon: 'success' });
|
||||
},
|
||||
@@ -535,16 +558,18 @@ const getDictData = async (type) => {
|
||||
};
|
||||
let diagnosisId=''
|
||||
let share_user_id='';
|
||||
let doctorId=ref('');
|
||||
// 加载诊单详情
|
||||
const loadDiagnosisDetail = async () => {
|
||||
// 从页面参数获取诊单ID
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const params = proxy.$parsePageParams(currentPage.options);
|
||||
dingdan_ok.value=uni.getStorageSync('dingdan_ok');
|
||||
dingdan_ok.value=false;
|
||||
diagnosisId = params.id;
|
||||
share_user_id = params.share_user_id;
|
||||
console.log('进入onMounted:', params, '诊单ID:', diagnosisId);
|
||||
doctorId.value = params.doctor_id;
|
||||
console.log('进入onMounted:', params, '诊单ID:', diagnosisId, '医生ID:', doctorId);
|
||||
|
||||
if (!diagnosisId) {
|
||||
uni.showToast({ title: '缺少诊单ID', icon: 'none' });
|
||||
@@ -567,6 +592,7 @@ const loadDiagnosisDetail = async () => {
|
||||
|
||||
if (res.code === 1) {
|
||||
formData.value = res.data;
|
||||
showPatientModal.value = true; // 进入页面后直接弹窗显示就诊人信息
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '加载失败', icon: 'none' });
|
||||
}
|
||||
@@ -578,6 +604,85 @@ const loadDiagnosisDetail = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 获取当地医院诊断文本(用顿号连接)
|
||||
const getLocalDiagnosisText = () => {
|
||||
const val = formData.value.local_hospital_diagnosis;
|
||||
if (!val) return '-';
|
||||
if (Array.isArray(val)) {
|
||||
if (val.length === 0) return '-';
|
||||
const text = val.map(v => (typeof v === 'object' && v?.name) ? v.name : String(v)).join('、');
|
||||
return text ? text + '、' : '-';
|
||||
}
|
||||
return String(val) + '、';
|
||||
};
|
||||
|
||||
// 关闭就诊人信息弹窗
|
||||
const closePatientModal = async () => {
|
||||
if (confirmBtnLoading.value) return;
|
||||
confirmBtnLoading.value = true;
|
||||
try {
|
||||
const app = getApp();
|
||||
const userID = app.globalData.userID;
|
||||
const userSig = app.globalData.userSig;
|
||||
const SDKAppID = app.globalData.SDKAppID;
|
||||
const doctor = 'doctor_' + doctorId.value;
|
||||
|
||||
if (!doctorId.value) {
|
||||
uni.showToast({ title: '诊室号不存在,联系助理处理!', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (!userID || !userSig) {
|
||||
await video();
|
||||
}
|
||||
console.log(userID, app.globalData, diagnosisId);
|
||||
|
||||
confirmDiagnosis();
|
||||
showPatientModal.value = false;
|
||||
uni.redirectTo({
|
||||
url: `/TUIKit/pages/chat/chat?userID=${encodeURIComponent(userID)}&userSig=${encodeURIComponent(userSig)}&SDKAppID=${SDKAppID}&targetUserID=${doctor}`
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
uni.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
confirmBtnLoading.value = false;
|
||||
}
|
||||
};
|
||||
const video =async (data)=>{
|
||||
const res = await proxy.apiUrl({
|
||||
url: '/api/tcm/getPatientSignature',
|
||||
method: 'GET',
|
||||
data: {
|
||||
patient_id:diagnosisId
|
||||
},
|
||||
}, false)
|
||||
|
||||
const {userId } = res.data;
|
||||
|
||||
const { userSig, SDKAppID } = GenerateTestUserSig.genTestUserSig({
|
||||
userID:userId,
|
||||
});
|
||||
|
||||
getApp().globalData.userID = userId;
|
||||
getApp().globalData.userSig = userSig;
|
||||
getApp().globalData.SDKAppID = SDKAppID;
|
||||
const cc={
|
||||
sdkAppID: SDKAppID, // 替换为用户自己的 sdkAppID
|
||||
userID: userId, // 替换为用户自己的 userID
|
||||
userSig: userSig, // 替换为用户自己的 userSig
|
||||
globalCallPagePath: "TUICallKit/src/Components/TUICallKit", // 替换为步骤一里注册的全局监听页面
|
||||
}
|
||||
uni.setStorageSync('CallManager', userId)
|
||||
await uni.CallManager.init(cc);
|
||||
}
|
||||
// 打开知情同意书
|
||||
const openConsentForm = () => {
|
||||
// 可跳转到知情同意书页面,或使用 web-view 打开外部链接
|
||||
uni.navigateTo({
|
||||
url: '/pages/Card/contact?type=service'
|
||||
})
|
||||
};
|
||||
|
||||
// 获取选中项名称
|
||||
const getDiagnosisTypeName = () => {
|
||||
const item = diagnosisTypeOptions.value.find(i => i.value === formData.value.diagnosis_type);
|
||||
@@ -730,17 +835,11 @@ const confirmDiagnosis = async () => {
|
||||
}, false);
|
||||
|
||||
if (res.code === 1) {
|
||||
uni.showToast({
|
||||
title: '确认成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
dingdan_ok.value=res.data.is_view?true:false
|
||||
uni.setStorageSync('dingdan_ok', true);
|
||||
dingdan_ok.value=true;
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '确认失败', icon: 'none' });
|
||||
}
|
||||
@@ -974,4 +1073,75 @@ const confirmDiagnosis = async () => {
|
||||
color: #777;
|
||||
animation: successSlideIn 0.6s ease-out 0.4s both;
|
||||
}
|
||||
|
||||
/* 就诊人信息弹窗 */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 999;
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.patient-modal {
|
||||
width: 100%;
|
||||
max-width: 620rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 48rpx 40rpx 40rpx;
|
||||
box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
color: #1a1a1a;
|
||||
text-align: center;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.patient-info-box {
|
||||
background: #f5f5f5;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 16rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
font-size: 35rpx;
|
||||
color: #333;
|
||||
line-height: 2;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.agreement-row {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
margin-bottom: 32rpx;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.agreement-link {
|
||||
color: #1890ff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.modal-confirm-btn {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
line-height: 96rpx;
|
||||
background: #00C853;
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 48rpx;
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user