Skip to content

Commit

Permalink
Merge pull request #3605 from mikhailprivalov/assignments-cancel-fill…
Browse files Browse the repository at this point in the history
…-slot

Лист назначений - отмена записи на слот
  • Loading branch information
urchinpro authored Mar 14, 2024
2 parents 948d427 + cc04c48 commit 1119ed1
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 57 deletions.
25 changes: 13 additions & 12 deletions api/stationar/stationar_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,24 +590,25 @@ def get_assignments(direction_id: int):
create_date = i.data_sozdaniya.strftime("%d.%m.%Y")
research_title = f"{i.research_title}; "
if assignment_tmp.get(i.napravlenie_id):
assignment_tmp[i.napravlenie_id]["research_id"].append(i.research_id)
assignment_tmp[i.napravlenie_id]["research_title"].append(research_title)
assignment_tmp[i.napravlenie_id]["researchId"].append(i.research_id)
assignment_tmp[i.napravlenie_id]["researchTitle"].append(research_title)
else:
assignment_tmp[i.napravlenie_id] = {
"direction_id": i.napravlenie_id,
"research_id": [i.research_id],
"research_title": [research_title],
"create_date": create_date,
"schedule_date": schedule_date,
"who_assigned": fio_assigned,
"time_confirmation": "",
"who_confirm": "",
"directionId": i.napravlenie_id,
"researchId": [i.research_id],
"researchTitle": [research_title],
"createDate": create_date,
"scheduleDate": schedule_date,
"slotPlanId": i.slot_plan_id,
"whoAssigned": fio_assigned,
"timeConfirmation": "",
"whoConfirm": "",
}
if i.total_confirmed:
fio_confirm = shorten_fio(i.who_confirm)
time_confirmation = i.time_confirmation.astimezone(pytz.timezone(TIME_ZONE))
assignment_tmp[i.napravlenie_id]["time_confirmation"] = time_confirmation.strftime("%d.%m.%Y %H:%M")
assignment_tmp[i.napravlenie_id]["who_confirm"] = fio_confirm
assignment_tmp[i.napravlenie_id]["timeConfirmation"] = time_confirmation.strftime("%d.%m.%Y %H:%M")
assignment_tmp[i.napravlenie_id]["whoConfirm"] = fio_confirm

result = [value for value in assignment_tmp.values()]

Expand Down
125 changes: 80 additions & 45 deletions l2-frontend/src/fields/AggregateAssignments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<script setup lang="ts">
import {
computed, onMounted, ref,
computed, getCurrentInstance, onMounted, ref,
} from 'vue';
import {
VeLocale,
Expand Down Expand Up @@ -76,58 +76,19 @@ const props = defineProps({
},
});
const root = getCurrentInstance().proxy.$root;
const store = useStore();
const showSchedule = ref(false);
const currentResearchPk = ref(null);
const currentDirectionPk = ref(null);
const openSchedule = (researchId, directionId) => {
currentResearchPk.value = researchId;
currentDirectionPk.value = directionId;
showSchedule.value = true;
};
const columns = ref([
{
field: 'direction_id', key: 'direction_id', title: '№ напр.', width: 100,
},
{
field: 'research_title', key: 'research_title', title: 'Медицинское вмешательство', align: 'left',
},
{
field: 'create_date', key: 'create_date', title: 'Дата назначения', align: 'center', width: 150,
},
{
field: 'schedule_date',
key: 'schedule_date',
title: 'Расписание',
align: 'center',
width: 100,
renderBodyCell: ({ row }, h) => {
if (row.schedule_date) {
return row.schedule_date;
}
return h('div', { class: 'button' }, [
h('button', {
class: 'transparent-button',
on: {
click: () => {
openSchedule(row.research_id[0], row.direction_id);
},
},
}, 'Записать'),
]);
},
},
{
field: 'who_assigned', key: 'who_assigned', title: 'ФИО назначившего', align: 'center', width: 200,
},
{
field: 'time_confirmation', key: 'time_confirmation', title: 'Дата и время подтверждения', align: 'center', width: 150,
},
{
field: 'who_confirm', key: 'who_confirm', title: 'ФИО подтвердившего', align: 'center', width: 200,
},
]);
const store = useStore();
const pageSize = ref(30);
const page = ref(1);
const pageSizeOption = ref([30, 50, 100, 300]);
Expand All @@ -140,7 +101,7 @@ const pageSizeChange = (size: number) => {
const cellStyleOption = {
bodyCellClass: ({ row }) => {
if (row.schedule_date) {
if (row.scheduleDate) {
return 'table-body-cell-green';
}
return '';
Expand All @@ -165,6 +126,77 @@ const slotFilled = () => {
getAssignments();
};
const cancelSlot = async (researchId, slotPlanId) => {
await store.dispatch(actions.INC_LOADING);
const { ok, message } = await api('/schedule/cancel', {
cardId: props.cardPk,
id: slotPlanId,
serviceId: researchId,
});
await store.dispatch(actions.DEC_LOADING);
if (ok) {
root.$emit('msg', 'ok', 'Отменено');
await getAssignments();
} else {
root.$emit('msg', 'error', message);
}
await store.dispatch(actions.DEC_LOADING);
};
const columns = ref([
{
field: 'directionId', key: 'directionId', title: '№ напр.', width: 100,
},
{
field: 'researchTitle', key: 'researchTitle', title: 'Медицинское вмешательство', align: 'left',
},
{
field: 'createDate', key: 'createDate', title: 'Дата назначения', align: 'center', width: 150,
},
{
field: 'scheduleDate',
key: 'scheduleDate',
title: 'Расписание',
align: 'center',
width: 150,
renderBodyCell: ({ row }, h) => {
if (row.scheduleDate) {
return h('div', {}, [
h('p', {}, row.scheduleDate),
h('button', {
class: 'transparent-button transparent-button-small',
on: {
click: () => {
cancelSlot(row.researchId[0], row.slotPlanId);
},
},
}, 'Отменить запись'),
]);
}
return h('div', { class: 'button' }, [
h('button', {
class: 'transparent-button',
on: {
click: () => {
openSchedule(row.researchId[0], row.directionId);
},
},
}, 'Записать'),
]);
},
},
{
field: 'whoAssigned', key: 'whoAssigned', title: 'ФИО назначившего', align: 'center', width: 200,
},
{
field: 'timeConfirmation', key: 'timeConfirmation', title: 'Дата и время подтверждения', align: 'center', width: 150,
},
{
field: 'whoConfirm', key: 'whoConfirm', title: 'ФИО подтвердившего', align: 'center', width: 200,
},
]);
const printForm = () => {
window.open(`/forms/pdf?type=107.03&&hosp_pk=${props.direction}`);
};
Expand Down Expand Up @@ -217,6 +249,9 @@ onMounted(getAssignments);
color: #FFF;
}
}
.transparent-button-small {
padding: 0;
}
.table-body-cell-green {
background: #a9cfbb !important;
}
Expand Down

0 comments on commit 1119ed1

Please sign in to comment.