机构短号

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 // 体检机构编码
examhosname: string // 体检机构名称
hospitalNo: string // 医院编号
shorid: string // 机构短号
}
// 患者信息 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({
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>
<div id="PrintElementOptionSetting" style="display:none;"></div>
<div id="BarcodePrintElementOptionSetting" style="display:none;"></div>
<div id="PrintElementOptionSetting" style="display: none"></div>
<div id="BarcodePrintElementOptionSetting" style="display: none"></div>
<!-- 添加全屏加载遮罩 -->
<div
v-loading.fullscreen.lock="fullscreenLoading"
element-loading-text="正在导入数据,请勿关闭页面..."
element-loading-background="rgba(0, 0, 0, 0.8)">
element-loading-background="rgba(0, 0, 0, 0.8)"
>
</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
class="-mb-15px"
@ -17,7 +18,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
ref="queryFormRef"
:inline="true"
label-width="68px"
style="width: 100%;"
style="width: 100%"
>
<el-form-item label="体检编号" prop="medicalSn">
<el-input
@ -28,12 +29,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
/>
</el-form-item>
<el-form-item label="姓名" prop="pname">
<el-input
v-model="queryParams.pname"
placeholder="请输入姓名"
clearable
class="!w-200px"
/>
<el-input v-model="queryParams.pname" placeholder="请输入姓名" clearable class="!w-200px" />
</el-form-item>
<el-form-item label="身份证号" prop="cardId">
<el-input
@ -44,10 +40,7 @@ v-loading.fullscreen.lock="fullscreenLoading"
/>
</el-form-item>
<el-form-item prop="cardId">
<IDCardReader
v-model:cardId="queryParams.cardId"
@success="handleIdCardSuccess"
/>
<IDCardReader v-model:cardId="queryParams.cardId" @success="handleIdCardSuccess" />
</el-form-item>
<el-form-item label="打印日期" prop="printTimeRange">
<el-date-picker
@ -62,13 +55,23 @@ v-loading.fullscreen.lock="fullscreenLoading"
/>
</el-form-item>
<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="0" />
</el-select>
</el-form-item>
<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="221526004609160793" />
</el-select>
@ -96,7 +99,6 @@ v-loading.fullscreen.lock="fullscreenLoading"
<Icon icon="ep:download" class="mr-5px" /> 导出Excel
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
@ -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" fixed="right" width="240px">
<template #default="scope">
<el-button
link
type="primary"
@click="handlePrint(scope.row)"
>
打印导检单
</el-button>
<el-button
link
type="primary"
@click="handlePrintBarcode(scope.row)"
>
<el-button link type="primary" @click="handlePrint(scope.row)"> 打印导检单 </el-button>
<el-button link type="primary" @click="handlePrintBarcode(scope.row)">
打印条形码
</el-button>
</template>
@ -149,26 +141,25 @@ v-loading.fullscreen.lock="fullscreenLoading"
<DepartmentForm ref="formRef" @success="getList" />
<!-- 新增信息对话框 -->
<el-dialog
v-model="dialogVisible"
title="新增信息"
width="700px"
:close-on-click-modal="false"
>
<el-form
:model="addForm"
ref="addFormRef"
label-width="100px"
:rules="addFormRules"
>
<el-dialog v-model="dialogVisible" 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-input v-model="addForm.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="身份证号" prop="cardId">
<div style="display: flex; align-items: center;">
<el-input v-model="addForm.cardId" 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 style="display: flex; align-items: center">
<el-input
v-model="addForm.cardId"
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>
</el-form-item>
<el-form-item label="出生日期" prop="birthDate">
@ -201,12 +192,12 @@ v-loading.fullscreen.lock="fullscreenLoading"
<script setup lang="ts">
import { PatientApi, type PatientVO } from '@/api/inspect/inspectpatient'
import * as SummaryApi from "@/api/summary";
import { newHiprintPrintTemplate } from "@/views/summary/utils/template-helper";
import template from "@/views/summary/print/template";
import barcode from "@/views/summary/print/barcode";
import IDCardReader from '@/components/IDCardReader.vue';
import sdk from '@/components/IDCardReader/sdk';
import * as SummaryApi from '@/api/summary'
import { newHiprintPrintTemplate } from '@/views/summary/utils/template-helper'
import template from '@/views/summary/print/template'
import barcode from '@/views/summary/print/barcode'
import IDCardReader from '@/components/IDCardReader.vue'
import sdk from '@/components/IDCardReader/sdk'
import download from '@/utils/download' //
import { ElMessageBox } from 'element-plus' // ElMessageBox
import { InspectOrgApi, InspectOrgVO } from '@/api/inspect/inspectorg/index'
@ -237,7 +228,7 @@ const queryParams = reactive({
const queryFormRef = ref() //
const fileInputRef = ref<HTMLInputElement | null>(null) //
const idCardReading = ref(false) //
const shortid = ref('')
//
const dialogVisible = ref(false)
const addFormRef = ref()
@ -255,12 +246,14 @@ const addFormRules = {
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
cardId: [
{ 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' }],
phone: [
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
],
phone: [{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }],
address: [{ message: '请输入住址', trigger: 'blur' }]
}
@ -293,9 +286,9 @@ const handleQuery = () => {
/** 处理身份证读卡成功事件 */
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 deptInfo = await InspectOrgApi.getInspectOrg(userInfo.deptId)
if (queryParams.hospitalNo) {
console.log(queryParams.hospitalNo)
await PatientApi.updatePatientOrg(row.medicalSn,deptInfo.orgid,deptInfo.orgName,queryParams.hospitalNo)
if (queryParams.hospitalNo == '121526004609160793') {
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.syncinspectApplyTj(row.medicalSn)
await createPrint(row.medicalSn)
@ -339,15 +346,6 @@ const handlePrint = async (row: PatientVO) => {
message.success('打印成功')
//
PatientApi.updatePatientSupplement(row.medicalSn, row.cardId)
}
else{
ElMessageBox.alert('请选择当前机构', '提示', {
confirmButtonText: '确定',
type: 'warning',
dangerouslyUseHTMLString: true
})
return
}
} catch (error: any) {
console.error('打印失败:', error)
message.error(`打印失败: ${error.message || '未知错误'}`)
@ -357,29 +355,28 @@ const handlePrint = async (row: PatientVO) => {
const createPrint = async (medicalSn) => {
try {
// 使SummaryApi
const dataPrint = await SummaryApi.printInfoOfMedicalSn(medicalSn);
const dataPrint = await SummaryApi.printInfoOfMedicalSn(medicalSn)
// - 使
const hiprintTemplate = newHiprintPrintTemplate("InspectionChecklist", {
const hiprintTemplate = newHiprintPrintTemplate('InspectionChecklist', {
template: template,
settingContainer: "#PrintElementOptionSetting",
});
settingContainer: '#PrintElementOptionSetting'
})
//
const options = {leftOffset: -1, topOffset: -1};
const options = { leftOffset: -1, topOffset: -1 }
//
const ext = {
callback: () => {
},
callback: () => {},
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) {
console.error('打印导检单失败,详细错误:', error);
message.error(`打印导检单失败: ${error.message || '未知错误'}`);
console.error('打印导检单失败,详细错误:', error)
message.error(`打印导检单失败: ${error.message || '未知错误'}`)
}
}
/** 打印条形码 */
@ -424,7 +421,9 @@ const handlePrintBarcode = async (row: PatientVO) => {
//
await ElMessageBox.alert(
`<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: '确定',
@ -457,10 +456,10 @@ const handlePrintBarcode = async (row: PatientVO) => {
sampleSource: '体检',
billingTime: databarcodePrint.examinationDate || new Date().toLocaleDateString(),
medicalSn: row.medicalSn
};
}
//
const batchPrintData: any[] = [];
const batchPrintData: any[] = []
// 1
batchPrintData.push({
@ -469,19 +468,19 @@ const handlePrintBarcode = async (row: PatientVO) => {
billingItem: '体检编号',
checkTypeId: '体检',
count: '1/4' //
});
})
//
if (databarcodePrint.barcodes && databarcodePrint.barcodes.length > 0) {
databarcodePrint.barcodes.forEach((item, index) => {
//
let itemName = item.name || '检查项目';
let checkType = itemName; //
let itemName = item.name || '检查项目'
let checkType = itemName //
// ""
if (itemName === '生化') {
itemName = '生化全项'; // ""
checkType = '生化'; // ""
itemName = '生化全项' // ""
checkType = '生化' // ""
}
batchPrintData.push({
@ -490,14 +489,14 @@ const handlePrintBarcode = async (row: PatientVO) => {
billingItem: itemName,
checkTypeId: checkType,
count: `${index + 2}/4` //
});
});
})
})
}
//
const hiprintTemplate = newHiprintPrintTemplate("Barcode", {
const hiprintTemplate = newHiprintPrintTemplate('Barcode', {
template: barcode,
settingContainer: "#BarcodePrintElementOptionSetting",
});
settingContainer: '#BarcodePrintElementOptionSetting'
})
// - barcode.js
const options = {
@ -509,12 +508,11 @@ const handlePrintBarcode = async (row: PatientVO) => {
width: 50, // 50mm
paperHeader: -6, // -6mm
paperFooter: 85.03937007874016 //
};
}
//
const ext = {
callback: () => {
},
callback: () => {},
styleHandler: () => {
return `<style>
/* 条形码打印特定样式 */
@ -541,12 +539,12 @@ const handlePrintBarcode = async (row: PatientVO) => {
display: none !important;
}
}
</style>`;
},
};
</style>`
}
}
// -
hiprintTemplate.print(batchPrintData, options, ext);
hiprintTemplate.print(batchPrintData, options, ext)
//
await PatientApi.updateBarcodeTime(row.medicalSn, new Date())
@ -555,8 +553,8 @@ const handlePrintBarcode = async (row: PatientVO) => {
await getList()
message.success('打印成功')
} catch (error: any) {
console.error('打印条形码失败,详细错误:', error);
message.error(`打印条形码失败: ${error.message || '未知错误'}`);
console.error('打印条形码失败,详细错误:', error)
message.error(`打印条形码失败: ${error.message || '未知错误'}`)
}
}
/** 状态格式化 */
@ -718,7 +716,6 @@ const handleCardIdBlur = () => {
}
}
//
const handleGwPatientInfo = async () => {
if (!addForm.cardId) {
@ -767,7 +764,6 @@ const handleReadIdCard = async () => {
const result = await sdk.read_card()
if (result) {
//
addForm.cardId = result.idNumber || ''
addForm.name = result.name || ''