机构短号

This commit is contained in:
Flow 2025-06-12 14:00:47 +08:00
parent 545f0978a8
commit fbc7699bfb
2 changed files with 164 additions and 167 deletions

View File

@ -37,6 +37,7 @@ export interface PatientVO {
examhoscode: string // 体检机构编码 examhoscode: string // 体检机构编码
examhosname: string // 体检机构名称 examhosname: string // 体检机构名称
hospitalNo: string // 医院编号 hospitalNo: string // 医院编号
shorid: string // 机构短号
} }
// 患者信息 API // 患者信息 API
@ -177,9 +178,9 @@ export const PatientApi = {
}) })
}, },
//根据体检编号更新患者归属机构&医院编号 //根据体检编号更新患者归属机构&医院编号
updatePatientOrg: async (medicalSn: string,examhoscode: string,examhosname: string,hospitalNo: string) => { updatePatientOrg: async (medicalSn: string,examhoscode: string,examhosname: string,hospitalNo: string,shortid: string) => {
return await request.put({ return await request.put({
url: `/inspect/patient/updatePatientOrg?medicalSn=${medicalSn}&examhoscode=${examhoscode}&examhosname=${examhosname}&hospitalNo=${hospitalNo}` url: `/inspect/patient/updatePatientOrg?medicalSn=${medicalSn}&examhoscode=${examhoscode}&examhosname=${examhosname}&hospitalNo=${hospitalNo}&shortid=${shortid}`
}) })
}, },
//获取详情数据 //获取详情数据

View File

@ -1,15 +1,16 @@
<template> <template>
<div id="PrintElementOptionSetting" style="display:none;"></div> <div id="PrintElementOptionSetting" style="display: none"></div>
<div id="BarcodePrintElementOptionSetting" style="display:none;"></div> <div id="BarcodePrintElementOptionSetting" style="display: none"></div>
<!-- 添加全屏加载遮罩 --> <!-- 添加全屏加载遮罩 -->
<div <div
v-loading.fullscreen.lock="fullscreenLoading" v-loading.fullscreen.lock="fullscreenLoading"
element-loading-text="正在导入数据,请勿关闭页面..." element-loading-text="正在导入数据,请勿关闭页面..."
element-loading-background="rgba(0, 0, 0, 0.8)"> element-loading-background="rgba(0, 0, 0, 0.8)"
>
</div> </div>
<ContentWrap style="height: 120px; display: flex; align-items: center; padding: 20px 0;"> <ContentWrap style="height: 120px; display: flex; align-items: center; padding: 20px 0">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
class="-mb-15px" class="-mb-15px"
@ -17,7 +18,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
ref="queryFormRef" ref="queryFormRef"
:inline="true" :inline="true"
label-width="68px" label-width="68px"
style="width: 100%;" style="width: 100%"
> >
<el-form-item label="体检编号" prop="medicalSn"> <el-form-item label="体检编号" prop="medicalSn">
<el-input <el-input
@ -28,12 +29,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
/> />
</el-form-item> </el-form-item>
<el-form-item label="姓名" prop="pname"> <el-form-item label="姓名" prop="pname">
<el-input <el-input v-model="queryParams.pname" placeholder="请输入姓名" clearable class="!w-200px" />
v-model="queryParams.pname"
placeholder="请输入姓名"
clearable
class="!w-200px"
/>
</el-form-item> </el-form-item>
<el-form-item label="身份证号" prop="cardId"> <el-form-item label="身份证号" prop="cardId">
<el-input <el-input
@ -43,11 +39,8 @@ v-loading.fullscreen.lock="fullscreenLoading"
class="!w-200px" class="!w-200px"
/> />
</el-form-item> </el-form-item>
<el-form-item prop="cardId"> <el-form-item prop="cardId">
<IDCardReader <IDCardReader v-model:cardId="queryParams.cardId" @success="handleIdCardSuccess" />
v-model:cardId="queryParams.cardId"
@success="handleIdCardSuccess"
/>
</el-form-item> </el-form-item>
<el-form-item label="打印日期" prop="printTimeRange"> <el-form-item label="打印日期" prop="printTimeRange">
<el-date-picker <el-date-picker
@ -62,13 +55,23 @@ v-loading.fullscreen.lock="fullscreenLoading"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="isprint"> <el-form-item label="状态" prop="isprint">
<el-select v-model="queryParams.isprint" placeholder="请选择状态" clearable class="!w-200px"> <el-select
v-model="queryParams.isprint"
placeholder="请选择状态"
clearable
class="!w-200px"
>
<el-option label="已打印" value="1" /> <el-option label="已打印" value="1" />
<el-option label="未打印" value="0" /> <el-option label="未打印" value="0" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="当前机构" prop="hospitalNo"> <el-form-item label="当前机构" prop="hospitalNo">
<el-select v-model="queryParams.hospitalNo" placeholder="请选择当前机构" clearable class="!w-200px"> <el-select
v-model="queryParams.hospitalNo"
placeholder="请选择当前机构"
clearable
class="!w-200px"
>
<el-option label="乌兰察布第四医院" value="121526004609160793" /> <el-option label="乌兰察布第四医院" value="121526004609160793" />
<el-option label="乌兰察布第四医院实验室" value="221526004609160793" /> <el-option label="乌兰察布第四医院实验室" value="221526004609160793" />
</el-select> </el-select>
@ -78,7 +81,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
<Icon icon="ep:search" class="mr-5px" /> 查询 <Icon icon="ep:search" class="mr-5px" /> 查询
</el-button> </el-button>
<el-button type="success" :loading="importLoading" @click="handleImport"> <el-button type="success" :loading="importLoading" @click="handleImport">
<Icon icon="ep:upload" class="mr-5px" /> 导入Excel文件 <Icon icon="ep:upload" class="mr-5px" /> 导入Excel文件
</el-button> </el-button>
<el-button type="primary" @click="handleAdd()"> <el-button type="primary" @click="handleAdd()">
<Icon icon="ep:plus" class="mr-5px" /> 新增 <Icon icon="ep:plus" class="mr-5px" /> 新增
@ -86,7 +89,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
<input <input
type="file" type="file"
ref="fileInputRef" ref="fileInputRef"
accept=".xlsx,.xls" accept=".xlsx,.xls"
style="display: none" style="display: none"
@change="uploadFile" @change="uploadFile"
/> />
@ -96,7 +99,6 @@ v-loading.fullscreen.lock="fullscreenLoading"
<Icon icon="ep:download" class="mr-5px" /> 导出Excel <Icon icon="ep:download" class="mr-5px" /> 导出Excel
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -107,7 +109,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
:data="list" :data="list"
:stripe="true" :stripe="true"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
:header-cell-style="{ background: 'rgb(235, 241, 250)', height: '56px',color:'#333333' }" :header-cell-style="{ background: 'rgb(235, 241, 250)', height: '56px', color: '#333333' }"
:row-style="{ height: '56px' }" :row-style="{ height: '56px' }"
> >
<el-table-column label="体检编号" align="center" prop="medicalSn" /> <el-table-column label="体检编号" align="center" prop="medicalSn" />
@ -119,18 +121,8 @@ v-loading.fullscreen.lock="fullscreenLoading"
<el-table-column label="状态" align="center" prop="isprint" :formatter="statusFormatter" /> <el-table-column label="状态" align="center" prop="isprint" :formatter="statusFormatter" />
<el-table-column label="操作" align="center" fixed="right" width="240px"> <el-table-column label="操作" align="center" fixed="right" width="240px">
<template #default="scope"> <template #default="scope">
<el-button <el-button link type="primary" @click="handlePrint(scope.row)"> 打印导检单 </el-button>
link <el-button link type="primary" @click="handlePrintBarcode(scope.row)">
type="primary"
@click="handlePrint(scope.row)"
>
打印导检单
</el-button>
<el-button
link
type="primary"
@click="handlePrintBarcode(scope.row)"
>
打印条形码 打印条形码
</el-button> </el-button>
</template> </template>
@ -147,28 +139,27 @@ v-loading.fullscreen.lock="fullscreenLoading"
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<DepartmentForm ref="formRef" @success="getList" /> <DepartmentForm ref="formRef" @success="getList" />
<!-- 新增信息对话框 --> <!-- 新增信息对话框 -->
<el-dialog <el-dialog v-model="dialogVisible" title="新增信息" width="700px" :close-on-click-modal="false">
v-model="dialogVisible" <el-form :model="addForm" ref="addFormRef" label-width="100px" :rules="addFormRules">
title="新增信息"
width="700px"
:close-on-click-modal="false"
>
<el-form
:model="addForm"
ref="addFormRef"
label-width="100px"
:rules="addFormRules"
>
<el-form-item label="姓名" prop="name"> <el-form-item label="姓名" prop="name">
<el-input v-model="addForm.name" placeholder="请输入姓名" /> <el-input v-model="addForm.name" placeholder="请输入姓名" />
</el-form-item> </el-form-item>
<el-form-item label="身份证号" prop="cardId"> <el-form-item label="身份证号" prop="cardId">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<el-input v-model="addForm.cardId" placeholder="请输入身份证号" @blur="handleCardIdBlur" style="width: 75%;" /> <el-input
<el-button type="primary" @click="handleGwPatientInfo" style="margin-left: 10px;">获取公卫患者信息</el-button> v-model="addForm.cardId"
<el-button type="primary" @click="handleReadIdCard" style="margin-left: 10px;">读取身份证</el-button> placeholder="请输入身份证号"
@blur="handleCardIdBlur"
style="width: 75%"
/>
<el-button type="primary" @click="handleGwPatientInfo" style="margin-left: 10px"
>获取公卫患者信息</el-button
>
<el-button type="primary" @click="handleReadIdCard" style="margin-left: 10px"
>读取身份证</el-button
>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="出生日期" prop="birthDate"> <el-form-item label="出生日期" prop="birthDate">
@ -201,14 +192,14 @@ v-loading.fullscreen.lock="fullscreenLoading"
<script setup lang="ts"> <script setup lang="ts">
import { PatientApi, type PatientVO } from '@/api/inspect/inspectpatient' import { PatientApi, type PatientVO } from '@/api/inspect/inspectpatient'
import * as SummaryApi from "@/api/summary"; import * as SummaryApi from '@/api/summary'
import { newHiprintPrintTemplate } from "@/views/summary/utils/template-helper"; import { newHiprintPrintTemplate } from '@/views/summary/utils/template-helper'
import template from "@/views/summary/print/template"; import template from '@/views/summary/print/template'
import barcode from "@/views/summary/print/barcode"; import barcode from '@/views/summary/print/barcode'
import IDCardReader from '@/components/IDCardReader.vue'; import IDCardReader from '@/components/IDCardReader.vue'
import sdk from '@/components/IDCardReader/sdk'; import sdk from '@/components/IDCardReader/sdk'
import download from '@/utils/download' // import download from '@/utils/download' //
import { ElMessageBox } from 'element-plus' // ElMessageBox import { ElMessageBox } from 'element-plus' // ElMessageBox
import { InspectOrgApi, InspectOrgVO } from '@/api/inspect/inspectorg/index' import { InspectOrgApi, InspectOrgVO } from '@/api/inspect/inspectorg/index'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import { getUserProfile } from '@/api/system/user/profile' import { getUserProfile } from '@/api/system/user/profile'
@ -237,7 +228,7 @@ const queryParams = reactive({
const queryFormRef = ref() // const queryFormRef = ref() //
const fileInputRef = ref<HTMLInputElement | null>(null) // const fileInputRef = ref<HTMLInputElement | null>(null) //
const idCardReading = ref(false) // const idCardReading = ref(false) //
const shortid = ref('')
// //
const dialogVisible = ref(false) const dialogVisible = ref(false)
const addFormRef = ref() const addFormRef = ref()
@ -255,13 +246,15 @@ const addFormRules = {
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }], name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
cardId: [ cardId: [
{ required: true, message: '请输入身份证号', trigger: 'blur' }, { required: true, message: '请输入身份证号', trigger: 'blur' },
{ pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '请输入正确的身份证号', trigger: 'blur' } {
pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
message: '请输入正确的身份证号',
trigger: 'blur'
}
], ],
gender: [{ required: true, message: '请选择性别', trigger: 'change' }], gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
phone: [ phone: [{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }],
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' } address: [{ message: '请输入住址', trigger: 'blur' }]
],
address: [{ message: '请输入住址', trigger: 'blur' }]
} }
/** 获取列表 */ /** 获取列表 */
@ -274,7 +267,7 @@ const getList = async () => {
isprint: queryParams.isprint || undefined, isprint: queryParams.isprint || undefined,
printTimeRange: queryParams.printTimeRange printTimeRange: queryParams.printTimeRange
}) })
list.value = data.list list.value = data.list
total.value = data.total total.value = data.total
} catch (error) { } catch (error) {
@ -293,9 +286,9 @@ const handleQuery = () => {
/** 处理身份证读卡成功事件 */ /** 处理身份证读卡成功事件 */
const handleIdCardSuccess = (cardInfo) => { const handleIdCardSuccess = (cardInfo) => {
// //
queryParams.cardId = cardInfo.idNumber; queryParams.cardId = cardInfo.idNumber
// //
handleQuery(); handleQuery()
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
@ -326,8 +319,22 @@ const handlePrint = async (row: PatientVO) => {
const userInfo = await getUserProfile() const userInfo = await getUserProfile()
const deptInfo = await InspectOrgApi.getInspectOrg(userInfo.deptId) const deptInfo = await InspectOrgApi.getInspectOrg(userInfo.deptId)
if (queryParams.hospitalNo) { if (queryParams.hospitalNo) {
console.log(queryParams.hospitalNo) if (queryParams.hospitalNo == '121526004609160793') {
await PatientApi.updatePatientOrg(row.medicalSn,deptInfo.orgid,deptInfo.orgName,queryParams.hospitalNo) shortid.value = '1001'
await PatientApi.updatePatientOrg(row.medicalSn, deptInfo.orgid, deptInfo.orgName, queryParams.hospitalNo, shortid.value)
}
if (queryParams.hospitalNo == '221526004609160793') {
shortid.value = '2001'
await PatientApi.updatePatientOrg(row.medicalSn, deptInfo.orgid, deptInfo.orgName, queryParams.hospitalNo, shortid.value)
}
} else {
ElMessageBox.alert('请选择当前机构', '提示', {
confirmButtonText: '确定',
type: 'warning',
dangerouslyUseHTMLString: true
})
return
}
await PatientApi.bindPatientProject(row.medicalSn) await PatientApi.bindPatientProject(row.medicalSn)
await PatientApi.syncinspectApplyTj(row.medicalSn) await PatientApi.syncinspectApplyTj(row.medicalSn)
await createPrint(row.medicalSn) await createPrint(row.medicalSn)
@ -338,16 +345,7 @@ const handlePrint = async (row: PatientVO) => {
await getList() await getList()
message.success('打印成功') message.success('打印成功')
// //
PatientApi.updatePatientSupplement(row.medicalSn,row.cardId) PatientApi.updatePatientSupplement(row.medicalSn, row.cardId)
}
else{
ElMessageBox.alert('请选择当前机构', '提示', {
confirmButtonText: '确定',
type: 'warning',
dangerouslyUseHTMLString: true
})
return
}
} catch (error: any) { } catch (error: any) {
console.error('打印失败:', error) console.error('打印失败:', error)
message.error(`打印失败: ${error.message || '未知错误'}`) message.error(`打印失败: ${error.message || '未知错误'}`)
@ -357,29 +355,28 @@ const handlePrint = async (row: PatientVO) => {
const createPrint = async (medicalSn) => { const createPrint = async (medicalSn) => {
try { try {
// 使SummaryApi // 使SummaryApi
const dataPrint = await SummaryApi.printInfoOfMedicalSn(medicalSn); const dataPrint = await SummaryApi.printInfoOfMedicalSn(medicalSn)
// - 使 // - 使
const hiprintTemplate = newHiprintPrintTemplate("InspectionChecklist", { const hiprintTemplate = newHiprintPrintTemplate('InspectionChecklist', {
template: template, template: template,
settingContainer: "#PrintElementOptionSetting", settingContainer: '#PrintElementOptionSetting'
}); })
// //
const options = {leftOffset: -1, topOffset: -1}; const options = { leftOffset: -1, topOffset: -1 }
// //
const ext = { const ext = {
callback: () => { callback: () => {},
},
styleHandler: () => { styleHandler: () => {
return "<style>.hiprint-printElement-text{color:black !important;}</style>"; return '<style>.hiprint-printElement-text{color:black !important;}</style>'
}, }
}; }
// //
hiprintTemplate.print(dataPrint, options, ext); hiprintTemplate.print(dataPrint, options, ext)
} catch (error: any) { } catch (error: any) {
console.error('打印导检单失败,详细错误:', error); console.error('打印导检单失败,详细错误:', error)
message.error(`打印导检单失败: ${error.message || '未知错误'}`); message.error(`打印导检单失败: ${error.message || '未知错误'}`)
} }
} }
/** 打印条形码 */ /** 打印条形码 */
@ -402,7 +399,7 @@ const handlePrintBarcode = async (row: PatientVO) => {
} }
} }
// //
if(patientInfo.barcodetime){ if (patientInfo.barcodetime) {
// //
const date = new Date(patientInfo.barcodetime) const date = new Date(patientInfo.barcodetime)
const year = date.getFullYear() const year = date.getFullYear()
@ -424,7 +421,9 @@ const handlePrintBarcode = async (row: PatientVO) => {
// //
await ElMessageBox.alert( await ElMessageBox.alert(
`<div style="margin-bottom: 10px">该条形码已于 <span style="color: #f56c6c; font-weight: bold;">${lastPrintTime}</span> 打印。</div>` + `<div style="margin-bottom: 10px">该条形码已于 <span style="color: #f56c6c; font-weight: bold;">${lastPrintTime}</span> 打印。</div>` +
(reportPrintTime ? `<div>该患者报告于 <span style="color: #f56c6c; font-weight: bold;">${reportPrintTime}</span> 打印。</div>` : ''), (reportPrintTime
? `<div>该患者报告于 <span style="color: #f56c6c; font-weight: bold;">${reportPrintTime}</span> 打印。</div>`
: ''),
'提示', '提示',
{ {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -437,16 +436,16 @@ const handlePrintBarcode = async (row: PatientVO) => {
console.log('用户确认重新打印') console.log('用户确认重新打印')
} }
} }
// //
const databarcodePrint = await PatientApi.GetbarcodeInfo(row.medicalSn) const databarcodePrint = await PatientApi.GetbarcodeInfo(row.medicalSn)
// //
if (!databarcodePrint || !databarcodePrint.barcodes || databarcodePrint.barcodes.length === 0) { if (!databarcodePrint || !databarcodePrint.barcodes || databarcodePrint.barcodes.length === 0) {
message.warning('条形码不存在,无法打印') message.warning('条形码不存在,无法打印')
return return
} }
// - // -
const baseData = { const baseData = {
patientName: databarcodePrint.name || row.pname, patientName: databarcodePrint.name || row.pname,
@ -457,11 +456,11 @@ const handlePrintBarcode = async (row: PatientVO) => {
sampleSource: '体检', sampleSource: '体检',
billingTime: databarcodePrint.examinationDate || new Date().toLocaleDateString(), billingTime: databarcodePrint.examinationDate || new Date().toLocaleDateString(),
medicalSn: row.medicalSn medicalSn: row.medicalSn
}; }
// //
const batchPrintData: any[] = []; const batchPrintData: any[] = []
// 1 // 1
batchPrintData.push({ batchPrintData.push({
...baseData, ...baseData,
@ -469,52 +468,51 @@ const handlePrintBarcode = async (row: PatientVO) => {
billingItem: '体检编号', billingItem: '体检编号',
checkTypeId: '体检', checkTypeId: '体检',
count: '1/4' // count: '1/4' //
}); })
// //
if (databarcodePrint.barcodes && databarcodePrint.barcodes.length > 0) { if (databarcodePrint.barcodes && databarcodePrint.barcodes.length > 0) {
databarcodePrint.barcodes.forEach((item, index) => { databarcodePrint.barcodes.forEach((item, index) => {
// //
let itemName = item.name || '检查项目'; let itemName = item.name || '检查项目'
let checkType = itemName; // let checkType = itemName //
// "" // ""
if (itemName === '生化') { if (itemName === '生化') {
itemName = '生化全项'; // "" itemName = '生化全项' // ""
checkType = '生化'; // "" checkType = '生化' // ""
} }
batchPrintData.push({ batchPrintData.push({
...baseData, ...baseData,
barCode: item.code, barCode: item.code,
billingItem: itemName, billingItem: itemName,
checkTypeId: checkType, checkTypeId: checkType,
count: `${index+2}/4` // count: `${index + 2}/4` //
}); })
}); })
} }
// //
const hiprintTemplate = newHiprintPrintTemplate("Barcode", { const hiprintTemplate = newHiprintPrintTemplate('Barcode', {
template: barcode, template: barcode,
settingContainer: "#BarcodePrintElementOptionSetting", settingContainer: '#BarcodePrintElementOptionSetting'
}); })
// - barcode.js // - barcode.js
const options = { const options = {
leftOffset: 0, leftOffset: 0,
topOffset: 0, topOffset: 0,
printMode: 'popup', printMode: 'popup',
paperType: 'A7', // A7 paperType: 'A7', // A7
height: 30, // 30mm height: 30, // 30mm
width: 50, // 50mm width: 50, // 50mm
paperHeader: -6, // -6mm paperHeader: -6, // -6mm
paperFooter: 85.03937007874016 // paperFooter: 85.03937007874016 //
}; }
// //
const ext = { const ext = {
callback: () => { callback: () => {},
},
styleHandler: () => { styleHandler: () => {
return `<style> return `<style>
/* 条形码打印特定样式 */ /* 条形码打印特定样式 */
@ -541,22 +539,22 @@ const handlePrintBarcode = async (row: PatientVO) => {
display: none !important; display: none !important;
} }
} }
</style>`; </style>`
}, }
}; }
// - // -
hiprintTemplate.print(batchPrintData, options, ext); hiprintTemplate.print(batchPrintData, options, ext)
// //
await PatientApi.updateBarcodeTime(row.medicalSn, new Date()) await PatientApi.updateBarcodeTime(row.medicalSn, new Date())
// //
await getList() await getList()
message.success('打印成功') message.success('打印成功')
} catch (error: any) { } catch (error: any) {
console.error('打印条形码失败,详细错误:', error); console.error('打印条形码失败,详细错误:', error)
message.error(`打印条形码失败: ${error.message || '未知错误'}`); message.error(`打印条形码失败: ${error.message || '未知错误'}`)
} }
} }
/** 状态格式化 */ /** 状态格式化 */
@ -575,21 +573,21 @@ const uploadFile = async (event: Event) => {
if (!target.files || target.files.length === 0) { if (!target.files || target.files.length === 0) {
return return
} }
const file = target.files[0] const file = target.files[0]
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) { if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) {
message.error('请上传Excel文件(.xlsx或.xls格式)') message.error('请上传Excel文件(.xlsx或.xls格式)')
return return
} }
try { try {
importLoading.value = true // true importLoading.value = true // true
fullscreenLoading.value = true // true fullscreenLoading.value = true // true
console.log('全屏加载状态已设置为:', fullscreenLoading.value) // console.log('全屏加载状态已设置为:', fullscreenLoading.value) //
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', file)
await PatientApi.uploadExcel(formData) await PatientApi.uploadExcel(formData)
message.success('导入成功') message.success('导入成功')
// //
@ -612,7 +610,7 @@ const uploadFile = async (event: Event) => {
const handleAdd = (row?: PatientVO) => { const handleAdd = (row?: PatientVO) => {
// //
dialogVisible.value = true dialogVisible.value = true
// //
if (row) { if (row) {
addForm.name = row.pname || '' addForm.name = row.pname || ''
@ -626,7 +624,7 @@ const handleAdd = (row?: PatientVO) => {
// //
const submitForm = async () => { const submitForm = async () => {
if (!addFormRef.value) return if (!addFormRef.value) return
await addFormRef.value.validate(async (valid: boolean) => { await addFormRef.value.validate(async (valid: boolean) => {
if (valid) { if (valid) {
try { try {
@ -639,16 +637,16 @@ const submitForm = async () => {
domicileaddress: addForm.address, domicileaddress: addForm.address,
birthday: addForm.birthDate ? new Date(addForm.birthDate) : undefined birthday: addForm.birthDate ? new Date(addForm.birthDate) : undefined
} }
const data=await PatientApi.insertPatinetInfo(patientData as PatientVO) const data = await PatientApi.insertPatinetInfo(patientData as PatientVO)
if(data){ if (data) {
message.success('添加成功') message.success('添加成功')
dialogVisible.value = false dialogVisible.value = false
// //
resetForm() resetForm()
// //
await getList() await getList()
}else{ } else {
message.error('患者已存在') message.error('患者已存在')
} }
} catch (error: any) { } catch (error: any) {
@ -701,12 +699,12 @@ const handleCardIdBlur = () => {
const genderCode = parseInt(cardId.charAt(14)) const genderCode = parseInt(cardId.charAt(14))
addForm.gender = genderCode % 2 === 1 ? '男' : '女' addForm.gender = genderCode % 2 === 1 ? '男' : '女'
} }
// YYYYMMDD -> YYYY-MM-DD // YYYYMMDD -> YYYY-MM-DD
const year = birthDateStr.substring(0, 4) const year = birthDateStr.substring(0, 4)
const month = birthDateStr.substring(4, 6) const month = birthDateStr.substring(4, 6)
const day = birthDateStr.substring(6, 8) const day = birthDateStr.substring(6, 8)
// //
addForm.birthDate = `${year}-${month}-${day}` addForm.birthDate = `${year}-${month}-${day}`
} catch (error: any) { } catch (error: any) {
@ -718,14 +716,13 @@ const handleCardIdBlur = () => {
} }
} }
// //
const handleGwPatientInfo = async () => { const handleGwPatientInfo = async () => {
if (!addForm.cardId) { if (!addForm.cardId) {
message.warning('请先输入身份证号') message.warning('请先输入身份证号')
return return
} }
try { try {
loading.value = true loading.value = true
// API // API
@ -752,30 +749,29 @@ const handleReadIdCard = async () => {
message.warning('正在读取身份证,请稍候...') message.warning('正在读取身份证,请稍候...')
return return
} }
idCardReading.value = true idCardReading.value = true
try { try {
// SDK // SDK
sdk.init_sdk() sdk.init_sdk()
// //
await sdk.open_device() await sdk.open_device()
message.success('读卡器连接成功') message.success('读卡器连接成功')
// //
const result = await sdk.read_card() const result = await sdk.read_card()
if (result) { if (result) {
// //
addForm.cardId = result.idNumber || '' addForm.cardId = result.idNumber || ''
addForm.name = result.name || '' addForm.name = result.name || ''
addForm.address = result.address || '' addForm.address = result.address || ''
// //
addForm.gender = result.gender || '' addForm.gender = result.gender || ''
// //
if (result.birthday) { if (result.birthday) {
addForm.birthDate = result.birthday addForm.birthDate = result.birthday
@ -783,7 +779,7 @@ const handleReadIdCard = async () => {
// //
handleCardIdBlur() handleCardIdBlur()
} }
message.success('读取身份证成功') message.success('读取身份证成功')
} else { } else {
throw new Error('读取身份证失败') throw new Error('读取身份证失败')
@ -798,7 +794,7 @@ const handleReadIdCard = async () => {
} catch (e) { } catch (e) {
console.error('断开连接失败:', e) console.error('断开连接失败:', e)
} }
idCardReading.value = false idCardReading.value = false
} }
} }
@ -827,7 +823,7 @@ const handleExport = async () => {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
dangerouslyUseHTMLString: true // 使 HTML dangerouslyUseHTMLString: true // 使 HTML
} }
) )
// //