* добавил исход спец контингенту

* оптимизация обновления при редактировании спец контингента
* добавил поддержку заключительных диагнозов
* изменил определение законченной операции
* добавил поддержку исхода операции
* добавил определение отмены для операции через назначение
* работа над диапазонами календарей, подсчет статистики
* добавил статусы отчетов и подкорректировал привязку спец контингента к отчету
* добавил новые сервисы для будущего кеширования
* частичное разделение логики подсчета пациентов
This commit is contained in:
brusnitsyn
2026-04-22 20:35:39 +09:00
parent 2041ab54ea
commit 719eb1403f
39 changed files with 1458 additions and 763 deletions

View File

@@ -14,7 +14,6 @@ const patientStatuses = [
'special-plan',
'special-emergency',
'special-observation',
'special-reanimation',
'special-outcome-discharged',
'special-outcome-deceased',
'special-outcome-transferred',
@@ -260,6 +259,17 @@ export const useReportStore = defineStore('reportStore', () => {
})
})
const getSpecialStatusByPatient = (patient) => {
if (!patient) return null
if (patient.is_current) {
return patient.patient_kind ? `special-${patient.patient_kind}` : null
}
if (!patient.outcome_type) return null
return `special-outcome-${patient.outcome_type}`
}
const getDataOnReportDate = async () => {
await reloadReportPage()
}
@@ -276,19 +286,30 @@ export const useReportStore = defineStore('reportStore', () => {
userId: reportInfo.value.report.userId,
departmentId: reportInfo.value.department.department_id,
reportId: reportInfo.value.report.report_id,
status: reportInfo.value?.report?.status ?? 'draft',
...assignForm
}
router.post('/report', form, {
onSuccess: () => {
window.$message.success('Отчет сохранен')
window.$message.success(form.status === 'submitted' ? 'Отчет опубликован' : 'Черновик сохранен')
}
})
}
const createManualPatient = async (payload) => {
await axios.post('/api/report/manual-patients', payload)
await reloadReportPage()
const response = await axios.post('/api/report/manual-patients', payload)
const reportId = response.data?.report_id
if (reportId) {
reportInfo.value = {
...reportInfo.value,
report: {
...(reportInfo.value?.report ?? {}),
report_id: reportId,
}
}
}
const status = `special-${payload.patient_kind}`
@@ -299,9 +320,13 @@ export const useReportStore = defineStore('reportStore', () => {
}
const setManualPatientOutcome = async (departmentPatientId, payload) => {
await axios.post(`/api/report/manual-patients/${departmentPatientId}/outcome`, payload)
await reloadReportPage()
await loadAllStatusCounts(true)
const response = await axios.post(`/api/report/manual-patients/${departmentPatientId}/outcome`, payload)
const targetStatus = getSpecialStatusByPatient(response.data)
await Promise.all([
...(targetStatus ? [loadPatientsByStatus(targetStatus, { resetPage: true })] : []),
loadAllStatusCounts(true),
])
}
const updateManualPatient = async (departmentPatientId, payload, options = {}) => {
@@ -313,8 +338,6 @@ export const useReportStore = defineStore('reportStore', () => {
const reloadStatuses = Array.from(new Set((options.reloadStatuses ?? []).filter(Boolean)))
await reloadReportPage()
await Promise.all([
...reloadStatuses.map((status) => loadPatientsByStatus(status, { resetPage: true })),
loadAllStatusCounts(true),