feat: 绑定his档案

This commit is contained in:
huxuejian 2026-06-10 11:29:08 +08:00
parent 17c6f0f671
commit d18838e852
6 changed files with 180 additions and 29 deletions

View File

@ -14,9 +14,10 @@
<view class="flex-grow mr-5"></view>
<view v-if="enableHis && customer.isConnectHis"
class="px-15 py-5 text-sm leading-normal bg-success text-white rounded-sm">
未关联档案
已关联院内档案
</view>
<view v-else-if="enableHis" class="px-15 py-5 text-sm leading-normal bg-warning text-white rounded-sm">未关联档案
<view v-else-if="enableHis" class="px-15 py-5 text-sm leading-normal bg-warning text-white rounded-sm">
未关联院内档案
</view>
</view>
<view class="px-15 py-12 border-b">
@ -30,7 +31,9 @@
<view class="text-base leading-normal">证件号{{ customer.idCard || '--' }}</view>
</view>
<view class="px-15 py-12 flex justify-end">
<view v-if="enableHis && !customer.isConnectHis" class="mr-10 text-base text-primary">关联档案</view>
<view v-if="enableHis && !customer.isConnectHis" class="mr-10 text-base text-primary"
@click="getMatchedHisArchive(customer)">关联档案
</view>
<view class="text-base text-success" @click="changeArchive(customer)">完善个人信息</view>
<!-- <view class="text-base text-danger" @click="unBindArchive(customer)">删除档案</view> -->
</view>
@ -40,6 +43,8 @@
<button-footer confirmText="新增档案" :showCancel="false" @confirm="addArchive()" />
</template>
</full-page>
<bind-his-popup :corpId="corpId" :corpName="corpName" :openid="account.openid" :customer="customer" :hisArchive="hisArchive"
:visible="showBindHisPopup" @close="showBindHisPopup = false" @confirm="confirmBindHisPopup" />
</template>
<script setup>
import { ref } from 'vue';
@ -47,11 +52,12 @@ import { storeToRefs } from 'pinia'
import useGuard from '@/hooks/useGuard';
import useAccount from '@/store/account';
import api from '@/utils/api';
import { confirm, toast } from '@/utils/widget';
import ButtonFooter from '@/components/button-footer.vue';
import EmptyData from '@/components/empty-data.vue';
import FullPage from '@/components/full-page.vue';
import { confirm, toast } from '../../utils/widget';
import BindHisPopup from './bind-his-popup.vue';
const empty = ref(false)
const { useLoad, useShow } = useGuard();
@ -62,6 +68,10 @@ const corpUserId = ref('');
const referenceCustomerId = ref('');
const enableHis = ref(false);
const customers = ref([]);
const showBindHisPopup = ref(false);
const corpName = ref('');
const hisArchive = ref({});
const customer = ref({})
function addArchive() {
uni.navigateTo({
@ -75,6 +85,14 @@ function changeArchive(customer) {
})
}
function confirmBindHisPopup() {
showBindHisPopup.value = false;
getMembers();
uni.navigateTo({
url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}&customerId=${customer.value._id}`
})
}
async function getMembers() {
const res = await api('getTeamCustomers', { corpId: corpId.value, teamId: teamId.value, miniAppId: account.value.openid });
customers.value = res && Array.isArray(res.data) ? res.data : [];
@ -84,6 +102,18 @@ async function getMembers() {
}
}
async function getMatchedHisArchive(data) {
const res = await api('getMatchedHisArchive', { id: data._id, corpId: corpId.value, miniAppId: account.value.openid });
if (res && res.success) {
hisArchive.value = res.data || {};
customer.value = data;
corpName.value = res.corpName || '';
showBindHisPopup.value = true;
} else {
confirm(res?.message || '获取档案信息失败', { showCancel: false })
}
}
async function unBindArchive(customer) {
await confirm('确定删除档案吗?')
const res = await api('unbindMiniAppArchive', { id: customer._id, corpId: corpId.value, teamId: teamId.value, miniAppId: account.value.openid });

View File

@ -0,0 +1,110 @@
<template>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="bg-white rounded overflow-hidden" style="width: 690rpx;">
<view class="flex items-center justify-between px-15 py-12 border-b">
<view class="text-lg font-semibold text-dark">档案绑定验证</view>
<uni-icons type="closeempty" :size="24" color="#999" @click="close"></uni-icons>
</view>
<view class="px-15 pt-15 text-base text-dark">
您在"{{ corpName }}"医客通平台已存在档案请选择档案绑定
</view>
<!-- <scroll-view scroll-y="true" class="popup-content-scroll"> -->
<view class="px-15 py-12">
<view class="flex items-center p-10 mb-10 rounded-sm bg-gray">
<view class="flex-grow w-0 mr-5 text-base leading-normal text-dark">
<view class="flex items-center">
<view class="flex-shrink-0 min-w-60">姓名</view>
<view>{{ hisArchive.name }}</view>
</view>
<view class="flex items-center">
<view class="flex-shrink-0 min-w-60">手机号</view>
<view>{{ hisArchive.mobile }}</view>
</view>
</view>
</view>
</view>
<view class="footer-buttons">
<button-footer hideden-shadow confirmText="确定" :showCancel="false" @confirm="confirm()" />
</view>
</view>
</uni-popup>
</template>
<script setup>
import { computed, ref, watch } from 'vue';
import api from '@/utils/api';
import { toast } from '@/utils/widget';
import ButtonFooter from '@/components/button-footer.vue';
const emits = defineEmits(['close', 'confirm'])
const props = defineProps({
corpId: {
type: String,
default: ''
},
corpName: {
type: String,
default: ''
},
customer: {
type: Object,
default: () => ({})
},
hisArchive: {
type: Object,
default: () => ({})
},
openid: {
type: String,
default: ''
},
visible: {
type: Boolean,
default: false
}
})
const popup = ref()
const loading = ref(false);
function close() {
emits('close')
}
async function confirm() {
if (loading.value) return;
loading.value = true;
const res = await api('bindHisArchive', { id: props.customer._id, corpId: props.corpId, miniAppId: props.openid });
if (res && res.success) {
await toast('绑定成功');
emits('confirm');
} else {
toast(res?.message || '绑定失败')
}
loading.value = false;
}
watch(() => props.visible, n => {
if (n) {
popup.value && popup.value.open();
} else {
popup.value && popup.value.close()
}
})
</script>
<style lang="scss" scoped>
.min-w-60 {
min-width: 120rpx;
}
.check-icon {
width: 48rpx;
height: 48rpx;
}
.popup-content-scroll {
max-height: 50vh;
}
</style>

View File

@ -39,12 +39,9 @@
</view>
</view>
</uni-popup>
<verify-name-popup
:visible="showVerifyPopup"
:customer="customer"
@close="onVerifyClose"
@confirm="onVerifyConfirm"
/>
<verify-name-popup :visible="showVerifyPopup" :customer="customer" @close="onVerifyClose"
@confirm="onVerifyConfirm" />
<verify-popup :visible="showIdNoPopup" :customer="customer" @close="showIdNoPopup = false" @confirm="onVerifyConfirm" />
</template>
<script setup>
@ -53,6 +50,7 @@ import { toast } from '@/utils/widget';
import ButtonFooter from '@/components/button-footer.vue';
import VerifyNamePopup from './verify-name-popup.vue';
import verifyPopup from './verify-popup.vue';
const emits = defineEmits(['close', 'confirm'])
const props = defineProps({
@ -64,6 +62,10 @@ const props = defineProps({
type: Array,
default: () => []
},
enableHis: {
type: Boolean,
default: false
},
visible: {
type: Boolean,
default: false
@ -72,6 +74,7 @@ const props = defineProps({
const popup = ref()
const id = ref('')
const showVerifyPopup = ref(false)
const showIdNoPopup = ref(false)
const list = computed(() => props.customers.map(i => {
const name = typeof i.name === 'string' ? i.name.trim() : '';
const maskName = name.length > 1 ? name.slice(0, 1) + '*'.repeat(name.length - 1) : '*';
@ -82,7 +85,7 @@ const list = computed(() => props.customers.map(i => {
}))
const customer = computed(() => {
const selected = list.value.find(i => i._id === id.value)
const selected = list.value.find(i => i._id === id.value && i.idNo)
return selected ? selected : {}
})
@ -91,10 +94,14 @@ function close() {
}
function confirm() {
if (props.customers.some(i => i._id === id.value && id.value)) {
showVerifyPopup.value = true
const selected = props.customers.find(i => i._id === id.value && id.value);
if (!selected) {
return toast('请选择档案')
}
if (props.enableHis && selected.idNo && selected.isConnectHis) {
showIdNoPopup.value = true
} else {
toast('请选择档案')
showVerifyPopup.value = true
}
}

View File

@ -35,9 +35,9 @@ const props = defineProps({
type: String,
default: ''
},
customers: {
type: Array,
default: () => []
customer: {
type: Object,
default: () => { }
},
visible: {
type: Boolean,
@ -57,10 +57,12 @@ function close() {
}
function confirm() {
if (props.customers.some(i => i._id === id.value && id.value)) {
emits('confirm', id.value)
const data = props.customer && typeof props.customer.idNo === 'string' ? props.customer.idNo.slice(-4).toUpperCase() : '';
const last4 = codeStr.value.toUpperCase();
if (data.length === 4 && data === last4) {
emits('confirm')
} else {
toast('请选择档案')
toast('请输入正确的身份证号后四位')
}
}

View File

@ -4,7 +4,7 @@
<view class="module-title flex-shrink-0 truncate"> 成员档案 </view>
<view class="flex items-center leading-normal rounded-sm" style="padding-right: 0" @click="toManagePage()">
<image class="manage-icon mr-5" src="/static/home/archive-manage.png" mode="aspectFit"></image>
<view style="font-size: 30rpx; color: #065bd6">档案管理</view>
<view style="font-size: 30rpx; color: #065bd6">已授权档案管理</view>
</view>
</view>
<view v-if="customers.length === 0" class="add-archive-card" @click="toManagePage()">

View File

@ -63,6 +63,8 @@ const urlsConfig = {
getWxAppCustomerCount: "getWxAppCustomerCount",
updateCustomer: 'update',
getRefrencePeople: 'getRefrencePeople',
bindHisArchive: 'bindHisArchive',
getMatchedHisArchive: 'getMatchedHisArchive',
},
wecom: {
addContactWay: 'getCorpFriendQrcode'