Compare commits
3 Commits
5f134945ab
...
2eec988c56
| Author | SHA1 | Date | |
|---|---|---|---|
| 2eec988c56 | |||
| 8820048d55 | |||
| 6af7720470 |
@@ -16,10 +16,12 @@ import java.util.Date;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import com.openhis.common.enums.BindingType;
|
import com.openhis.common.enums.BindingType;
|
||||||
import com.openhis.common.enums.EncounterStatus;
|
import com.openhis.common.enums.EncounterStatus;
|
||||||
|
import com.openhis.document.domain.DocRecord;
|
||||||
import com.openhis.document.domain.Emr;
|
import com.openhis.document.domain.Emr;
|
||||||
import com.openhis.document.domain.EmrDetail;
|
import com.openhis.document.domain.EmrDetail;
|
||||||
import com.openhis.document.domain.EmrDict;
|
import com.openhis.document.domain.EmrDict;
|
||||||
import com.openhis.document.domain.EmrTemplate;
|
import com.openhis.document.domain.EmrTemplate;
|
||||||
|
import com.openhis.document.service.IDocRecordService;
|
||||||
import com.openhis.document.service.IEmrDetailService;
|
import com.openhis.document.service.IEmrDetailService;
|
||||||
import com.openhis.document.service.IEmrDictService;
|
import com.openhis.document.service.IEmrDictService;
|
||||||
import com.openhis.document.service.IEmrService;
|
import com.openhis.document.service.IEmrService;
|
||||||
@@ -54,6 +56,9 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
|||||||
@Resource
|
@Resource
|
||||||
IEmrDictService emrDictService;
|
IEmrDictService emrDictService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IDocRecordService docRecordService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EncounterMapper encounterMapper;
|
private EncounterMapper encounterMapper;
|
||||||
|
|
||||||
@@ -128,14 +133,33 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取病历详情
|
* 获取病历详情
|
||||||
|
* 同时检查门诊病历(emr表)和住院病历(doc_record表)
|
||||||
*
|
*
|
||||||
* @param encounterId 就诊id
|
* @param encounterId 就诊id
|
||||||
* @return 病历详情
|
* @return 病历详情
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> getEmrDetail(Long encounterId) {
|
public R<?> getEmrDetail(Long encounterId) {
|
||||||
|
// 先查询门诊病历(emr表)
|
||||||
Emr emrDetail = emrService.getOne(new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, encounterId));
|
Emr emrDetail = emrService.getOne(new LambdaQueryWrapper<Emr>().eq(Emr::getEncounterId, encounterId));
|
||||||
return R.ok(emrDetail);
|
if (emrDetail != null) {
|
||||||
|
return R.ok(emrDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果门诊病历为空,检查住院病历(doc_record表)
|
||||||
|
DocRecord docRecord = docRecordService.getOne(
|
||||||
|
new LambdaQueryWrapper<DocRecord>()
|
||||||
|
.eq(DocRecord::getEncounterId, encounterId)
|
||||||
|
.orderByDesc(DocRecord::getCreateTime)
|
||||||
|
.last("LIMIT 1")
|
||||||
|
);
|
||||||
|
if (docRecord != null) {
|
||||||
|
// 住院病历存在,也返回数据
|
||||||
|
return R.ok(docRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 都没有病历
|
||||||
|
return R.ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ public class DocDefinitionController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/treeList")
|
@GetMapping("/treeList")
|
||||||
public R<?> getTreeList(DocDefinitonParam docDefinitonParam) {
|
public R<?> getTreeList(DocDefinitonParam docDefinitonParam,
|
||||||
|
@RequestParam(value = "useRanges", required = false) List<Integer> useRanges) {
|
||||||
|
docDefinitonParam.setUseRanges(useRanges);
|
||||||
return iDocDefinitionAppService.getTreeList(docDefinitonParam);
|
return iDocDefinitionAppService.getTreeList(docDefinitonParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ import {patientInfo} from '../../store/patient.js';
|
|||||||
import {ElMessage} from 'element-plus';
|
import {ElMessage} from 'element-plus';
|
||||||
// const diagnosisList = ref([]);
|
// const diagnosisList = ref([]);
|
||||||
const allowAdd = ref(false);
|
const allowAdd = ref(false);
|
||||||
|
const isSaving = ref(false);
|
||||||
const tree = ref([]);
|
const tree = ref([]);
|
||||||
const openDiagnosis = ref(false);
|
const openDiagnosis = ref(false);
|
||||||
const openAddDiagnosisDialog = ref(false);
|
const openAddDiagnosisDialog = ref(false);
|
||||||
@@ -229,15 +230,42 @@ watch(
|
|||||||
{ deep: true }
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 监听患者信息变化,自动获取病历详情和诊断列表
|
||||||
|
watch(
|
||||||
|
() => props.patientInfo,
|
||||||
|
(newVal) => {
|
||||||
|
if (newVal?.encounterId) {
|
||||||
|
getDetail(newVal.encounterId);
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
function getDetail(encounterId) {
|
function getDetail(encounterId) {
|
||||||
if (!encounterId) {
|
if (!encounterId) {
|
||||||
console.warn('未提供有效的就诊ID,无法获取病历详情');
|
console.warn('未提供有效的就诊ID,无法获取病历详情');
|
||||||
|
allowAdd.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEmrDetail(encounterId).then((res) => {
|
console.log('正在获取病历详情,encounterId:', encounterId);
|
||||||
allowAdd.value = res.data ? true : false;
|
|
||||||
});
|
getEmrDetail(encounterId)
|
||||||
|
.then((res) => {
|
||||||
|
console.log('病历详情API返回:', res);
|
||||||
|
if (res.code === 200) {
|
||||||
|
allowAdd.value = res.data ? true : false;
|
||||||
|
console.log('设置 allowAdd =', allowAdd.value, ', 病历数据:', res.data);
|
||||||
|
} else {
|
||||||
|
allowAdd.value = false;
|
||||||
|
console.warn('获取病历详情失败:', res.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('获取病历详情异常:', error);
|
||||||
|
allowAdd.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getList() {
|
function getList() {
|
||||||
@@ -245,7 +273,10 @@ function getList() {
|
|||||||
console.warn('患者就诊信息不完整,无法获取诊断数据');
|
console.warn('患者就诊信息不完整,无法获取诊断数据');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化中医诊断列表
|
||||||
|
const newList = [];
|
||||||
|
|
||||||
getEncounterDiagnosis(props.patientInfo.encounterId).then((res) => {
|
getEncounterDiagnosis(props.patientInfo.encounterId).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
const datas = (res.data || []).map((item) => {
|
const datas = (res.data || []).map((item) => {
|
||||||
@@ -405,30 +436,57 @@ function getTree() {
|
|||||||
* 添加西医诊断
|
* 添加西医诊断
|
||||||
*/
|
*/
|
||||||
function handleAddDiagnosis() {
|
function handleAddDiagnosis() {
|
||||||
proxy.$refs.formRef.validate((valid) => {
|
console.log('点击新增诊断按钮,allowAdd:', allowAdd.value);
|
||||||
|
|
||||||
|
// 检查表单ref是否存在
|
||||||
|
if (!proxy.$refs.formRef) {
|
||||||
|
console.error('表单ref不存在');
|
||||||
|
// 直接添加诊断,不经过表单验证
|
||||||
|
addDiagnosisItem();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy.$refs.formRef.validate((valid, fields) => {
|
||||||
|
console.log('表单验证结果:', valid, '错误字段:', fields);
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (!allowAdd.value) {
|
if (!allowAdd.value) {
|
||||||
proxy.$modal.msgWarning('请先填写病历');
|
proxy.$modal.msgWarning('请先填写病历');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
form.value.diagnosisList.push({
|
addDiagnosisItem();
|
||||||
showPopover: false,
|
} else {
|
||||||
name: undefined,
|
console.warn('表单验证失败:', fields);
|
||||||
verificationStatusEnum: 4,
|
// 验证失败时也允许添加(因为是新增空行)
|
||||||
medTypeCode: undefined, // 不设默认值
|
if (allowAdd.value) {
|
||||||
diagSrtNo: form.value.diagnosisList.length + 1,
|
console.log('验证失败但允许添加,强制添加诊断');
|
||||||
iptDiseTypeCode: 2,
|
addDiagnosisItem();
|
||||||
diagnosisDesc: '',
|
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
|
||||||
});
|
|
||||||
if (form.value.diagnosisList.length == 1) {
|
|
||||||
form.value.diagnosisList[0].maindiseFlag = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加诊断项
|
||||||
|
*/
|
||||||
|
function addDiagnosisItem() {
|
||||||
|
console.log('执行添加诊断,当前列表长度:', form.value.diagnosisList.length);
|
||||||
|
form.value.diagnosisList.push({
|
||||||
|
showPopover: false,
|
||||||
|
name: undefined,
|
||||||
|
verificationStatusEnum: 4,
|
||||||
|
medTypeCode: undefined,
|
||||||
|
diagSrtNo: form.value.diagnosisList.length + 1,
|
||||||
|
iptDiseTypeCode: 2,
|
||||||
|
diagnosisDesc: '',
|
||||||
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
|
diagnosisTime: new Date().toLocaleString('zh-CN')
|
||||||
|
});
|
||||||
|
if (form.value.diagnosisList.length == 1) {
|
||||||
|
form.value.diagnosisList[0].maindiseFlag = 1;
|
||||||
|
}
|
||||||
|
console.log('添加完成,新列表长度:', form.value.diagnosisList.length);
|
||||||
|
}
|
||||||
|
|
||||||
// 添加中医诊断
|
// 添加中医诊断
|
||||||
function handleAddTcmDiagonsis() {
|
function handleAddTcmDiagonsis() {
|
||||||
openAddDiagnosisDialog.value = true;
|
openAddDiagnosisDialog.value = true;
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ const queryParams = ref({
|
|||||||
name: '',
|
name: '',
|
||||||
useRanges: [1, 2], // 0 暂不使用 1 全院 2 科室 3 个人
|
useRanges: [1, 2], // 0 暂不使用 1 全院 2 科室 3 个人
|
||||||
organizationId: userStore.orgId,
|
organizationId: userStore.orgId,
|
||||||
|
primaryMenuEnum: 1, // 1-住院病历 (DocTypeEnum.IN_DOC)
|
||||||
});
|
});
|
||||||
const loading = ref(false); // 数据加载状态
|
const loading = ref(false); // 数据加载状态
|
||||||
const currentSelectTemplate = ref({
|
const currentSelectTemplate = ref({
|
||||||
@@ -560,12 +561,12 @@ const loadLatestMedicalRecord = async () => {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
// 获取患者的历史病历记录
|
// 获取患者的历史病历记录
|
||||||
// const res = await getRecordByEncounterIdList({
|
const res = await getRecordByEncounterIdList({
|
||||||
// isPage: 0,
|
isPage: 0,
|
||||||
// encounterId: patientInfo.value.encounterId,
|
encounterId: patientInfo.value.encounterId,
|
||||||
// patientId: patientInfo.value.patientId,
|
patientId: patientInfo.value.patientId,
|
||||||
// definitionId: currentSelectTemplate.value.id,
|
definitionId: currentSelectTemplate.value.id,
|
||||||
// });
|
});
|
||||||
|
|
||||||
const historyRecords = res.data || [];
|
const historyRecords = res.data || [];
|
||||||
if (historyRecords.length > 0) {
|
if (historyRecords.length > 0) {
|
||||||
@@ -623,7 +624,8 @@ const loadLatestMedicalRecord = async () => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('加载最新病历数据失败=====>', error);
|
console.error('加载最新病历数据失败:', error);
|
||||||
|
ElMessage.error('加载最新病历数据失败');
|
||||||
// 出错时也清空选中状态
|
// 出错时也清空选中状态
|
||||||
selectedHistoryRecordId.value = '';
|
selectedHistoryRecordId.value = '';
|
||||||
// 出错时也要清空表单数据,避免显示之前患者的数据
|
// 出错时也要清空表单数据,避免显示之前患者的数据
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ const handleItemClick = (node) => {
|
|||||||
updateLocalPatientInfo(node);
|
updateLocalPatientInfo(node);
|
||||||
|
|
||||||
diagnosisRef.value?.getList();
|
diagnosisRef.value?.getList();
|
||||||
|
diagnosisRef.value?.getDetail(node?.encounterId);
|
||||||
adviceRef.value?.getListInfo();
|
adviceRef.value?.getListInfo();
|
||||||
adviceRef.value?.getDiagnosisInfo();
|
adviceRef.value?.getDiagnosisInfo();
|
||||||
}, 100); // 100ms 防抖延迟
|
}, 100); // 100ms 防抖延迟
|
||||||
@@ -189,6 +190,7 @@ watch(activeTabName, (newTab) => {
|
|||||||
provide('diagnosisInit', (value) => {
|
provide('diagnosisInit', (value) => {
|
||||||
currentPatientInfo.value = value;
|
currentPatientInfo.value = value;
|
||||||
diagnosisRef.value.getList();
|
diagnosisRef.value.getList();
|
||||||
|
diagnosisRef.value.getDetail(value?.encounterId);
|
||||||
});
|
});
|
||||||
provide('getAdviceList', (value) => {
|
provide('getAdviceList', (value) => {
|
||||||
adviceRef.value.getListInfo();
|
adviceRef.value.getListInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user