Revert "Fix Bug #550: AI修复"

This reverts commit 16c42ca108.
This commit is contained in:
2026-05-27 08:59:07 +08:00
parent bd14563691
commit 9db5ced4e3
5432 changed files with 778638 additions and 171 deletions

View File

@@ -0,0 +1,59 @@
import request from '@/utils/request'
export function listPatient(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/encounter-list',
method: 'get',
params: query
})
}
export function listInit(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/init',
method: 'get',
params: query
})
}
export function listWesternmedicine(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/prescription-list',
method: 'get',
params: query
})
}
export function updateMedicion(prescriptionList) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-dispense',
method: 'put',
data: prescriptionList
})
}
export function prepareMedicion(data) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/prepare',
method: 'put',
data: data
})
}
export function backMedicion(prescriptionNo,notPerformedReasonEnum) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-cancel',
method: 'put',
params: {
prescriptionNo: prescriptionNo,
notPerformedReasonEnum:notPerformedReasonEnum
}
})
}
//扫码枪返回追溯码筛选
export function itemTraceNo(params) {
return request({
url: '/app-common/item-trace-no?traceNoList=' + params,
method: 'get',
})
}

View File

@@ -0,0 +1,617 @@
{
"panels": [
{
"index": 1,
"name": 2,
"paperType": "A5",
"height": 210,
"width": 148,
"paperHeader": 6,
"paperFooter": 595.2755905511812,
"printElements": [
{
"options": {
"left": 150,
"top": 16.5,
"height": 22.5,
"width": 120,
"title": "{{HOSPITAL_NAME}}医院",
"coordinateSync": false,
"widthHeightSync": false,
"fontFamily": "Microsoft YaHei",
"fontSize": 18,
"textAlign": "center",
"textContentVerticalAlign": "middle",
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 187.5,
"top": 54,
"height": 10.5,
"width": 43.5,
"title": "处方签",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 13.5,
"textAlign": "justify",
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 34.5,
"top": 76.5,
"height": 12,
"width": 171,
"title": "医保编号:",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 252,
"top": 76.5,
"height": 10.5,
"width": 163.5,
"title": "就诊类型:",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 252,
"top": 93,
"height": 12,
"width": 163.5,
"title": "费用性质",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "contractName"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 34.5,
"top": 94.5,
"height": 12,
"width": 171,
"title": "处方编号",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "prescriptionNo"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 28.5,
"top": 112.5,
"height": 9,
"width": 387,
"borderWidth": "1.5",
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
"left": 195,
"top": 121.5,
"height": 12,
"width": 63,
"title": "性别",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "genderEnum_enumText"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 294,
"top": 121.5,
"height": 12,
"width": 79.5,
"title": "年龄",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "age"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 36,
"top": 123,
"height": 12,
"width": 133.5,
"title": "姓名",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "patientName"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 36,
"top": 141,
"height": 12,
"width": 192,
"title": "门诊号",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "encounterId"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 295.5,
"top": 142.5,
"height": 12,
"width": 124.5,
"title": "科室",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "organizationName"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 36,
"top": 160.5,
"height": 12,
"width": 384,
"title": "临床诊断",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "conditionName"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 36,
"top": 178.5,
"height": 12,
"width": 124.5,
"title": "电话",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "phone"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 228,
"top": 178.5,
"height": 12,
"width": 189,
"title": "开具日期",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "reqAuthoredTime"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 30,
"top": 195,
"height": 9,
"width": 387,
"borderWidth": "1.5",
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
"left": 30,
"top": 201,
"height": 13.5,
"width": 19.5,
"title": "Rp",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 9,
"fontWeight": "500",
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 25.5,
"top": 225,
"height": 229.5,
"width": 381,
"field": "prescriptionList",
"coordinateSync": false,
"widthHeightSync": false,
"tableBorder": "noBorder",
"tableHeaderBorder": "noBorder",
"tableHeaderCellBorder": "noBorder",
"tableHeaderBackground": "#ffffff",
"tableBodyRowBorder": "noBorder",
"tableBodyCellBorder": "noBorder",
"tableFooterBorder": "noBorder",
"tableFooterCellBorder": "noBorder",
"lHeight": 180,
"groupFieldsFormatter": "function(type,options,data){ return ['medicineName'] }",
"tableBodyRowHeight": 15,
"columns": [
[
{
"title": "名称",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '用法用量'; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 86.5148548770295,
"field": "medicineName",
"checked": true,
"columnId": "medicineName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "规格",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>'+ '每次:' + row.dose + row.doseUnitCode_dictText + ' ' + row.methodCode_dictText; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 87.49337048145199,
"field": "totalVolume",
"checked": true,
"columnId": "totalVolume",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "单价",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 42.00221340893656,
"field": "unitPrice",
"checked": true,
"columnId": "unitPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "数量",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + ' ' + row.unitCode_dictText + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 56.015045170547694,
"field": "quantity",
"checked": true,
"columnId": "quantity",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "金额",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 52.006536852055035,
"field": "totalPrice",
"checked": true,
"columnId": "totalPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "等级",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + row.rateCode_dictText }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 56.96797920997919,
"field": "contractName",
"checked": true,
"columnId": "contractName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "等级",
"width": 79.2099792099792,
"checked": false,
"fixed": false,
"rowspan": 1,
"colspan": 1
}
]
]
},
"printElementType": {
"title": "表格",
"type": "table",
"editable": true,
"columnDisplayEditable": true,
"columnDisplayIndexEditable": true,
"columnTitleEditable": true,
"columnResizable": true,
"columnAlignEditable": true,
"isEnableEditField": true,
"isEnableContextMenu": true,
"isEnableInsertRow": true,
"isEnableDeleteRow": true,
"isEnableInsertColumn": true,
"isEnableDeleteColumn": true,
"isEnableMergeCell": true
}
},
{
"options": {
"left": 30,
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "医师",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "doctor"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 126,
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "发药:高艳敏",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 228,
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "划价:张思怡",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 324,
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "调配:宋丹丹",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 30,
"top": 540,
"height": 9,
"width": 387,
"borderWidth": "1.5",
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
"left": 30,
"top": 547.5,
"height": 9.75,
"width": 120,
"title": "注1.本处方当日作废"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 300,
"top": 553.5,
"height": 9.75,
"width": 120,
"title": "总金额",
"field": "medTotalAmount",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 48,
"top": 567,
"height": 9.75,
"width": 120,
"title": "2.延长处方用量时间原因"
},
"printElementType": {
"title": "文本",
"type": "text"
}
}
],
"paperNumberDisabled": true,
"paperNumberContinue": true,
"overPrintOptions": {
"content": "",
"opacity": 0.7,
"type": 1
},
"watermarkOptions": {
"content": "",
"fillStyle": "rgba(184, 184, 184, 0.3)",
"fontSize": "14px",
"rotate": 25,
"width": 200,
"height": 200,
"timestamp": false,
"format": "YYYY-MM-DD HH:mm"
},
"panelLayoutOptions": {
"layoutType": "column",
"layoutRowGap": 0,
"layoutColumnGap": 0
}
}
]
}

View File

@@ -0,0 +1,274 @@
<template>
<div class="inHospitalDispensing-container">
<div class="inHospitalDispensing-container-top">
<el-space>
<el-radio-group v-model="searchForm.status" @change="search">
<el-radio-button label="待发药" value="1" />
<el-radio-button label="待退药" value="2" />
</el-radio-group>
<el-select v-model="searchForm.window" placeholder="窗口" style="width: 240px">
<el-option key="0" label="住院西药房" value="0"/>
<el-option key="1" label="住院东药房" value="1"/>
<el-option key="2" label="住院北药房" value="2"/>
<el-option key="3" label="住院南药房" value="3"/>
</el-select>
<el-select v-model="searchForm.type" placeholder="医嘱类型" style="width: 240px">
<el-option key="0" label="全部" value="0"/>
<el-option key="1" label="长期" value="1"/>
<el-option key="2" label="临时" value="2"/>
</el-select>
<el-date-picker
v-model="searchForm.dateRange"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-space>
</div>
<div class="inHospitalDispensing-container-bottom">
<div class="inHospitalDispensing-container-bottom-left">
<el-tree
ref="treeRef"
style="max-width: 600px"
default-expand-all
:data="treedata"
show-checkbox
node-key="id"
@node-click="handleNodeClick"
/>
</div>
<div class="inHospitalDispensing-container-bottom-right">
<div class="inHospitalDispensing-container-bottom-right-top">
<el-radio-group v-model="isAll">
<el-radio-button label="汇总" value="1" />
<el-radio-button label="明细" value="2" />
</el-radio-group>
<el-button type="primary" @click="handleSearch">发药</el-button>
</div>
<div class="inHospitalDispensing-container-bottom-right-bottom">
<el-table :data="tableData" style="width: 100% " height="100%" v-if="isAll==1">
<el-table-column prop="drugGoodsName" label="名称" width="180" />
<el-table-column prop="drugSpec" label="规格" width="180" />
<el-table-column prop="drugSpec" label="总量" width="180" />
<el-table-column prop="stockPlaceName" label="位置" width="180" />
<el-table-column prop="manufactureName" label="厂家" width="180" />
<el-table-column prop="drugGoodsCode" label="编码" width="180" />
<el-table-column prop="drugFormName" label="剂型" width="180" />
<el-table-column prop="packageNum" label="包装数量" width="180" />
<el-table-column prop="maxUnit" label="包装单位" width="180" />
</el-table>
<el-table :data="tableDataDetails" style="width: 100%" height="100%" v-if="isAll==2">
<el-table-column prop="receiveOrgName" label="科室" width="180" />
<el-table-column prop="patBed" label="床号" width="180" />
<el-table-column prop="patName" label="姓名" width="180" />
<el-table-column prop="drugGoodsName" label="名称" width="180" />
<el-table-column prop="drugSpec" label="规格" width="180" />
<el-table-column prop="applyNumStr" label="数量" width="180" />
<el-table-column prop="manufactureName" label="厂家" width="180" />
<el-table-column prop="dosageAndUnit" label="每次剂量" width="180" />
<el-table-column prop="usageName" label="用法" width="180" />
<el-table-column prop="salePrice" label="单价" width="180" />
<el-table-column prop="salePriceAmount" label="金额" width="180" />
<el-table-column prop="stockPlaceName" label="位置" width="180" />
<el-table-column prop="drugGoodsCode" label="编码" width="180" />
<el-table-column prop="drugFormName" label="剂型" width="180" />
<el-table-column prop="packageNum" label="包装数量" width="180" />
<el-table-column prop="maxUnit" label="包装单位" width="180" />
<el-table-column prop="purchasePrice" label="购入价" width="180" />
</el-table>
</div>
</div>
</div>
</div>
</template>
<script setup lang='ts'>
import {onBeforeMount, onMounted, reactive, ref} from 'vue'
// const { proxy } = getCurrentInstance();
const emits = defineEmits([])
const props = defineProps({
})
const state = reactive({
})
// 1111
const searchForm=reactive({
status:'1',
type: '0',
dateRange: [new Date(), new Date()],
window: '0',
})
const handleSearch = () => {
console.log(searchForm)
treedata.value = [{
label: '内科',
id: 1,
children: [
{
label: '唐僧',
id: 11
},
],
}]
tableDataDetails.value=[ {
patName: '唐僧',
patBed: '1-3',
receiveOrgName: '心内科',
drugGoodsName: '维生素E软胶囊',
drugSpec: '50mg*60粒/瓶',
applyNumStr: '1瓶',
manufactureName: '浙江医药股份有限公司新昌制药厂',
dosage: '50',
dosageUnitName: 'mg',
usageName: '口服',
salePrice: 19,
salePriceAmount: 19.0000,
stockPlaceName: null,
drugGoodsCode: '331408',
drugFormName: '软胶囊',
packageNum: 60,
maxUnit: '瓶',
purchasePrice: 19,
}
]
tableData.value=[ {
patName: '唐僧',
patBed: '1-3',
receiveOrgName: '心内科',
drugGoodsName: '维生素E软胶囊',
drugSpec: '50mg*60粒/瓶',
applyNumStr: '1瓶',
manufactureName: '浙江医药股份有限公司新昌制药厂',
dosage: '50',
dosageUnitName: 'mg',
usageName: '口服',
salePrice: 19,
salePriceAmount: 19.0000,
stockPlaceName: null,
drugGoodsCode: '331408',
drugFormName: '软胶囊',
packageNum: 60,
maxUnit: '瓶',
purchasePrice: 19,
}, {
patName: '唐僧',
patBed: '1-3',
receiveOrgName: '心内科',
drugGoodsName: '5%葡萄糖注射液(直立式聚丙烯)',
drugSpec: '5%*50ml/瓶',
applyNumStr: '2瓶',
manufactureName: '湖南科伦制药有限公司',
dosage: '50',
dosageUnitName: 'ml',
usageName: '静脉注射',
salePrice: 2,
salePriceAmount: 2.0000,
stockPlaceName: null,
drugGoodsCode: '331243',
drugFormName: '注射液',
packageNum: 1,
maxUnit: '瓶',
purchasePrice: 2,
}
]
}
// 2222
const treedata = ref([
{
label: '内科',
id:1,
children: [
{
label: '唐僧',
id: 11
},
],
},
])
const treeRef = ref()
const handleNodeClick=(data)=>{
console.log(data)
treeRef.value.setCheckedKeys([data.id])
}
// 3333
const isAll = ref('1')
const tableData = ref([
{
date: '2023-05-01',
name: '药品1',
age: 10,
gender: '男',
content: '维生素B12注射液【1ml0.5mg*1】 ',
},
])
const tableDataDetails = ref([
{
date: '2023-05-01',
name: '药品1',
age: 10,
gender: '男',
content: '维生素B12注射液【1ml0.5mg*1】 ',
},
])
onBeforeMount(() => {
})
onMounted(() => {
})
defineExpose({ state })
</script>
<style lang="scss" scoped>
.inHospitalDispensing-container{
height: 100%;
width: 100%;
padding: 20px;
display: flex;
flex-direction: column;
.inHospitalDispensing-container-top{
height: 44px;
width: 100%;
padding: 0px 16px;
flex:none;
align-items: center;
display: flex;
}
.inHospitalDispensing-container-bottom{
width: 100%;
height: 300px;
flex:auto;
display: flex;
.inHospitalDispensing-container-bottom-left{
width: 300px;
flex:none
}
.inHospitalDispensing-container-bottom-right{
flex:auto;
width: calc(100% - 300px);
padding: 0px 16px;
.inHospitalDispensing-container-bottom-right-top{
height: 44px;
width: calc(100% - 32px);
padding: 0px 16px;
align-items: center;
flex:none;
display: flex;
justify-content: space-between;
}
.inHospitalDispensing-container-bottom-right-bottom{
flex:auto;
height: 100%;
width: 100%;
background-color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,330 @@
<template>
<div
class="app-container"
style="border: 1px solid #e0e0e0; border-radius: 4px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1)"
>
<el-row :gutter="10" justify="end" align="middle" style="margin-bottom: 10px">
<el-button type="danger" plain icon="Refresh" @click="handleSendDrug" :disabled="!encounterId"
>发药</el-button
>
<el-button type="primary" plain icon="Download" @click="handleExport" :disabled="!encounterId"
>导出</el-button
>
<el-button
type="success"
plain
icon="Refresh"
@click="handleDispense"
:disabled="!encounterId"
>退药</el-button
>
</el-row>
<div class="tableContainer">
<el-table
v-loading="loading"
:data="displayTableData"
style="width: 100%; height: 70vh"
border
stripe
:header-cell-style="headerCellStyle"
:row-style="rowStyle"
:cell-style="{ textAlign: 'center' }"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- 基础信息 -->
<el-table-column prop="itemName" label="项目名称" min-width="120" />
<el-table-column prop="totalVolume" label="规格" min-width="100" />
<el-table-column prop="locationName" label="发放药房" min-width="100" />
<el-table-column prop="lotNumber" label="批次号" min-width="100" />
<el-table-column prop="departmentName" label="科室" min-width="100" />
<el-table-column prop="doctorName" label="开单医生" min-width="100" />
<el-table-column prop="dispenseDoctorName" label="发药医生" min-width="100" />
<el-table-column prop="itemType_dictText" label="项目类型" min-width="100">
<template #default="scope">
{{ scope.row.itemType_dictText || scope.row.itemType || '-' }}
</template>
</el-table-column>
<el-table-column prop="statusEnum_enumText" label="发药状态" min-width="100">
<template #default="scope">
{{ scope.row.statusEnum_enumText || scope.row.statusEnum || '-' }}
</template>
</el-table-column>
<el-table-column prop="conditionName" label="诊断名称" min-width="100" />
<el-table-column prop="prescriptionNo" label="处方号" min-width="120" />
<!-- 用药信息 -->
<el-table-column prop="dose" label="单次剂量" min-width="100" />
<el-table-column prop="rateCode_dictText" label="用药频次" min-width="100">
<template #default="scope">
{{ scope.row.rateCode_dictText || scope.row.rateCode || '-' }}
</template>
</el-table-column>
<el-table-column prop="methodCode_dictText" label="用法" min-width="100">
<template #default="scope">
{{ scope.row.methodCode_dictText || scope.row.methodCode || '-' }}
</template>
</el-table-column>
<el-table-column prop="doseUnitCode_dictText" label="剂量单位" min-width="100">
<template #default="scope">
{{ scope.row.doseUnitCode_dictText || scope.row.doseUnitCode || '-' }}
</template>
</el-table-column>
<el-table-column prop="unitCode_dictText" label="单位" min-width="80">
<template #default="scope">
{{ scope.row.unitCode_dictText || scope.row.unitCode || '-' }}
</template>
</el-table-column>
<el-table-column prop="dispensePerQuantity" label="单次发药数" min-width="100" />
<el-table-column prop="dispensePerDuration" label="每次发药供应天数" min-width="150" />
<el-table-column prop="quantity" label="数量" min-width="80" />
<el-table-column prop="unitPrice" label="单价" min-width="80" />
<el-table-column prop="totalPrice" label="金额" min-width="80" />
<!-- 其他信息 -->
<el-table-column prop="manufacturerText" label="生产厂家" min-width="150" />
<el-table-column prop="traceNo" label="追溯码" min-width="120" />
<el-table-column prop="encounterBusNo" label="就诊NO" min-width="120" />
<el-table-column prop="reqAuthoredTime" label="开具日期" min-width="150">
<template #default="scope">
{{ formatDate(scope.row.reqAuthoredTime) }}
</template>
</el-table-column>
<el-table-column prop="skinTestFlag" label="皮试标志" min-width="100">
<template #default="scope">
{{ scope.row.skinTestFlag === 1 ? '是' : scope.row.skinTestFlag === 0 ? '否' : '-' }}
</template>
</el-table-column>
<el-table-column prop="tcmFlag" label="中药标识" min-width="100">
<template #default="scope">
{{ scope.row.tcmFlag === 1 ? '是' : scope.row.tcmFlag === 0 ? '否' : '-' }}
</template>
</el-table-column>
<el-table-column prop="itemTable" label="所在表" min-width="100" />
</el-table>
</div>
</div>
</template>
<script setup>
import {computed, getCurrentInstance, ref, watch} from 'vue';
import {ElMessage} from 'element-plus';
import {totalReturnDrug, totalSendDrug} from './api';
const { proxy } = getCurrentInstance();
const emit = defineEmits(['call-medication-summary-detail']);
// 定义props接收父组件传递的表格数据和选中的ID
const props = defineProps({
tableData: {
type: Array,
default: () => [],
},
encounterId: {
type: String,
default: '',
},
});
// 定义响应式数据
const selectedRows = ref([]);
const loading = ref(false);
// 计算属性直接使用props.tableData并添加日志用于调试
const displayTableData = computed(() => {
return props.tableData;
});
// 处理表格选择变化
function handleSelectionChange(rows) {
selectedRows.value = rows;
}
// 格式化日期
function formatDate(dateTime) {
if (!dateTime) return '-';
const date = new Date(dateTime);
if (isNaN(date.getTime())) return '-';
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 监听props.tableData变化当外部数据变化时清空选中状态
watch(
() => props.tableData,
() => {
selectedRows.value = [];
}
);
// 表格样式
const headerCellStyle = {
backgroundColor: '#f5f7fa',
color: '#333',
fontWeight: 'bold',
height: '48px',
textAlign: 'center',
lineHeight: '48px',
padding: '0',
fontSize: '14px',
};
const rowStyle = {
height: '40px',
};
// 发药功能
const handleSendDrug = () => {
if (!props.encounterId) {
ElMessage.warning('请先选择患者');
return;
}
if (selectedRows.value.length === 0) {
ElMessage.warning('请先选择需要发药的数据');
return;
}
let data = [];
selectedRows.value.forEach((row) => {
data.push({
dispenseId: row.dispenseId,
});
});
loading.value = true;
proxy.$modal
.confirm('确定要发药吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const response = await totalSendDrug(data);
if (response.code === 200) {
ElMessage.success('发药成功');
loading.value = false;
}
})
.catch(() => {
loading.value = false;
});
};
// 导出功能
const handleExport = () => {
if (!props.encounterId) {
ElMessage.warning('请先选择患者');
return;
}
if (displayTableData.value.length === 0) {
ElMessage.warning('暂无数据可导出');
return;
}
if (selectedRows.value.length === 0) {
ElMessage.warning('请先选择要导出的数据');
return;
}
// 这里可以实现导出逻辑
console.log('导出数据:', selectedRows.value);
ElMessage.success('导出成功');
};
// 退药功能
const handleDispense = () => {
if (!props.encounterId) {
ElMessage.warning('请先选择患者');
return;
}
if (selectedRows.value.length === 0) {
ElMessage.warning('请先选择需要退药的数据');
return;
}
let data = [];
selectedRows.value.forEach((row) => {
data.push({
dispenseId: row.dispenseId,
});
});
loading.value = true;
proxy.$modal
.confirm('确定要退药吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const response = await totalReturnDrug(data);
emit('call-medication-summary-detail', props.encounterId);
console.log(response);
if (response.code === 200) {
ElMessage.success('退药成功');
loading.value = false;
// 通知父组件刷新明细数据
emit('call-medication-summary-detail', props.encounterId);
} else {
console.log(response.message);
ElMessage.error('退药失败');
}
})
.catch(() => {
loading.value = false;
});
};
// 定义暴露给父组件的数据和方法
defineExpose({
selectedRows,
});
</script>
<style lang="scss" scoped>
.medicationTableDetail {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
.buttonGroup {
display: flex;
justify-content: flex-end;
padding: 10px 0;
gap: 10px;
margin-right: 20px;
:deep(.el-button) {
padding: 6px 16px;
font-size: 14px;
}
}
.tableContainer {
flex: 1;
overflow-x: auto; /* 启用横向滚动 */
overflow-y: auto; /* 同时启用纵向滚动 */
border: 1px solid #e0e0e0;
border-radius: 4px;
:deep(.el-table) {
height: 100%;
.el-table__header {
th {
background-color: #f5f7fa;
height: 48px !important;
line-height: 48px !important;
padding: 0 !important;
}
}
.el-table__row:hover {
background-color: #f5f7fa;
}
}
}
}
</style>

View File

@@ -0,0 +1,292 @@
<template>
<div class="med-summary-container">
<div style="width: 40%">
<el-card style="height: 80vh">
<template #header>
{{ '汇总单' }}
</template>
<div style="display: flex; justify-content: space-between; margin-bottom: 10px">
<div>
<el-input style="width: 250px" v-model="queryParams.searchKey" placeholder="单据号">
<template #append>
<el-button icon="Search" @click="getSummaryList" />
</template>
</el-input>
<el-select
placeholder="发放状态"
style="width: 250px; margin-left: 10px"
v-model="queryParams.statusEnum"
@change="getSummaryList"
>
<el-option
v-for="item in statusEnumOptions"
:key="item.value"
:value="item.value"
:label="item.label"
/>
</el-select>
</div>
</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 10px">
<div>
<el-date-picker
v-model="queryParams.applyTime"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 400px"
value-format="YYYY-MM-DD"
:clearable="false"
/>
<el-button type="primary" @click="getSummaryList" style="margin-left: 10px">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
</div>
<div>
<el-button type="primary" plain @click="handleSend">批量发药</el-button>
<el-button type="warning" plain>批量作废</el-button>
</div>
</div>
<el-table
:data="summaryList"
max-height="85vh"
border
ref="summaryTableRef"
highlight-current-row
@row-click="getDetails"
>
<el-table-column type="selection" align="center" width="50" />
<el-table-column prop="busNo" label="单据号" align="center" width="150" />
<el-table-column prop="applicantName" label="申请人" align="center" width="100" />
<el-table-column prop="locationName" label="发药药房" align="center" />
<el-table-column prop="statusEnum_enumText" label="状态" align="center">
<template #default="scope">
{{ formatSummaryStatusText(scope.row) }}
</template>
</el-table-column>
<el-table-column prop="applyTime" label="汇总日期" align="center" width="140">
<template #default="scope">
{{ scope.row.applyTime ? parseTime(scope.row.applyTime, '{y}-{m}-{d}') : '-' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button type="primary" link @click="handleSend(scope.row)">发药</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
<!-- <el-row :gutter="10" justify="end" align="middle" style="margin-bottom: 10px">
<el-button type="danger" plain icon="Refresh" @click="handleSendDrug" :disabled="!busNo">
发药
</el-button>
<el-button type="primary" plain icon="Download" @click="handleExport" :disabled="!busNo">
导出
</el-button>
</el-row> -->
<div style="width: 59%">
<el-card style="height: 80vh">
<template #header>
{{ '汇总单详情' }}
</template>
<el-table
:data="summaryDetailsData"
style="width: 100%"
border
v-loading="loading"
:cell-style="{ textAlign: 'center' }"
>
<el-table-column type="index" label="序号" min-width="50" />
<el-table-column prop="itemName" label="项目名称" min-width="150">
<template #default="scope">
{{ scope.row.itemName || '-' }}
</template>
</el-table-column>
<el-table-column prop="totalVolume" label="规格" min-width="120">
<template #default="scope">
{{ scope.row.totalVolume || '-' }}
</template>
</el-table-column>
<el-table-column prop="lotNumber" label="批次号" min-width="100">
<template #default="scope">
{{ scope.row.lotNumber || '-' }}
</template>
</el-table-column>
<el-table-column prop="quantity" label="数量" min-width="80" align="center">
<template #default="scope">
{{ scope.row.itemQuantity + ' ' + scope.row.minUnitCode_dictText }}
</template>
</el-table-column>
<el-table-column prop="categoryCode_dictText" label="药品类型" min-width="100">
<template #default="scope">
{{ scope.row.categoryCode_dictText || '-' }}
</template>
</el-table-column>
<el-table-column
prop="manufacturerText"
label="生产厂家"
min-width="120"
:show-overflow-tooltip="true"
>
<template #default="scope">
{{ scope.row.manufacturerText || '-' }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</div>
</template>
<script setup>
import {getCurrentInstance, ref} from 'vue';
import {getFromSummaryDetails, getFromSummaryInit, getFromSummaryList, totalSendDrug,} from './api.js';
const { proxy } = getCurrentInstance();
/** 发药汇总单状态展示(汇总申请→已提交,发药→已发药) */
const SUMMARY_STATUS_DISPLAY = {
2: '已提交',
4: '已发药',
};
const LEGACY_SUMMARY_STATUS_TEXT = {
待配药: '已提交',
已发放: '已发药',
};
function formatSummaryStatusText(row) {
const code = Number(row?.statusEnum);
if (SUMMARY_STATUS_DISPLAY[code]) {
return SUMMARY_STATUS_DISPLAY[code];
}
return LEGACY_SUMMARY_STATUS_TEXT[row?.statusEnum_enumText] || row?.statusEnum_enumText || '-';
}
function mapSummaryStatusOptions(options = []) {
return options.map((item) => ({
...item,
label: SUMMARY_STATUS_DISPLAY[item.value] ?? LEGACY_SUMMARY_STATUS_TEXT[item.label] ?? item.label,
}));
}
const statusEnumOptions = ref([]);
const summaryList = ref([]);
const queryParams = ref({
applyTime: [
proxy.formatDateStr(new Date().setMonth(new Date().getMonth() - 1), 'YYYY-MM-DD'),
proxy.formatDateStr(new Date(), 'YYYY-MM-DD'),
],
});
// 定义组件属性
const props = defineProps({
tableData: {
type: Array,
default: () => [],
},
selectedId: {
type: String,
default: '',
},
busNo: {
type: String,
default: '',
},
});
const selectedRows = ref([]);
const summaryDetailsData = ref([]);
// 定义loading状态
const loading = ref(false);
getSummaryList();
// 获取汇总单信息
function getSummaryList() {
queryParams.value.applyTimeSTime = queryParams.value.applyTime[0] + ' 00:00:00';
queryParams.value.applyTimeETime = queryParams.value.applyTime[1] + ' 23:59:59';
getFromSummaryList(queryParams.value).then((res) => {
summaryList.value = res.data.records;
});
}
// 重置查询条件
function resetQuery() {
queryParams.value.applyTime = [
proxy.formatDateStr(new Date().setMonth(new Date().getMonth() - 1), 'YYYY-MM-DD'),
proxy.formatDateStr(new Date(), 'YYYY-MM-DD'),
];
queryParams.value.searchKey = '';
queryParams.value.statusEnum = '';
getSummaryList();
}
function getDetails(row) {
loading.value = true;
getFromSummaryDetails({ summaryNo: row.busNo }).then((res) => {
summaryDetailsData.value = res.data;
loading.value = false;
});
}
// 发药
function handleSend(row) {
let sendList = [];
if (row.busNo) {
sendList.push(row.busNo);
} else {
proxy.$refs['summaryTableRef'].getSelectionRows().forEach((item) => {
sendList.push(item.busNo);
});
}
console.log(sendList);
totalSendDrug(sendList).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('操作成功');
getSummaryList();
}
});
}
// 获取发药状态
const getStatusOption = async () => {
try {
const res = await getFromSummaryInit();
statusEnumOptions.value = mapSummaryStatusOptions(res.data.dispenseStatusOptions);
} catch (error) {}
};
getStatusOption();
// 定义暴露给父组件的数据和方法
defineExpose({
selectedRows,
});
</script>
<style lang="scss" scoped>
.med-summary-container {
height: 100%;
display: flex;
justify-content: space-between;
}
.medicationTableDetail {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
.buttonGroup {
display: flex;
justify-content: flex-end;
padding: 10px 0;
gap: 10px;
margin-right: 20px;
:deep(.el-button) {
padding: 6px 16px;
font-size: 14px;
}
}
}
</style>

View File

@@ -0,0 +1,187 @@
<template>
<div
class="app-container"
style="border: 1px solid #e0e0e0; border-radius: 4px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1)"
>
<el-row :gutter="10" justify="end" align="middle" style="margin-bottom: 10px">
<el-button type="danger" plain icon="Refresh" @click="handleSendDrug" :disabled="!busNo">
发药
</el-button>
<el-button type="primary" plain icon="Download" @click="handleExport" :disabled="!busNo">
导出
</el-button>
</el-row>
<div class="tableContainer">
<el-table
:data="tableData"
style="width: 100%; height: 70vh"
:header-cell-style="headerCellStyle"
:row-style="rowStyle"
:cell-style="{ textAlign: 'center' }"
>
<el-table-column prop="currentIndex" label="序号" min-width="60" />
<el-table-column prop="itemName" label="项目名称" min-width="150">
<template #default="scope">
{{ scope.row.itemName || '-' }}
</template>
</el-table-column>
<el-table-column prop="totalVolume" label="规格" min-width="120">
<template #default="scope">
{{ scope.row.totalVolume || '-' }}
</template>
</el-table-column>
<el-table-column prop="lotNumber" label="批次号" min-width="100">
<template #default="scope">
{{ scope.row.lotNumber || '-' }}
</template>
</el-table-column>
<el-table-column prop="quantity" label="数量" min-width="80" align="center">
<template #default="scope">
<el-tag v-if="scope.row.quantity" size="mini">
{{ scope.row.quantity }}
</el-tag>
<el-tag v-if="scope.row.maxUnitCode_dictText" size="mini" type="danger">
{{ scope.row.maxUnitCode_dictText }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="sourceLocationName" label="发放地点" min-width="100">
<template #default="scope">
{{ scope.row.sourceLocationName || '-' }}
</template>
</el-table-column>
<el-table-column prop="manufacturerText" label="生产厂家" min-width="120">
<template #default="scope">
{{ scope.row.manufacturerText || '-' }}
</template>
</el-table-column>
<el-table-column prop="busNo" label="单据号" min-width="150">
<template #default="scope">
{{ scope.row.busNo || '-' }}
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script setup>
import {getCurrentInstance, ref} from 'vue';
import {ElMessage} from 'element-plus';
import {totalSendDrug} from './api.js';
const { proxy } = getCurrentInstance();
// 定义组件属性
const props = defineProps({
tableData: {
type: Array,
default: () => [],
},
selectedId: {
type: String,
default: '',
},
busNo: {
type: String,
default: '',
},
});
// 定义响应式数据
const selectedRows = ref([]);
// 定义loading状态
const loading = ref(false);
// 表格样式
const headerCellStyle = {
backgroundColor: '#f5f7fa',
color: '#333',
fontWeight: 'bold',
height: '48px',
textAlign: 'center',
lineHeight: '48px',
padding: '0',
fontSize: '14px',
};
const rowStyle = {
height: '40px',
};
// 发药功能
const handleSendDrug = () => {
if (!props.busNo) {
ElMessage.warning('请先选择单据号');
return;
}
let data = [{ busNo: props.busNo }];
loading.value = true;
proxy.$modal
.confirm('确定要发药吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const response = await totalSendDrug(data);
if (response.code === 200) {
ElMessage.success('发药成功');
loading.value = false;
}
})
.catch(() => {
loading.value = false;
});
};
// 定义暴露给父组件的数据和方法
defineExpose({
selectedRows,
});
</script>
<style lang="scss" scoped>
.medicationTableDetail {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
.buttonGroup {
display: flex;
justify-content: flex-end;
padding: 10px 0;
gap: 10px;
margin-right: 20px;
:deep(.el-button) {
padding: 6px 16px;
font-size: 14px;
}
}
.tableContainer {
flex: 1;
overflow: hidden;
border: 1px solid #e0e0e0;
border-radius: 4px;
:deep(.el-table) {
height: 100%;
.el-table__header {
th {
background-color: #f5f7fa;
height: 48px !important;
line-height: 48px !important;
padding: 0 !important;
}
}
.el-table__row:hover {
background-color: #f5f7fa;
}
}
}
}
</style>

View File

@@ -0,0 +1,481 @@
<template>
<div class="container">
<!-- 左侧患者列表 -->
<el-card class="patient-list">
<template #header>
<div class="card-header">
<span>患者列表</span>
</div>
</template>
<div style="width: 100%">
<el-input
v-model="queryParams.searchKey"
placeholder="搜索患者"
style="width: 48%; margin-bottom: 10px; margin-right: 15px"
@keyup.enter="getEncounterList"
>
<template #append>
<el-button icon="Search" @click="getEncounterList" />
</template>
</el-input>
<el-select
v-model="queryParams.refundEnum"
style="width: 48%; margin-bottom: 10px"
placeholder="收费状态"
@change="getEncounterList"
>
<el-option
v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-date-picker
v-model="dateRange"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 85%; margin-bottom: 10px"
value-format="YYYY-MM-DD"
placement="bottom"
@change="getEncounterList"
/>
<el-button
type="primary"
@click="getEncounterList"
style="margin-bottom: 10px; margin-left: 18px"
>
搜索
</el-button>
</div>
<el-table
:data="encounterList"
border
style="width: 100%"
height="calc(100vh - 300px)"
highlight-current-row
@cell-click="handleGetReturnDrugList"
>
<el-table-column
prop="patientName"
align="center"
label="姓名"
width="130"
show-overflow-tooltip
/>
<el-table-column
prop="genderEnum_enumText"
align="center"
label="性别"
show-overflow-tooltip
/>
<el-table-column align="center" width="140" label="就诊日期" show-overflow-tooltip>
<template #default="scope">
{{
scope.row.receptionTime ? formatDateStr(scope.row.receptionTime, 'YYYY-MM-DD') : '-'
}}
</template>
</el-table-column>
<!-- <el-table-column label="状态" align="center" prop="refundEnum_enumText" /> -->
</el-table>
</el-card>
<!-- 右侧退药列表 -->
<el-card class="refund-list">
<template #header>
<div class="card-header">
<span>退药单</span>
<!-- <div v-if="selectedPatient">
<span class="patient-info">{{ selectedPatient.name }}</span>
<el-tag type="info">{{ selectedPatient.visitNo }}</el-tag>
</div> -->
</div>
</template>
<el-button
type="primary"
:disabled="!selectedMedicines.length"
@click="handleReturnDrug(undefined)"
style="margin-bottom: 10px"
>
确认退药
</el-button>
<el-button type="primary" @click="handleScan()" style="margin-bottom: 10px"> 扫码 </el-button>
<el-table
ref="returnDrugRef"
:data="returDrugList"
style="width: 100%"
height="calc(100vh - 300px)"
border
@select="handleSelection"
@selection-change="handelSelectRows"
:span-method="handelSpanMethod"
class="no-hover-table"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column prop="itemName" label="药品名称" show-overflow-tooltip align="center" />
<el-table-column
prop="totalPrice"
label="总价"
width="100"
align="right"
header-align="center"
>
<template #default="scope">
{{ scope.row.totalPrice ? scope.row.totalPrice.toFixed(2) + ' 元' : '-' }}
</template>
</el-table-column>
<el-table-column prop="lotNumber" label="批号" width="180" align="center" />
<el-table-column prop="traceNo" label="追溯码" width="180" align="center">
<template #default="scope">
<el-input v-model="scope.row.traceNo" placeholder="请输入追溯码" />
</template>
</el-table-column>
<el-table-column prop="reqStatus_enumText" label="退药状态" width="100" align="center">
<template #default="scope">
{{ scope.row.refundEnum_enumText }}
</template>
</el-table-column>
<el-table-column prop="waitingQuantity" label="退药数量" width="100" align="center">
<template #default="scope">
<span>{{
scope.row.quantity
? Math.abs(scope.row.quantity) + ' ' + scope.row.unitCode_dictText
: '0' + ' ' + scope.row.unitCode_dictText
}}</span>
</template>
</el-table-column>
<el-table-column prop="doctorName" label="开单医生" align="center" width="180" />
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="scope">
<el-popconfirm
width="150"
hide-after="10"
title="操作确认"
placement="top-start"
@confirm="handleReturnDrug(scope.row)"
>
<template #reference>
<el-button type="primary" link :disabled="scope.row.refundEnum != 16">
退药
</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<!-- 底部操作栏 -->
<div class="footer">
<div class="statistics">
<span>已选 {{ selectedMedicines.length }} 种药品</span>
<span class="total">合计金额¥ {{ totalAmount.toFixed(2) }}</span>
</div>
</div>
</el-card>
<TraceNoDialog
:ypName="ypName"
:openDialog="openTraceNoDialog"
@submit="submit"
@cancel="openTraceNoDialog = false"
/>
</div>
</template>
<script setup name="ReturnDrug">
import {getCurrentInstance, nextTick} from 'vue';
import {getList, getReturnDrugList, init, itemTraceNo, returnDrug} from './api';
import {formatDateStr} from '@/utils/index';
import {debounce} from 'lodash-es';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
const queryParams = ref({
pageSize: 50,
pageNum: 1,
refundEnum: 16,
classEnum: 1,
});
const openTraceNo = ref(false);
const traceNoList = ref([]);
const traceNo = ref('');
const encounterList = ref([]);
const encounterId = ref('');
const returDrugList = ref([]);
const selectedMedicines = ref([]);
const statusOptions = ref([]);
const dateRange = ref([
formatDateStr(new Date(), 'YYYY-MM-DD'),
formatDateStr(new Date(), 'YYYY-MM-DD'),
]);
const traceNoTemp = ref('');
const traceNoTempRef = ref();
const totalAmount = ref(0);
const openTraceNoDialog = ref(false);
const ypName = ref('');
const { proxy } = getCurrentInstance();
getEncounterList();
function getEncounterList() {
queryParams.value.startTimeSTime = dateRange.value[0] + ' 00:00:00';
queryParams.value.startTimeETime = dateRange.value[1] + ' 23:59:59';
getList(queryParams.value).then((res) => {
encounterList.value = res.data.records;
});
}
initOptions();
function initOptions() {
init().then((res) => {
statusOptions.value = res.data.refundStatusOptions;
});
}
function handleGetReturnDrugList(row) {
encounterId.value = row.encounterId;
getReturnDrugList({
encounterId: row.encounterId,
refundStatus: queryParams.value.refundEnum,
}).then((res) => {
returDrugList.value = res.data;
});
}
function handleScan() {
openTraceNoDialog.value = true;
}
function submit(value) {
let list = [];
if (value) {
list = value.split(',');
}
itemTraceNo(list).then((res) => {
if (res.code === 200) {
returDrugList.value.forEach((item, index) => {
if (res.data[item.itemId] && res.data[item.itemId].split(',') > item.quantity) {
proxy.$modal.msgWarning('操作失败');
return;
}
returDrugList.value[index].traceNo = res.data[item.itemId];
});
openTraceNoDialog.value = false;
// proxy.$modal.msgSuccess('退药成功');
// getReturnDrugList(encounterId.value);
}
});
}
const throttledGetList = debounce(handelTraceNo, 500);
let inputValue = '';
function handelTraceNo(value) {
traceNoList.value.push(value);
traceNo.value = traceNo.value + '[' + traceNoList.value.length + ']' + ' ' + value + '\n';
traceNoTemp.value = '';
// let saveValue = value.substring(inputValue.length + 5, value.length);
// inputValue = value;
// console.log(value);
// console.log(saveValue);
// traceNoList.value.push(saveValue);
// traceNo.value = value + '[' + (traceNoList.value.length + 1) + ']' + ' ';
}
function handleClear() {
traceNo.value = '';
traceNoList.value = [];
}
function cancel() {
openTraceNo.value = false;
traceNoList.value = [];
traceNo.value = '';
}
/**
* 退药
*/
function handleReturnDrug(row) {
console.log(row);
let saveList = [];
if (row) {
saveList = returDrugList.value
.filter((item) => item.requestId == row.requestId)
.map((item) => {
return {
requestId: item.requestId,
dispenseId: item.dispenseId,
tableName: item.serviceTable,
traceNo: item.traceNo,
};
});
} else {
saveList = proxy.$refs.returnDrugRef.getSelectionRows().map((item) => {
return {
requestId: item.requestId,
dispenseId: item.dispenseId,
tableName: item.serviceTable,
traceNo: item.traceNo,
};
});
console.log(saveList);
}
returnDrug(saveList).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('退药成功');
getEncounterList();
getReturnDrugList({
encounterId: encounterId.value,
refundStatus: queryParams.value.refundEnum,
}).then((res) => {
returDrugList.value = res.data;
});
}
});
}
// 选择框改变时的处理
function handleSelection(selection, row) {
const isSelected = selection.some((item) => item.dispenseId === row.dispenseId);
returDrugList.value
.filter((item) => {
return item.requestId == row.requestId;
})
.forEach((row) => {
proxy.$refs['returnDrugRef'].toggleRowSelection(row, isSelected);
});
nextTick(() => {
selectedMedicines.value = proxy.$refs['returnDrugRef'].getSelectionRows();
totalAmount.value = selectedMedicines.value.reduce((accumulator, currentRow) => {
return accumulator + (currentRow.totalPrice || 0);
}, 0);
});
}
function handelSelectRows(selection) {
selectedMedicines.value = selection;
totalAmount.value = selectedMedicines.value.reduce((accumulator, currentRow) => {
return accumulator + (currentRow.totalPrice || 0);
}, 0);
}
// 根据 requestId 合并相同行的方法(只合并药品名称和总价列)
function handelSpanMethod({ row, column, rowIndex, columnIndex }) {
// 定义需要合并的列索引
// 1: 药品名称列, 2: 总价列
const mergeColumns = [1, 2, 5, 7, 8];
// 检查当前列是否需要合并
if (!mergeColumns.includes(columnIndex)) {
return [1, 1];
}
// 获取当前行的 requestId
const currentRequestId = row.requestId;
// 如果没有 requestId不进行合并
if (!currentRequestId) {
return [1, 1];
}
// 查找具有相同 requestId 的连续行
let rowspan = 1;
let colspan = 1;
// 向上查找相同 requestId 的行
let startIndex = rowIndex;
while (startIndex > 0 && returDrugList.value[startIndex - 1].requestId === currentRequestId) {
startIndex--;
rowspan++;
}
// 如果当前行不是合并组的第一行,则不显示
if (startIndex !== rowIndex) {
return [0, 0];
}
// 向下查找相同 requestId 的行
let endIndex = rowIndex;
while (
endIndex < returDrugList.value.length - 1 &&
returDrugList.value[endIndex + 1].requestId === currentRequestId
) {
endIndex++;
rowspan++;
}
// 只有当 rowspan > 1 时才进行合并
return rowspan > 1 ? [rowspan, colspan] : [1, 1];
}
</script>
<style lang="scss" scoped>
.container {
display: flex;
height: 80vh;
gap: 16px;
}
.patient-list {
width: 600px;
flex-shrink: 0;
}
.refund-list {
flex: 1;
}
.patient-item {
padding: 12px;
margin-bottom: 8px;
cursor: pointer;
border-radius: 4px;
transition: all 0.3s;
&:hover {
background-color: #f5f7fa;
}
&.active {
background-color: #ecf5ff;
border-left: 4px solid #409eff;
}
}
.patient-info {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
.name {
font-weight: 500;
}
.visit-no {
color: #666;
font-size: 12px;
}
}
.visit-time {
color: #999;
font-size: 12px;
}
.footer {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px;
border-top: 1px solid #ebeef5;
.total {
margin-left: 20px;
color: #f56c6c;
font-weight: 500;
}
}
:deep(.el-textarea .el-textarea__inner) {
resize: none !important;
}
:deep(.no-hover-table) .el-table__body tr:hover > td {
background: inherit !important;
}
</style>

View File

@@ -0,0 +1,299 @@
import request from '@/utils/request';
// 获取病区下拉选
export function getPractitionerWard(queryParams) {
return request({
url: '/app-common/practitioner-ward',
method: 'get',
params: queryParams,
});
}
// 住院汇总发药单左侧,汇总单列表
export function getFromSummaryList(queryParams) {
return request({
url: 'nurse-station/medicine-summary/summary-form',
method: 'get',
params: queryParams,
});
}
// 发药汇总发放状态
export function getFromSummaryInit(queryParams) {
return request({
url: '/nurse-station/medicine-summary/summary-init',
method: 'get',
params: queryParams,
});
}
// 汇总发药单详情
export function getFromSummaryDetails(queryParams) {
return request({
url: 'nurse-station/medicine-summary/summary-form-detail',
method: 'get',
params: queryParams,
});
}
// 住院汇总发药单右侧
export function getFromDetailList(queryParams) {
return request({
url: 'pharmacy-manage/summary-dispense-medicine/from-list',
method: 'get',
params: queryParams,
});
}
// 明细左侧
export function getEncounterList(queryParams) {
return request({
url: '/pharmacy-manage/summary-dispense-medicine/encounter-list',
method: 'get',
params: queryParams,
});
}
//明细 右侧
export function getMedicationSummaryDetail(queryParams) {
return request({
url: '/pharmacy-manage/summary-dispense-medicine/medication_summary-list',
method: 'get',
params: queryParams,
});
}
//以下是组件的接口
/**
* 获取住院患者列表
*/
export function getPatientList(queryParams) {
return request({
url: '/nurse-station/advice-process/inpatient',
method: 'get',
params: queryParams,
});
}
/**
* 获取当前登录人管理病区
*/
export function getWardList(queryParams) {
return request({
url: '/app-common/practitioner-ward',
method: 'get',
params: queryParams,
});
}
/**
* 获取当前选中患者全部医嘱
*/
export function getPrescriptionList(queryParams) {
return request({
url: '/nurse-station/advice-process/inpatient-advice',
method: 'get',
params: queryParams,
});
}
/**
* 执行医嘱
*/
export function adviceExecute(data) {
return request({
url: '/nurse-station/advice-process/advice-execute',
method: 'post',
data: data,
});
}
/**
* 取消执行医嘱
*/
export function adviceCancel(data) {
return request({
url: '/nurse-station/advice-process/advice-cancel',
method: 'post',
data: data,
});
}
/**
* 明细发药
*
*/
export function totalSendDrug(data) {
return request({
url: '/pharmacy-manage/summary-dispense-medicine/summary-dispense-medicine',
method: 'put',
data: data,
});
}
/**
* 明细退药
*/
export function totalReturnDrug(data) {
return request({
url: '/pharmacy-manage/summary-dispense-medicine/medicine-return',
method: 'put',
data: data,
});
}
// -----------------------------------门诊发药接口------------------------------------------------------------
export function listPatient(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/encounter-list',
method: 'get',
params: query,
});
}
export function devicePatientList(query) {
return request({
url: '/pharmacy-manage/device-dispense/encounter-list',
method: 'get',
params: query,
});
}
export function listInit(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/init',
method: 'get',
params: query,
});
}
export function listWesternmedicine(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-order',
method: 'get',
params: query,
});
}
export function updateMedicion(prescriptionList) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-dispense',
method: 'put',
data: prescriptionList,
});
}
export function prepareMedicion(data) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/prepare',
method: 'put',
data: data,
});
}
export function backMedicion(data) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-cancel',
method: 'put',
data: data,
});
}
//扫码枪返回追溯码筛选
export function itemTraceNo(params) {
return request({
url: '/app-common/item-trace-no?traceNoList=' + params,
method: 'get',
});
}
/**
* 耗材查询列表
*/
export function getReportRegisterInit(query) {
return request({
url: '/pharmacy-manage/device-dispense/device-order',
method: 'get',
params: query,
});
}
/**
* 耗材发药
*/
export function deviceDispense(params) {
return request({
url: '/pharmacy-manage/device-dispense/device-dispense',
method: 'put',
data: params,
});
}
/**
* 耗材作废
*/
export function deviceInvalid(data) {
return request({
url: '/pharmacy-manage/device-dispense/device-cancel',
method: 'put',
data: data,
});
}
/**
* 跨批次发药匹配批号
*/
export function medicineMatch(data) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-match',
method: 'get',
params: data,
});
}
// ----------------------------------------------门诊退药接口----------------------------------------------------------------------
/**
* 获取患者列表
*/
export function getList(queryParams) {
return request({
url: '/pharmacy-manage/return-medicine/return-patient-page',
method: 'get',
params: queryParams,
});
}
/**
* 获取退药列表
*/
export function getReturnDrugList(params) {
return request({
url: '/pharmacy-manage/return-medicine/medicine-return-list',
method: 'get',
params: params,
});
}
/**
* 退药
*/
export function returnDrug(data) {
return request({
url: '/pharmacy-manage/return-medicine/medicine-return',
method: 'put',
data: data,
});
}
/**
* 初始化
*/
export function init() {
return request({
url: '/pharmacy-manage/return-medicine/init',
method: 'get',
});
}
// //扫码枪返回追溯码筛选
// export function itemTraceNo(params) {
// return request({
// url: '/app-common/item-trace-no?traceNoList=' + params,
// method: 'get',
// })
// }

View File

@@ -0,0 +1,337 @@
{
"panels": [
{
"index": 0,
"name": 1,
"paperType": "A5",
"height": 210,
"width": 148,
"paperHeader": 0,
"paperFooter": 592.4409448818898,
"paperNumberDisabled": true,
"paperNumberContinue": true,
"expandCss": "",
"overPrintOptions": {
"content": "",
"opacity": 0.7,
"type": 1
},
"watermarkOptions": {
"content": "",
"fillStyle": "rgba(184, 184, 184, 0.3)",
"fontSize": "14px",
"rotate": 25,
"width": 200,
"height": 200,
"timestamp": false,
"format": "YYYY-MM-DD HH:mm"
},
"panelLayoutOptions": {},
"printElements": [
{
"options": {
"left": 0,
"top": 22.5,
"height": 12,
"width": 420,
"title": "{{HOSPITAL_NAME}}",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 13.5,
"qrCodeLevel": 0,
"textAlign": "center"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 0,
"top": 45,
"height": 9.75,
"width": 420,
"title": "处置单",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 11.25,
"qrCodeLevel": 0,
"textAlign": "center"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "姓名",
"field": "patientName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 157.5,
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "年龄",
"field": "age",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 300,
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "性别",
"field": "genderEnum_enumText",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 94.5,
"height": 9.75,
"width": 96,
"title": "科室",
"field": "departmentName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 156,
"top": 94.5,
"height": 9.75,
"width": 118.5,
"title": "费用性质",
"field": "contractName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 300,
"top": 94.5,
"height": 9.75,
"width": 120,
"title": "日期",
"field": "reqTime",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 121.5,
"height": 9.75,
"width": 123,
"title": "门诊号",
"field": "encounterNo",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 156,
"top": 121.5,
"height": 9.75,
"width": 120,
"title": "开单医生",
"field": "doctorName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 18,
"top": 141,
"height": 9,
"width": 393,
"borderWidth": "1.5",
"title": "undefined+beforeDragIn",
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
"left": 22.5,
"top": 156,
"height": 9.75,
"width": 24,
"title": "Rp",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 12,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 177,
"height": 36,
"width": 387,
"title": "undefined+beforeDragIn",
"coordinateSync": false,
"widthHeightSync": false,
"field": "adviceItemList",
"columns": [
[
{
"title": "项目名",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 180.11284430829235,
"field": "itemName",
"checked": true,
"columnId": "itemName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "单价",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
"width": 65.15543233883191,
"field": "unitPrice",
"checked": true,
"columnId": "unitPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "数量",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }",
"width": 61.720533008519084,
"field": "quantity",
"checked": true,
"columnId": "quantity",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "执行次数",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 80.01119034435662,
"field": "quantity",
"checked": true,
"columnId": "quantity",
"fixed": false,
"rowspan": 1,
"colspan": 1
}
]
]
},
"printElementType": {
"title": "表格",
"type": "table",
"editable": true,
"columnDisplayEditable": true,
"columnDisplayIndexEditable": true,
"columnTitleEditable": true,
"columnResizable": true,
"columnAlignEditable": true,
"isEnableEditField": true,
"isEnableContextMenu": true,
"isEnableInsertRow": true,
"isEnableDeleteRow": true,
"isEnableInsertColumn": true,
"isEnableDeleteColumn": true,
"isEnableMergeCell": true
}
}
]
}
]
}

View File

@@ -0,0 +1,339 @@
{
"panels": [
{
"index": 0,
"name": 1,
"paperType": "自定义",
"height": 130,
"width": 210,
"paperNumberDisabled": true,
"paperNumberContinue": true,
"overPrintOptions": {
"content": "",
"opacity": 0.7,
"type": 1
},
"watermarkOptions": {
"content": "",
"fillStyle": "rgba(184, 184, 184, 0.3)",
"fontSize": "14px",
"rotate": 25,
"width": 200,
"height": 200,
"timestamp": false,
"format": "YYYY-MM-DD HH:mm"
},
"panelLayoutOptions": {},
"paperHeader": 0,
"paperFooter": 841.8897637795277,
"printElements": [
{
"options": {
"left": 252,
"top": 13.5,
"height": 12,
"width": 75,
"title": "{{HOSPITAL_NAME}}医院",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 12,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 19.5,
"top": 33,
"height": 9.75,
"width": 120,
"title": "日期",
"field": "occurrenceTime",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 222,
"top": 33,
"height": 9.75,
"width": 120,
"title": "单据号",
"field": "busNo",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 465,
"top": 33,
"height": 9.75,
"width": 120,
"title": "机构:{{HOSPITAL_NAME}}医院",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 19.5,
"top": 57,
"height": 9.75,
"width": 322.5,
"title": "供应商",
"field": "supplierName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 19.5,
"top": 84,
"height": 36,
"width": 570,
"title": "undefined+beforeDragIn",
"field": "purchaseinventoryList",
"coordinateSync": false,
"widthHeightSync": false,
"columns": [
[
{
"title": "项目名",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 53.52877835374887,
"field": "name",
"checked": true,
"columnId": "name",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "规格",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 50.3056193642802,
"field": "volume",
"checked": true,
"columnId": "volume",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "厂家/产地",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 84.09807741407441,
"field": "manufacturerText",
"checked": true,
"columnId": "manufacturerText",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "数量",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }",
"width": 37.02194283284556,
"field": "itemQuantity",
"checked": true,
"columnId": "itemQuantity",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "采购单价",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
"width": 45.05495152300426,
"field": "price",
"checked": true,
"columnId": "price",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "金额",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
"width": 39.04544357631049,
"field": "totalPrice",
"checked": true,
"columnId": "totalPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "仓库",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 40.041954542099724,
"field": "purposeLocationName",
"checked": true,
"columnId": "purposeLocationName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "产品批号",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 47.05067091842349,
"field": "lotNumber",
"checked": true,
"columnId": "lotNumber",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "生产日期",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 63.089377997062755,
"field": "startTime",
"checked": true,
"columnId": "startTime",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "有效期至",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 59.05673483929025,
"field": "endTime",
"checked": true,
"columnId": "endTime",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "发票号",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 51.706448638859854,
"field": "invoiceNo",
"checked": true,
"columnId": "invoiceNo",
"fixed": false,
"rowspan": 1,
"colspan": 1
}
]
]
},
"printElementType": {
"title": "表格",
"type": "table",
"editable": true,
"columnDisplayEditable": true,
"columnDisplayIndexEditable": true,
"columnTitleEditable": true,
"columnResizable": true,
"columnAlignEditable": true,
"isEnableEditField": true,
"isEnableContextMenu": true,
"isEnableInsertRow": true,
"isEnableDeleteRow": true,
"isEnableInsertColumn": true,
"isEnableDeleteColumn": true,
"isEnableMergeCell": true
}
},
{
"options": {
"left": 480,
"top": 130.5,
"height": 12,
"width": 109.5,
"title": "合计",
"field": "totalAmount",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"formatter": "function(title,value,options,templateData,target,paperNo){\n return value + ' 元'\n}"
},
"printElementType": {
"title": "文本",
"type": "text"
}
}
]
}
]
}

View File

@@ -0,0 +1,298 @@
<template>
<div class="app-container" style="padding-top: 0px">
<el-tabs v-model="activeName" @tab-click="handleClick" class="centered-tabs tabs-font">
<el-tab-pane label="发药汇总单" name="summary">
<MedicationSummary />
</el-tab-pane>
<el-tab-pane label="发药明细单" name="detail">
<MedicationDetails />
</el-tab-pane>
<el-tab-pane label="住院退药" name="return">
<ReturnDrug />
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup>
import {getCurrentInstance, onMounted, reactive, ref} from 'vue';
import {ElMessage} from 'element-plus';
import MedicationSummary from './components/MedicationSummary.vue';
import MedicationDetails from './components/MedicationDetails.vue';
import ReturnDrug from './components/ReturnDrug.vue';
import {getEncounterList, getFromDetailList, getFromSummaryList, getMedicationSummaryDetail,} from './components/api';
const activeName = ref('summary');
const loading = ref(false);
const patientList = ref([]);
const total = ref(0);
const showSearch = ref(true);
const { proxy } = getCurrentInstance();
// 查询参数
const queryParams = reactive({
searchKey: '',
statusEnum: '',
pageNo: 1,
pageSize: 10,
windowDataText: '',
medicationListText: '',
timeRange: 1,
});
const queryParamsPatient = ref({
searchKey: '',
statusEnum: '1',
pageNo: 1,
pageSize: 10,
});
// 日期范围
const dateRange = ref([
new Date().toISOString().split('T')[0],
new Date().toISOString().split('T')[0],
]);
// 发药状态选项
const dispenseStatusOptions = ref([
{ label: '待发药', value: '1' },
{ label: '已发药', value: '2' },
{ label: '全部', value: '0' },
]);
// 加载患者列表数据
async function getList() {
if (dateRange.value == null) {
proxy.$message.warning('请选择日期');
return;
}
loading.value = true;
try {
let response;
// 构建查询参数 - 只保留必要的分页和筛选条件
const params = {
searchKey: queryParamsPatient.value.searchKey,
statusEnum: queryParamsPatient.value.statusEnum,
pageNo: queryParamsPatient.value.pageNo,
pageSize: queryParamsPatient.value.pageSize,
startTime: dateRange.value[0],
endTime: dateRange.value[1],
};
// 根据当前标签页调用不同的接口
if (selectType.value === 'total') {
// 汇总标签页
response = await getFromSummaryList(params);
patientList.value = response.data;
total.value = response.data.length || 0;
} else {
// 明细标签页
response = await getEncounterList(params);
patientList.value = response.data.records;
total.value = response.data.total || 0;
}
} catch (error) {
patientList.value = [];
total.value = 0;
} finally {
loading.value = false;
}
}
// 搜索处理
async function handleQuery() {
queryParamsPatient.value.pageNo = 1; // 重置为第一页
await getList();
}
const busNo = ref('');
const encounterId = ref('');
// 处理表格行点击
function handleCurrentChange(row) {
busNo.value = row.busNo;
encounterId.value = row.encounterId;
if (selectType.value === 'total') {
// 汇总标签页
callSummaryMedicationDetail(row.busNo);
} else {
// 明细标签页
callMedicationSummaryDetail(row.encounterId);
}
}
// 明细标签页
async function callMedicationSummaryDetail(encounterId) {
console.log('点击明细标签页', encounterId);
// 显示加载提示
loading.value = true;
try {
const params = {
encounterId,
};
const response = await getMedicationSummaryDetail(params);
// 处理药品汇总详情数据
handleMedicationSummaryDetail(response.data);
} catch (error) {
ElMessage.error('获取药品汇总详情失败:' + (error.message || '未知错误'));
// 发生错误时清空数据
handleMedicationSummaryDetail([]);
} finally {
// 无论成功失败都关闭加载状态
loading.value = false;
}
}
// 汇总标签页
async function callSummaryMedicationDetail(busNo) {
// 显示加载提示
loading.value = true;
try {
const params = {
busNo,
};
const response = await getFromDetailList(params);
// 处理汇总药品详情数据
handleMedicationSummaryDetail(response.data);
} catch (error) {
ElMessage.error('获取汇总药品详情失败:' + (error.message || '未知错误'));
// 发生错误时清空数据
handleMedicationSummaryDetail([]);
} finally {
// 无论成功失败都关闭加载状态
loading.value = false;
}
}
// 窗口数据
const windowData = reactive([
{
label: '窗口1',
value: 1,
},
{
label: '窗口2',
value: 2,
},
{
label: '窗口3',
value: 3,
},
]);
// 摆药单数据
const medicationList = reactive([
{
label: '药单1',
value: 1,
},
{
label: '药单2',
value: 2,
},
{
label: '药单3',
value: 3,
},
]);
// 时间范围选项
const timeRangeList = [
{
label: '全部',
value: 1,
},
{
label: '长期',
value: 2,
},
{
label: '临时',
value: 3,
},
];
// 表格类型
const selectType = ref('total');
// 表格数据用于显示右侧药品列表汇总tab
const tableData = reactive([]);
// 明细表格数据用于明细tab
const detailTableData = reactive([]);
// 切换表格类型
function handleSelectType(type) {
selectType.value = type;
reset();
getList();
}
function reset() {
busNo.value = '';
encounterId.value = '';
patientList.value = [];
total.value = 0;
// 保持响应式引用不变,逐字段还原默认
queryParamsPatient.value.searchKey = '';
queryParamsPatient.value.statusEnum = '1';
queryParamsPatient.value.pageNo = 1;
queryParamsPatient.value.pageSize = 10;
}
// 处理子组件传递的药品汇总详情数据
function handleMedicationSummaryDetail(data) {
// 检查数据是否为数组
const medicationData = Array.isArray(data)
? data
: typeof data === 'object' && data !== null && Array.isArray(data.records)
? data.records
: [];
// 根据当前tab将数据分配到不同的表格
if (selectType.value === 'total') {
// 汇总tab - 清空表格数据
tableData.splice(0, tableData.length);
if (medicationData.length > 0) {
medicationData.forEach((item, index) => {
tableData.push({
currentIndex: index + 1,
...item,
});
});
}
} else {
// 明细tab - 将数据渲染到DetailMedicationTable组件
detailTableData.splice(0, detailTableData.length);
medicationData.forEach((item) => {
detailTableData.push({
...item,
});
});
}
}
// 组件挂载时初始化数据
onMounted(() => {
getList();
});
</script>
<style scoped>
.left-container {
border-radius: 4px;
border: 1px solid #f5f5f5;
background-color: #fff;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
padding: 20px;
}
.centered-tabs :deep(.el-tabs__nav-wrap) {
display: flex;
justify-content: center;
}
.centered-tabs :deep(.el-tabs__nav-scroll) {
display: flex;
justify-content: center;
}
:deep(.el-tabs__item) {
font-size: 16px !important;
padding: 0 60px !important;
}
</style>