Добавил проверку источника при добавлении пациента и вывод отчетов выбранной мед. сестры

This commit is contained in:
brusnitsyn
2026-06-03 13:56:05 +09:00
parent e758769035
commit 720ca1b39a
8 changed files with 121 additions and 28 deletions

View File

@@ -14,7 +14,7 @@ const props = defineProps({
const emits = defineEmits(['clickEdit', 'clickDelete'])
const onClickEdit = () => {
emits('clickEdit', props.row.id)
emits('clickEdit', props.row)
}
const onClickDelete = () => {
emits('clickDelete', props.row.id)

View File

@@ -168,7 +168,7 @@ const search = (search) => {
const onChangeSearch = (historyId) => {
loadingChangeSelect.value = true
axios.get(`/api/nurse/patients/${historyId}`).then(res => {
axios.get(`/api/nurse/patients/${historyId}?patient_source=mis`).then(res => {
form.value.medical_card_number = res.data.medical_card_number
form.value.full_name = res.data.full_name
form.value.urgency_id = res.data.urgency_id

View File

@@ -27,6 +27,10 @@ const props = defineProps({
reportNurseId: {
type: Number,
default: null
},
patientSource: {
type: String,
default: 'manual'
}
})
@@ -126,7 +130,7 @@ const submit = async () => {
const fetchPatient = async (historyId) => {
loading.value = true
await axios.get(`/api/nurse/patients/${historyId}`)
await axios.get(`/api/nurse/patients/${historyId}?patient_source=${props.patientSource}`)
.then(res => {
form.value.patient_source = res.data.source_type
form.value.patient_id = historyId

View File

@@ -1,6 +1,6 @@
<script setup>
import AppLayout from "../../../Layouts/AppLayout.vue";
import {NFlex, NTag, NDataTable, NButton, NTabs, NTabPane} from 'naive-ui'
import {NFlex, NTag, NDataTable, NButton, NTabs, NTabPane, NSpace} from 'naive-ui'
import AppContainer from "../../../Components/AppContainer.vue";
import AppPanel from "../../../Components/AppPanel.vue";
import ShiftPickerQuery from "../../../Components/ShiftPickerQuery.vue";
@@ -43,7 +43,11 @@ const props = defineProps({
dates: {
type: Array,
default: []
}
},
latestReport: {
type: Object,
default: () => ({ })
},
})
const canEdit = computed(() => props.canSaveReport || props.canEditPastReport)
@@ -51,6 +55,7 @@ const canEdit = computed(() => props.canSaveReport || props.canEditPastReport)
const showAddMedicalHistoryModal = shallowRef(false)
const showEditMedicalHistoryModal = shallowRef(false)
const editHistoryId = ref(null)
const patientSource = ref(null)
const authStore = useAuthStore()
const userDepartment = authStore.userDepartment
const loading = ref(false)
@@ -64,20 +69,30 @@ const patientsByGroup = computed(() => {
recipient: [],
discharged: [],
transferred: [],
};
for (const p of props.patients.data) {
// Группировка по срочности
if (p.patient_urgency === 'urgent') groups.urgent.push(p);
else if (p.patient_urgency === 'planned') groups.planned.push(p);
// Группировка по статусу (дублирование нужно, если один пациент может быть в двух таблицах)
if (groups.hasOwnProperty(p.patient_status)) {
groups[p.patient_status].push(p);
}
reanimations: [],
observables: []
}
return groups;
const patients = props.patients?.data ?? []
for (const raw of patients) {
const p = raw
const flags = p.period_flags ?? {}
const isCurrentAtEnd = flags.current_at_end ?? ['in_department', 'recipient'].includes(p.patient_status)
// Группировка по срочности за период: пациент должен состоять на конец периода.
if (isCurrentAtEnd && (flags.urgent ?? p.patient_urgency === 'urgent')) groups.urgent.push(p)
else if (isCurrentAtEnd && (flags.planned ?? p.patient_urgency === 'planned')) groups.planned.push(p)
// Событийная группировка за период. Один пациент может быть в нескольких группах.
if (flags.recipient ?? p.patient_status === 'recipient') groups.recipient.push(p)
if (flags.current_at_end ?? p.patient_status === 'in_department') groups.in_department.push(p)
if (flags.discharged ?? p.patient_status === 'discharged') groups.discharged.push(p)
if (flags.deceased ?? p.patient_status === 'deceased') groups.deceased.push(p)
if (flags.transferred ?? p.patient_status === 'transferred') groups.transferred.push(p)
}
return groups
})
const columns = [
@@ -115,16 +130,17 @@ const columns = [
row: row,
canEdit: canEdit.value,
onClickDelete: (historyId) => onClickDeleteButton(historyId),
onClickEdit: (historyId) => onClickEditButton(historyId),
onClickEdit: (row) => onClickEditButton(row),
}
)
}
}
]
const onClickEditButton = (historyId) => {
const onClickEditButton = (row) => {
showEditMedicalHistoryModal.value = true
editHistoryId.value = historyId
editHistoryId.value = row.id
patientSource.value = row.source
}
const onClickDeleteButton = async (historyId) => {
@@ -158,6 +174,17 @@ const submit = () => {
})
}
const reportCreator = computed(() => {
if (props.latestReport === null) return ''
if (props.latestReport.doctor.LPUDoctorID === 0) return 'Отчет создан системой'
else return `Отчет создан: ${props.latestReport.doctor.FAM_V} ${props.latestReport.doctor.IM_V} ${props.latestReport.doctor.OT_V}`
})
const reportCreatorType = computed(() => {
if (props.latestReport === null) return 'warning'
if (props.latestReport.doctor.LPUDoctorID === 0) return 'error'
else return 'warning'
})
const formattedLabel = (word, count) => {
return `${word} (${count})`
}
@@ -168,9 +195,14 @@ const formattedLabel = (word, count) => {
<AppContainer>
<AppPanel>
<NFlex justify="space-between" align="center">
<NTag type="info" :bordered="false">
{{ department?.name_full ?? userDepartment.name_full }}
</NTag>
<NSpace>
<NTag type="info" :bordered="false">
{{ department?.name_full ?? userDepartment.name_full }}
</NTag>
<NTag v-if="props.latestReport" :type="reportCreatorType" :bordered="false">
{{ reportCreator }}
</NTag>
</NSpace>
<DatePickerQuery :date="dates" :is-head-or-admin="true" class="text-lg!" hint />
</NFlex>
</AppPanel>
@@ -238,7 +270,7 @@ const formattedLabel = (word, count) => {
</NButton>
</AppContainer>
<AddMedicalHistoryModal v-model:show="showAddMedicalHistoryModal" />
<EditMedicalHistoryModal v-model:show="showEditMedicalHistoryModal" :history-id="editHistoryId" :report-nurse-id="props.reportNurseId" />
<EditMedicalHistoryModal v-model:show="showEditMedicalHistoryModal" :history-id="editHistoryId" :patient-source="patientSource" :report-nurse-id="props.reportNurseId" />
</AppLayout>
</template>