@@ -1,11 +1,11 @@
< template >
< el-dialog
title = "患者详情"
v-model = "props.open "
v-model = "dialogVisible "
width = "1700px"
append -to -body
destroy -on -close
@close ="close"
: destroy-on-close= "false"
@close ="closeDialog "
>
< div style = "display: flex; justify-content: space-between" class = "app-container" >
< div style = "width: 50%" >
@@ -67,45 +67,33 @@
ref = "patientListRef"
max -height = " 650 "
:data = "patientList"
row -key = " encounterI d"
@ cell -click = " clickRow "
row -key = " i d"
highlight -current -row
@ row -click = " handleRowClick "
>
< el-table-column type = "selection" :selectable = "checkSelectable " width = "55 " / >
< el-table-column prop = "busNo " label = "体温 " width = "8 0" / >
< el-table-column prop = "statusEnum_enumText " label = "收缩压 " min - width =" 120 " / >
< el-table-column prop = "busNo " label = "舒张 压" width = "8 0" / >
< el-table-column prop = "statusEnum_enumText " label = "心率 " min - width =" 120 " / >
< el-table-column prop = "busNo " label = "脉搏 " width = "8 0" / >
< el-table-column prop = "statusEnum_enumText " label = "呼吸 " min - width =" 120 " / >
< el-table-column prop = "busNo " label = "血氧 " width = "8 0" / >
< el-table-column prop = "statusEnum_enumText " label = "动脉压 " min - width =" 120 " / >
< el-table-column prop = "busNo " label = "血糖" width = "8 0" / >
< el-table-column prop = "statusEnum_enumText " label = "物理降温" min - width =" 120 " / >
< el-table-column prop = "busNo " label = "左瞳孔(光) " width = "80" / >
< el-table-column prop = "statusEnum_enumText" label = "右瞳孔(光)" min - width =" 120 " / >
< el-table-column prop = "busNo " label = "CCU心率 " width = "28 0" / >
< el-table-column prop = "statusEnum_enumText" label = "左瞳孔(大小)" min - width =" 120 " / >
< el-table-column prop = "busNo " label = "右瞳孔(大小) " width = "28 0" / >
< el-table-column prop = "statusEnum_enumText " label = "意识" min - width =" 120 " / >
< el-table-column prop = "busNo " label = "新生儿箱温 " width = "2 80" / >
< el-table-column prop = "statusEnum_enumText " label = "血酮" min - width =" 120 " / >
< el-table-column prop = "busNo " label = "体重 " width = "28 0" / >
< el-table-column prop = "statusEnum_enumTex t" label = "身高 " min - width =" 120 " / >
< el-table-column prop = "busNo " label = "腹围 " width = "28 0" / >
< el-table-column prop = "statusEnum_enumText " label = "大便次数 " min - width =" 120 " / >
< el-table-column prop = "busNo" label = "灌肠次数" width = "280" / >
< el-table-column prop = "statusEnum_enumText" label = "灌肠后大便次数" min -width = " 120 " / >
< el-table-column prop = "busNo" label = "出量" width = "280" / >
< el-table-column prop = "statusEnum_enumText" label = "入量" min -width = " 120 " / >
< el-table-column prop = "statusEnum_enumText" label = "尿量" min -width = " 120 " / >
< el-table-column prop = "busNo" label = "大便量" width = "280" / >
< el-table-column label = "操作" min -width = " 150 " fixed = "right" >
<!-- < template # default = "scope" > -- >
< template >
< el-button link type = "primary" size = "small" > 保存 < / el-button >
< / template >
< / el-table-column >
< el-table-column prop = "recordingDate" label = "日期 " width = "80 " / >
< el-table-column prop = "timePoint " label = "时间 " width = "6 0" / >
< el-table-column prop = "temperature " label = "体温 " width ="70 " / >
< el-table-column prop = "systolicPressure " label = "收缩 压" width = "7 0" / >
< el-table-column prop = "diastolicPressure " label = "舒张压 " width ="70 " / >
< el-table-column prop = "heartRate " label = "心率 " width = "7 0" / >
< el-table-column prop = "pulseRate " label = "脉搏 " width ="70 " / >
< el-table-column prop = "respirationRate " label = "呼吸 " width = "7 0" / >
< el-table-column prop = "bloodOxygen " label = "血氧 " width ="70 " / >
< el-table-column prop = "bloodGlucose " label = "血糖" width = "7 0" / >
< el-table-column prop = "physicalCooling " label = "物理降温" width ="80 " / >
< el-table-column prop = "ccuHeartRate " label = "CCU心率 " width = "80" / >
< el-table-column prop = "newbornsIncubator" label = "新生儿箱温" width ="90 " / >
< el-table-column prop = "bloodKetone " label = "血酮 " width = "7 0" / >
< el-table-column prop = "height" label = "身高" width ="70 " / >
< el-table-column prop = "waistCircumference " label = "腹围 " width = "7 0" / >
< el-table-column prop = "stoolFrequency " label = "大便次数" width ="80 " / >
< el-table-column prop = "enemaFrequency " label = "灌肠次数 " width = "80" / >
< el-table-column prop = "sfAfterEnema " label = "灌肠后大便" width ="90 " / >
< el-table-column prop = "output " label = "出量 " width = "7 0" / >
< el-table-column prop = "inpu t" label = "入量 " width ="70 " / >
< el-table-column prop = "urineVolume " label = "尿量 " width = "7 0" / >
< el-table-column prop = "stoolVolume " label = "大便量 " width ="70 " / >
< / el-table >
< / div >
< / el-card >
@@ -204,7 +192,7 @@
< div class = "flex-container" >
< el-input
prop = "lowBloodPressure"
v-model = "formData.dat e"
v-model = "formData.systolicPressur e"
style = "width: 90px"
size = "small"
@keydown ="onKeyDown('1', '1', $event)"
@@ -213,7 +201,7 @@
< label > / < / label >
< el-input
prop = "HighBloodPressure"
v-model = "formData.times "
v-model = "formData.diastolicPressure "
style = "width: 90px"
size = "small"
@keydown ="onKeyDown('1', '2', $event)"
@@ -655,20 +643,21 @@
< / div >
< template # footer >
< div class = "dialog-footer" >
< el-button @click ="close" > 取 消 < / el -button >
< el-button @click ="closeDialog " > 取 消 < / el -button >
< / div >
< / template >
< / el-dialog >
< / template >
< script setup >
import { ref } from 'vue' ;
import { ref , watch } from 'vue' ;
import request from '@/utils/request' ;
import { addVitalSigns , listPatient } from './api' ;
import moment from "moment" ;
const { proxy } = getCurrentInstance ( ) ;
const props = defineProps ( {
open : {
modelValue : {
type : Boolean ,
default : false ,
} ,
@@ -678,9 +667,21 @@ const props = defineProps({
} ,
patientInfo : {
type : Object ,
default : ( ) => { } ,
default : ( ) => ( {} ) ,
} ,
} ) ;
const emit = defineEmits ( [ 'close' , 'update:modelValue' ] ) ;
// 直接使用computed双向绑定, 更可靠
const dialogVisible = computed ( {
get ( ) {
return props . modelValue ;
} ,
set ( val ) {
emit ( 'update:modelValue' , val ) ;
}
} ) ;
const { method _code , unit _code , rate _code , distribution _category _code } = proxy . useDict (
'method_code' ,
'unit_code' ,
@@ -688,12 +689,14 @@ const { method_code, unit_code, rate_code, distribution_category_code } = proxy.
'distribution_category_code'
) ;
const emit = defineEmits ( [ 'close' ] ) ;
const queryParams = ref ( {
pageNum : 1 ,
pageSize : 10 ,
patientId : undefined , // 患者id
startTime : undefined ,
endTime : undefined ,
} ) ;
const patientList = ref ( [ ] ) ;
// const patientInfo = ref({
// patientName: '张三',
// });
@@ -758,10 +761,33 @@ const InputOptions = ref([
} ,
] )
// 表单数据
// 日期范围 - 体征信息搜索时间
const receptionTime = ref ( null ) ;
// 表单数据 - 体征录入
const formData = ref ( {
username : '' ,
gender : '' ,
timePoint : '' ,
temperature : '' ,
systolicPressure : '' ,
diastolicPressure : '' ,
heartRate : '' ,
pulseRate : '' ,
respirationRate : '' ,
bloodOxygen : '' ,
bloodGlucose : '' ,
physicalCooling : '' ,
ccuHeartRate : '' ,
newbornsIncubator : '' ,
bloodKetone : '' ,
height : '' ,
waistCircumference : '' ,
stoolFrequency : '' ,
enemaFrequency : '' ,
sfAfterEnema : '' ,
output : '' ,
input : '' ,
urineVolume : '' ,
stoolVolume : '' ,
} ) ;
// 表格列配置数据
const tableColumns = ref ( [
@@ -790,19 +816,64 @@ const tableColumns = ref([
// 更多列配置...
] ) ;
function getPatientList ( ) { }
function getPatientList ( ) {
let startTime = null ;
let endTime = null ;
if ( receptionTime . value && receptionTime . value . length === 2 ) {
startTime = receptionTime . value [ 0 ] ;
endTime = receptionTime . value [ 1 ] ;
}
// 查询体征数据 - 使用正确的API接口
request ( {
url : '/vital-signs/record-search' ,
method : 'get' ,
params : {
startTime ,
endTime ,
patientId : props . patientId
}
} ) . then ( ( res ) => {
// 判断返回的数据结构
let data = res . data ;
if ( res . data && res . data . data && typeof res . data . data === 'object' ) {
// 如果是嵌套结构 {data: {data: Array(3)}}
data = res . data . data ;
} else if ( res . data && typeof res . data === 'object' && res . data . data !== undefined ) {
// 如果是 {code: 200, msg: '操作成功', data: Array(3)}
data = res . data . data ;
}
console . log ( '=== data 长度 ===' , data ? . length ) ;
if ( res . code === 200 && data ) {
console . log ( '=== 准备赋值 patientList.value ===' ) ;
patientList . value = data ;
console . log ( '=== patientList.value 赋值后 ===' , patientList . value ) ;
console . log ( '=== patientList.value 长度 ===' , patientList . value ? . length ) ;
} else {
console . error ( '=== 查询失败或无数据 ===' ) ;
}
} ) . catch ( err => {
console . error ( '=== 查询报错 ===' , err ) ;
} ) ;
}
/**
* 取得患者信息详细
*/
function getPatientDetial ( ) {
console . log ( '=== getPatientDetial 开始 ===' , props . patientInfo ) ;
patientInfo . value = props . patientInfo ;
console . log ( props , 'props' , props . patientInfo ) ;
reset ( ) ;
title . value = '' ;
title . value = props . title ;
console . log ( props , 'props' , title . value ) ;
console . log ( queryParams . value , 'queryParams.value' , props . patientId ) ;
queryParams . value . patientId = props . patientId ;
// 默认查询今天的数据
const today = moment ( ) . format ( 'YYYY-MM-DD' ) ;
receptionTime . value = [ today , today ] ;
// 自动加载数据
getPatientList ( ) ;
listPatient ( queryParams . value ) . then ( ( res ) => {
if ( res . data && res . data . records && res . data . records . length > 0 ) {
form . value = res . data . records [ 0 ] ;
@@ -823,22 +894,186 @@ function getPatientDetial() {
} ) ;
}
function close ( ) {
function closeDialog ( ) {
reset ( ) ;
dialogVisible . value = false ;
emit ( 'close' ) ;
}
// 转换时间格式 HH:MM:SS -> HHMM
function convertTimePoint ( timeStr ) {
if ( ! timeStr ) return '' ;
// 如果已经是 HHMM 格式( 4位数字) , 直接返回
if ( /^\d{4}$/ . test ( timeStr ) ) {
return timeStr ;
}
// 转换 HH:MM:SS -> HHMM
const parts = timeStr . split ( ':' ) ;
if ( parts . length >= 2 ) {
return ( parts [ 0 ] . padStart ( 2 , '0' ) + parts [ 1 ] . padStart ( 2 , '0' ) ) ;
}
return timeStr ;
}
// 表格行点击 - 填充表单
function handleRowClick ( row ) {
formData . value = {
... formData . value ,
id : row . id ,
timePoint : convertTimePoint ( row . timePoint ) || '' ,
temperature : row . temperature || '' ,
systolicPressure : row . systolicPressure || '' ,
diastolicPressure : row . diastolicPressure || '' ,
heartRate : row . heartRate || '' ,
pulseRate : row . pulseRate || '' ,
respirationRate : row . respirationRate || '' ,
bloodOxygen : row . bloodOxygen || '' ,
bloodGlucose : row . bloodGlucose || '' ,
physicalCooling : row . physicalCooling || '' ,
ccuHeartRate : row . ccuHeartRate || '' ,
newbornsIncubator : row . newbornsIncubator || '' ,
bloodKetone : row . bloodKetone || '' ,
height : row . height || '' ,
waistCircumference : row . waistCircumference || '' ,
stoolFrequency : row . stoolFrequency || '' ,
enemaFrequency : row . enemaFrequency || '' ,
sfAfterEnema : row . sfAfterEnema || '' ,
output : row . output || '' ,
input : row . input || '' ,
urineVolume : row . urineVolume || '' ,
stoolVolume : row . stoolVolume || '' ,
} ;
}
function confirmCharge ( ) {
le t params = { }
params = formData . value
params . patientId = props . patientInfo . patientId
params . encounterId = props . patientInfo . encounterId
cons t params = {
... formData . value ,
patientId : props . patientInfo . patientId ,
encounterId : props . patientInfo . encounterId ,
} ;
// 收集所有录入的体征数据
const vitalSignsCode = [ ] ;
const vitalSignsValues = [ ] ;
if ( params . temperature ) {
vitalSignsCode . push ( '003' ) ;
vitalSignsValues . push ( params . temperature ) ;
}
if ( params . systolicPressure && params . diastolicPressure ) {
vitalSignsCode . push ( '001' , '002' ) ;
vitalSignsValues . push ( params . systolicPressure , params . diastolicPressure ) ;
}
if ( params . heartRate ) {
vitalSignsCode . push ( '004' ) ;
vitalSignsValues . push ( params . heartRate ) ;
}
if ( params . pulseRate ) {
vitalSignsCode . push ( '005' ) ;
vitalSignsValues . push ( params . pulseRate ) ;
}
if ( params . respirationRate ) {
vitalSignsCode . push ( '006' ) ;
vitalSignsValues . push ( params . respirationRate ) ;
}
if ( params . bloodOxygen ) {
vitalSignsCode . push ( '014' ) ;
vitalSignsValues . push ( params . bloodOxygen ) ;
}
if ( params . bloodGlucose ) {
vitalSignsCode . push ( '016' ) ;
vitalSignsValues . push ( params . bloodGlucose ) ;
}
if ( params . physicalCooling ) {
vitalSignsCode . push ( '017' ) ;
vitalSignsValues . push ( params . physicalCooling ) ;
}
if ( params . ccuHeartRate ) {
vitalSignsCode . push ( '041' ) ;
vitalSignsValues . push ( params . ccuHeartRate ) ;
}
if ( params . newbornsIncubator ) {
vitalSignsCode . push ( '061' ) ;
vitalSignsValues . push ( params . newbornsIncubator ) ;
}
if ( params . bloodKetone ) {
vitalSignsCode . push ( '140' ) ;
vitalSignsValues . push ( params . bloodKetone ) ;
}
if ( params . height ) {
vitalSignsCode . push ( '009' ) ;
vitalSignsValues . push ( params . height ) ;
}
if ( params . waistCircumference ) {
vitalSignsCode . push ( '052' ) ;
vitalSignsValues . push ( params . waistCircumference ) ;
}
if ( params . stoolFrequency ) {
vitalSignsCode . push ( '131' ) ;
vitalSignsValues . push ( params . stoolFrequency ) ;
}
if ( params . enemaFrequency ) {
vitalSignsCode . push ( '132' ) ;
vitalSignsValues . push ( params . enemaFrequency ) ;
}
if ( params . sfAfterEnema ) {
vitalSignsCode . push ( '133' ) ;
vitalSignsValues . push ( params . sfAfterEnema ) ;
}
if ( params . output ) {
vitalSignsCode . push ( '112' ) ;
vitalSignsValues . push ( params . output ) ;
}
if ( params . input ) {
vitalSignsCode . push ( '111' ) ;
vitalSignsValues . push ( params . input ) ;
}
if ( params . urineVolume ) {
vitalSignsCode . push ( '115' ) ;
vitalSignsValues . push ( params . urineVolume ) ;
}
if ( params . stoolVolume ) {
vitalSignsCode . push ( '134' ) ;
vitalSignsValues . push ( params . stoolVolume ) ;
}
params . vitalSignsCode = vitalSignsCode ;
params . vitalSignsValues = vitalSignsValues ;
params . recordingDate = moment ( new Date ( ) ) . format ( 'YYYY-MM-DD' ) ;
params . timePoint = formData . value . timePoint
params . vitalSignsCode = [ '003' ]
params . vitalSignsValues = [ '38' ]
addVitalSigns ( formData . value ) . then ( res => {
console . log ( res )
} )
addVitalSigns ( params) .then ( res => {
console . log ( '保存成功:' , res ) ;
if ( res . code === 200 ) {
// 保存成功后刷新列表
getPatientList ( ) ;
// 清空表单
formData . value = {
timePoint : '' ,
temperature : '' ,
systolicPressure : '' ,
diastolicPressure : '' ,
heartRate : '' ,
pulseRate : '' ,
respirationRate : '' ,
bloodOxygen : '' ,
bloodGlucose : '' ,
physicalCooling : '' ,
ccuHeartRate : '' ,
newbornsIncubator : '' ,
bloodKetone : '' ,
height : '' ,
waistCircumference : '' ,
stoolFrequency : '' ,
enemaFrequency : '' ,
sfAfterEnema : '' ,
output : '' ,
input : '' ,
urineVolume : '' ,
stoolVolume : '' ,
} ;
// 保存成功后关闭弹窗
closeDialog ( ) ;
}
} ) ;
}
/** 重置操作表单 */
function reset ( ) {
@@ -935,6 +1170,10 @@ defineExpose({
width : 100 % ;
}
. input - time - inline . el - select {
width : 150 px ;
}
. flex - container {
display : flex ;
align - items : center ; /* 垂直居中对齐 */