From 470edf7bab155da9f6e44141199e28301be41e0c Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 13:15:58 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B9=D1=81=20-=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BE=D0=B1=D1=8F=D0=B7=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=BE=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=D0=B2=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/views.py b/api/views.py index 26ae4d3ed4..773936f08a 100644 --- a/api/views.py +++ b/api/views.py @@ -2682,19 +2682,19 @@ def update_price(request): if request_data.get("typePrice") == "Работодатель": current_price = PriceName( title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], company_id=request_data["company"], - contract_number=request_data["contractNumber"] + contract_number=request_data.get("contractNumber") ) elif request_data.get("typePrice") == "Заказчик": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() current_price = PriceName( title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, subcontract=True, - contract_number=request_data["contractNumber"] + contract_number=request_data.get("contractNumber") ) elif request_data.get("typePrice") == "Внешний исполнитель": hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first() current_price = PriceName( title=request_data["title"], symbol_code=request_data["code"], date_start=request_data["start"], date_end=request_data["end"], hospital=hospital, external_performer=True, - contract_number=request_data["contractNumber"] + contract_number=request_data.get("contractNumber") ) if current_price: current_price.save() From 21147a5347fa907faade84f2763f615cf0fb4030 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 13:26:42 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=D0=9B=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20getPrices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l2-frontend/src/pages/Billing/index.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index bf5bcc695d..109a4b9fec 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -415,7 +415,6 @@ watch(selectedCompany, () => { if (selectedCompany.value) { selectedBilling.value = null; getBillings(); - getPrices(); } else { selectedBilling.value = null; } From d1e6cf697a0422169c7fdefe94078c1d9313a0ef Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 13:29:03 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=D0=9B=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=20getPrices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l2-frontend/src/pages/Billing/index.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index 109a4b9fec..eeaa8ea98b 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -300,8 +300,6 @@ const getBilling = async () => { currentBillingData.value = result; colTable.value = columns; services.value = tableData; - const { data } = await api('contracts/get-hospital-prices', { ...currentBillingData }); - prices.value = data; selectedPrice.value = result.priceId; }; From 4582b7b56f29b8f67f92edcff83f6a5e5e81f5b7 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 13:41:57 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=D0=9B=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D1=8B=20getPrice,=20=D0=BB=D0=B8?= =?UTF-8?q?=D1=88=D0=BD=D0=B8=D0=B5=20watcher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l2-frontend/src/pages/Billing/index.vue | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index eeaa8ea98b..2d2a2b1e30 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -276,6 +276,7 @@ const currentBillingData = ref({ registryNumber: '', }); +const datesFilled = computed(() => !!(currentBillingData.value.dateStart && currentBillingData.value.dateEnd)); const clearBilling = () => { currentBillingData.value = { ...billingTemplate.value }; }; @@ -397,14 +398,8 @@ const createBilling = async () => { } }; -watch(() => currentBillingData.value.dateStart, (newValue, oldValue) => { - if ((newValue !== oldValue) && currentBillingData.value.dateEnd) { - getPrices(); - } -}); - -watch(() => currentBillingData.value.dateEnd, (newValue, oldValue) => { - if ((newValue !== oldValue) && currentBillingData.value.dateStart) { +watch(() => [currentBillingData.value.dateStart, currentBillingData.value.dateEnd], () => { + if (datesFilled.value) { getPrices(); } }); From 4043df3097f8d4d8414df3d5978fdbba5c114bfa Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 13:52:22 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=D0=BD=D0=B5=20=D0=B2=D1=8B=D0=B2=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=82=D1=81=D1=8F=20=D0=BF=D1=83=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B5=20"=D0=98=D1=82=D0=BE=D0=B3=D0=BE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/contracts/func.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/api/contracts/func.py b/api/contracts/func.py index a9af69b72a..bae7cfdf1e 100644 --- a/api/contracts/func.py +++ b/api/contracts/func.py @@ -147,18 +147,19 @@ def structure_table(data_researches): "executeDate": "", "summ": sum_patient, } - patient_data["total"] = { - "serialNumber": "", - "patientFio": "Итого", - "patientBirthDay": "", - "tubeNumber": "", - "coast": "", - "researchTitle": "", - "internalId": "", - "codeNMU": "", - "executeDate": "", - "summ": total, - } + if patient_data: + patient_data["total"] = { + "serialNumber": "", + "patientFio": "Итого", + "patientBirthDay": "", + "tubeNumber": "", + "coast": "", + "researchTitle": "", + "internalId": "", + "codeNMU": "", + "executeDate": "", + "summ": total, + } table_data = [v for v in patient_data.values()] return {"columns": columns, "tableData": table_data} From 962aaa5865d97755ed93ac684e5c0cd15831eefe Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 13:55:37 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=D0=9B=D0=B8=D1=88=D0=BD=D1=8F=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/contracts/func.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/api/contracts/func.py b/api/contracts/func.py index bae7cfdf1e..8f5a38a897 100644 --- a/api/contracts/func.py +++ b/api/contracts/func.py @@ -20,26 +20,25 @@ def researches_for_billing(type_price, company_id, date_start, date_end, price_i research_coast = {coast.research_id: float(coast.coast) for coast in coast_research_price} result = {} iss_data = set() - if sql_result: - for i in sql_result: - iss_data.add(i.iss_id) - current_data = { - "research_id": i.research_id, - "research_title": i.research_title, - "date_confirm": i.date_confirm, - "patient_fio": f"{i.patient_family} {i.patient_name} {i.patient_patronymic}", - "patient_born": i.ru_date_born, - "tube_number": i.tube_number, - "coast": research_coast.get(i.research_id, 0), - "code_nmu": i.code_nmu, - "internal_code": i.internal_code, - "execute_date": i.date_confirm, - "dir_id": i.dir_id, - } - if not result.get(i.patient_card_num): - result[i.patient_card_num] = [current_data.copy()] - else: - result[i.patient_card_num].append(current_data.copy()) + for i in sql_result: + iss_data.add(i.iss_id) + current_data = { + "research_id": i.research_id, + "research_title": i.research_title, + "date_confirm": i.date_confirm, + "patient_fio": f"{i.patient_family} {i.patient_name} {i.patient_patronymic}", + "patient_born": i.ru_date_born, + "tube_number": i.tube_number, + "coast": research_coast.get(i.research_id, 0), + "code_nmu": i.code_nmu, + "internal_code": i.internal_code, + "execute_date": i.date_confirm, + "dir_id": i.dir_id, + } + if not result.get(i.patient_card_num): + result[i.patient_card_num] = [current_data.copy()] + else: + result[i.patient_card_num].append(current_data.copy()) return {"result": result, "issIds": list(iss_data), "priceId": price_id} From e32a4a82ac37a00da40baf85bc4e95fad9f274f2 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 14:15:10 +0800 Subject: [PATCH 07/19] =?UTF-8?q?*=20=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=D1=81=D1=82=D0=BE=D1=87=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=84=D0=B8=D0=BD=D0=B0=D0=BD=D1=81=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20*=20=D0=9E=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D1=87=D0=B5=D1=82=D0=BE=D0=B2=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/contracts/func.py | 2 ++ api/contracts/views.py | 4 +++- l2-frontend/src/pages/Billing/index.vue | 17 ++++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/api/contracts/func.py b/api/contracts/func.py index 8f5a38a897..0250bd610d 100644 --- a/api/contracts/func.py +++ b/api/contracts/func.py @@ -12,6 +12,8 @@ def researches_for_billing(type_price, company_id, date_start, date_end, price_i hospital_id = company_id base = CardBase.objects.filter(internal_type=True).first() finsource = IstochnikiFinansirovaniya.objects.filter(base=base, title__in=["Договор"], hide=False).first() + if not finsource: + return {"result": [], "issIds": [], "priceId": "", "message": "Нет источника финансирования 'Договор'"} if not is_confirmed: sql_result = statistics_research_by_hospital_for_external_orders(date_start, date_end, hospital_id, finsource.pk, price_id) else: diff --git a/api/contracts/views.py b/api/contracts/views.py index 46478de4bf..61e59d0476 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -131,5 +131,7 @@ def get_billing(request): result = BillingRegister.get_billing(billing_id) type_price = request_data.get("typeCompany") data = researches_for_billing(type_price, result["hospitalId"], result["dateStart"], result["dateEnd"], result["priceId"], result["isConfirmed"], billing_id) + if not data["result"]: + return JsonResponse({"ok": False, "result": [],"message": data["message"],}) structure_data = structure_table(data) - return JsonResponse({"result": result, **structure_data}) + return JsonResponse({"ok": True, "result": result, "message": "", **structure_data}) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index 2d2a2b1e30..51fa02fbd5 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -293,15 +293,21 @@ const getPrices = async () => { const getBilling = async () => { await store.dispatch(actions.INC_LOADING); - const { result, columns, tableData } = await api('contracts/get-billing', { + const { + ok, result, message, columns, tableData, + } = await api('contracts/get-billing', { billingId: selectedBilling.value, typeCompany: selectedType.value, }); await store.dispatch(actions.DEC_LOADING); - currentBillingData.value = result; - colTable.value = columns; - services.value = tableData; - selectedPrice.value = result.priceId; + if (ok) { + currentBillingData.value = result; + colTable.value = columns; + services.value = tableData; + selectedPrice.value = result.priceId; + } else { + root.$emit('msg', 'error', message); + } }; watch(selectedBilling, () => { @@ -391,6 +397,7 @@ const createBilling = async () => { await store.dispatch(actions.DEC_LOADING); if (ok) { root.$emit('msg', 'ok', 'Создано'); + await getBillings(); selectedBilling.value = billingInfo; } else { root.$emit('msg', 'error', 'ошибка'); From 4db1b465cf14d4f752551b7f91723ae72b33b2b5 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 14:18:36 +0800 Subject: [PATCH 08/19] fix --- api/contracts/func.py | 4 ++-- api/contracts/views.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/contracts/func.py b/api/contracts/func.py index 0250bd610d..b151a0c3a9 100644 --- a/api/contracts/func.py +++ b/api/contracts/func.py @@ -13,7 +13,7 @@ def researches_for_billing(type_price, company_id, date_start, date_end, price_i base = CardBase.objects.filter(internal_type=True).first() finsource = IstochnikiFinansirovaniya.objects.filter(base=base, title__in=["Договор"], hide=False).first() if not finsource: - return {"result": [], "issIds": [], "priceId": "", "message": "Нет источника финансирования 'Договор'"} + return {"ok": False, "result": [], "issIds": [], "priceId": "", "message": "Нет источника финансирования 'Договор'"} if not is_confirmed: sql_result = statistics_research_by_hospital_for_external_orders(date_start, date_end, hospital_id, finsource.pk, price_id) else: @@ -41,7 +41,7 @@ def researches_for_billing(type_price, company_id, date_start, date_end, price_i result[i.patient_card_num] = [current_data.copy()] else: result[i.patient_card_num].append(current_data.copy()) - return {"result": result, "issIds": list(iss_data), "priceId": price_id} + return {"ok": True, "result": result, "issIds": list(iss_data), "priceId": price_id} def get_confirm_data_for_billing(price_id, billing_id): diff --git a/api/contracts/views.py b/api/contracts/views.py index 61e59d0476..1417b39db6 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -131,7 +131,7 @@ def get_billing(request): result = BillingRegister.get_billing(billing_id) type_price = request_data.get("typeCompany") data = researches_for_billing(type_price, result["hospitalId"], result["dateStart"], result["dateEnd"], result["priceId"], result["isConfirmed"], billing_id) - if not data["result"]: - return JsonResponse({"ok": False, "result": [],"message": data["message"],}) + if not data["ok"]: + return JsonResponse({"ok": data["ok"], "result": [], "message": data["message"]}) structure_data = structure_table(data) return JsonResponse({"ok": True, "result": result, "message": "", **structure_data}) From b8c26abe2510d1a684ef983812adf7c322da33e1 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 14:20:37 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D1=82=D0=B2=D0=B5=D1=80=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8=D0=B8=20?= =?UTF-8?q?-fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l2-frontend/src/pages/Billing/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index 51fa02fbd5..d4ed3bdb50 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -353,7 +353,7 @@ const confirmBilling = async () => { await store.dispatch(actions.DEC_LOADING); if (ok) { await getBilling(); - root.$emit('msg', 'ok', `${billingInfo} сохранен`); + root.$emit('msg', 'ok', 'Счёт подтверждён'); } else { root.$emit('msg', 'error', 'ошибка'); } From d3bc5227eb6ffd00f8f78188f23dfbd42dd3903a Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 14:21:08 +0800 Subject: [PATCH 10/19] . --- l2-frontend/src/pages/Billing/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index d4ed3bdb50..f7257e11d7 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -348,7 +348,7 @@ const confirmBilling = async () => { const priceId = selectedPrice.value; await store.dispatch(actions.INC_LOADING); const { - ok, billingInfo, + ok, } = await api(apiPoint, { ...billingData, priceId }); await store.dispatch(actions.DEC_LOADING); if (ok) { From c172faca5034b80a3e9160c36f503f95b2c42820 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 14:22:36 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=20=D1=81=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20-=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- l2-frontend/src/pages/Billing/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l2-frontend/src/pages/Billing/index.vue b/l2-frontend/src/pages/Billing/index.vue index f7257e11d7..145a1ec67a 100644 --- a/l2-frontend/src/pages/Billing/index.vue +++ b/l2-frontend/src/pages/Billing/index.vue @@ -365,12 +365,12 @@ const cancelBilling = async () => { const apiPoint = 'contracts/cancel-billing'; await store.dispatch(actions.INC_LOADING); const { - ok, billingInfo, + ok, } = await api(apiPoint, { id: selectedBilling.value }); await store.dispatch(actions.DEC_LOADING); if (ok) { await getBilling(); - root.$emit('msg', 'ok', `${billingInfo} Отменен`); + root.$emit('msg', 'ok', 'Счёт сброшен'); } else { root.$emit('msg', 'error', 'ошибка'); } From 5a3137fc5f387510f662a74d69da3e287cb02e16 Mon Sep 17 00:00:00 2001 From: Well Date: Sat, 18 May 2024 14:31:52 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BD=D0=B0=D0=BB=D0=B8=D1=87=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20-=20logo.png?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- forms/xlsx/billing/billing_func.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/forms/xlsx/billing/billing_func.py b/forms/xlsx/billing/billing_func.py index 03eb17ae11..9ff66f9f09 100644 --- a/forms/xlsx/billing/billing_func.py +++ b/forms/xlsx/billing/billing_func.py @@ -46,10 +46,12 @@ def fill_billing(ws1, data, row=14): style_border2.border = Border(left=bd, top=bd, right=bd, bottom=bd) style_border2.font = Font(bold=False, size=10) style_border2.alignment = Alignment(wrap_text=True, horizontal="center", vertical="center") - logo = Image(os.path.join(BASE_DIR, "forms", "xlsx", "media", "logo.png")) - logo.height = 130 - logo.width = 920 - ws1.add_image(logo, "A1") + logo_exists = os.path.exists(f"{BASE_DIR}/forms/xlsx/media/logo.png") + if logo_exists: + logo = Image(os.path.join(BASE_DIR, "forms", "xlsx", "media", "logo.png")) + logo.height = 130 + logo.width = 920 + ws1.add_image(logo, "A1") ws1.merge_cells("A9:L11") megre_cell = ws1["A9"] megre_cell.value = "Реестр № 1YYYY от 00 марта 2024 года \n оказанных медицинских услуг по договору №00 - 00/00/2024 \n с 00.00.00 по 00.00.00" From 027d27161ab8489d59a982a566d6e6afc92fbf9f Mon Sep 17 00:00:00 2001 From: Well Date: Sun, 19 May 2024 11:56:34 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=D0=9B=D0=BE=D0=B3=D0=B8=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D1=82=D0=B2=D0=B5=D1=80=D0=B6=D0=B4=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F/=D1=81=D0=B1=D1=80=D0=B0=D1=81=D1=8B=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=81=D1=87=D0=B5=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/contracts/views.py | 22 +++++++++++++++++++++- slog/models.py | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/api/contracts/views.py b/api/contracts/views.py index 1417b39db6..84ec599238 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -8,6 +8,8 @@ from directions.models import Issledovaniya from directory.models import Researches from laboratory.decorators import group_required +from slog.models import Log +from users.models import DoctorProfile from utils.response import status_response @@ -70,6 +72,15 @@ def confirm_billing(request): set_billing_id_for_iss = Issledovaniya.save_billing(billing_id, iss_ids) data_confirm_billing = get_confirm_data_for_billing(price_id, billing_id) raw_document_pk = RawDocumentBillingRegister.create_raw_billing_data(billing_id, data_confirm_billing) + Log.log( + billing_data.pk, + 200000, + request.user.doctorprofile, + { + "billing": {"pk": billing_data.pk, "date_from": str(billing_data.date_from), "registry_number": billing_data.registry_number}, + "who_confirm": {"pk": user_who_create.pk, "family": user_who_create.family, "name": user_who_create.name, "patronymic": user_who_create.patronymic} + } + ) structure_data = structure_table(data) return JsonResponse({"ok": is_confirm_billing and set_billing_id_for_iss and raw_document_pk, **structure_data}) @@ -81,12 +92,21 @@ def cancel_billing(request): billing_id = body.get("id") billing_data = BillingRegister.objects.filter(pk=billing_id).first() if billing_data.is_confirmed: - user_who_create = request.user.doctorprofile + user_who_create : DoctorProfile = request.user.doctorprofile with transaction.atomic(): billing_data.is_confirmed = False billing_data.who_create = user_who_create billing_data.save() Issledovaniya.cancel_billing(billing_id) + Log.log( + billing_data.pk, + 200001, + request.user.doctorprofile, + { + "billing": {"pk": billing_data.pk, "date_from": str(billing_data.date_from), "registry_number": billing_data.registry_number}, + "who_cancel": {"pk": user_who_create.pk, "family": user_who_create.family, "name": user_who_create.name, "patronymic": user_who_create.patronymic} + }, + ) return JsonResponse({"ok": True}) diff --git a/slog/models.py b/slog/models.py index a80cb2fa21..0013a77d6f 100644 --- a/slog/models.py +++ b/slog/models.py @@ -161,6 +161,8 @@ class Log(models.Model): (190002, 'FTP HL7: результат pull'), (190003, 'FTP HL7: результат push'), (190004, 'REST: заказ принятие'), + (200000, 'Счет на оплату: подтверждение'), + (200001, 'Счет на оплату: сброс подтверждения') ) # Виды событий, которые могут быть очищены From dbc1fb92fb06f3e486298b0ac97d9fbca2a06ad7 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Sun, 19 May 2024 11:57:22 +0800 Subject: [PATCH 14/19] Update api/contracts/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/contracts/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/contracts/views.py b/api/contracts/views.py index 84ec599238..25513a0b06 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -78,8 +78,8 @@ def confirm_billing(request): request.user.doctorprofile, { "billing": {"pk": billing_data.pk, "date_from": str(billing_data.date_from), "registry_number": billing_data.registry_number}, - "who_confirm": {"pk": user_who_create.pk, "family": user_who_create.family, "name": user_who_create.name, "patronymic": user_who_create.patronymic} - } + "who_confirm": {"pk": user_who_create.pk, "family": user_who_create.family, "name": user_who_create.name, "patronymic": user_who_create.patronymic}, + }, ) structure_data = structure_table(data) return JsonResponse({"ok": is_confirm_billing and set_billing_id_for_iss and raw_document_pk, **structure_data}) From 5d38861bb784ed235f0d82be26052ac67d81a0d6 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Sun, 19 May 2024 11:57:28 +0800 Subject: [PATCH 15/19] Update api/contracts/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/contracts/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/contracts/views.py b/api/contracts/views.py index 25513a0b06..75135af07e 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -92,7 +92,7 @@ def cancel_billing(request): billing_id = body.get("id") billing_data = BillingRegister.objects.filter(pk=billing_id).first() if billing_data.is_confirmed: - user_who_create : DoctorProfile = request.user.doctorprofile + user_who_create: DoctorProfile = request.user.doctorprofile with transaction.atomic(): billing_data.is_confirmed = False billing_data.who_create = user_who_create From 3eef939b5ed6a189348bed4e3f9f06b9cc664652 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Sun, 19 May 2024 11:57:34 +0800 Subject: [PATCH 16/19] Update api/contracts/views.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- api/contracts/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/contracts/views.py b/api/contracts/views.py index 75135af07e..18bb44be30 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -104,8 +104,8 @@ def cancel_billing(request): request.user.doctorprofile, { "billing": {"pk": billing_data.pk, "date_from": str(billing_data.date_from), "registry_number": billing_data.registry_number}, - "who_cancel": {"pk": user_who_create.pk, "family": user_who_create.family, "name": user_who_create.name, "patronymic": user_who_create.patronymic} - }, + "who_cancel": {"pk": user_who_create.pk, "family": user_who_create.family, "name": user_who_create.name, "patronymic": user_who_create.patronymic}, + }, ) return JsonResponse({"ok": True}) From 9eaa341a2e99eacf56ee85bf628d951a549cec86 Mon Sep 17 00:00:00 2001 From: Well <72241044+Wellheor1@users.noreply.github.com> Date: Sun, 19 May 2024 11:57:40 +0800 Subject: [PATCH 17/19] Update slog/models.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- slog/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slog/models.py b/slog/models.py index 0013a77d6f..0f025d69c6 100644 --- a/slog/models.py +++ b/slog/models.py @@ -162,7 +162,7 @@ class Log(models.Model): (190003, 'FTP HL7: результат push'), (190004, 'REST: заказ принятие'), (200000, 'Счет на оплату: подтверждение'), - (200001, 'Счет на оплату: сброс подтверждения') + (200001, 'Счет на оплату: сброс подтверждения'), ) # Виды событий, которые могут быть очищены From 787a848c92fb4e60efa0a87fd2dbc1a40fb5ea61 Mon Sep 17 00:00:00 2001 From: Well Date: Sun, 19 May 2024 11:58:26 +0800 Subject: [PATCH 18/19] . --- api/contracts/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/contracts/views.py b/api/contracts/views.py index 18bb44be30..970198b12e 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -92,7 +92,7 @@ def cancel_billing(request): billing_id = body.get("id") billing_data = BillingRegister.objects.filter(pk=billing_id).first() if billing_data.is_confirmed: - user_who_create: DoctorProfile = request.user.doctorprofile + user_who_create = request.user.doctorprofile with transaction.atomic(): billing_data.is_confirmed = False billing_data.who_create = user_who_create From 9dbf345b8af809f7e1b921f279c9fb1f0c838095 Mon Sep 17 00:00:00 2001 From: Well Date: Sun, 19 May 2024 11:59:15 +0800 Subject: [PATCH 19/19] . --- api/contracts/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/api/contracts/views.py b/api/contracts/views.py index 970198b12e..feb7e10621 100644 --- a/api/contracts/views.py +++ b/api/contracts/views.py @@ -9,7 +9,6 @@ from directory.models import Researches from laboratory.decorators import group_required from slog.models import Log -from users.models import DoctorProfile from utils.response import status_response