-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json for zip pc #3239
Merged
Merged
Json for zip pc #3239
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
67e8902
uuid для должности подразделения
urchinpro 02f72c2
uuid для аттрибутов
urchinpro 359f09f
.
urchinpro 21557bb
fix: cpp xmlZip
urchinpro a4cd87a
fix: cpp xmlZip
urchinpro 7c32a09
Merge branch 'develop' into jsonForZip_pc
urchinpro 4c88104
* Номер строки - считает от общего кол-ва
Wellheor1 fed7301
* печать одного человека
Wellheor1 c55ff0e
* fix сохранения логов
Wellheor1 0ea3b61
Merge branch 'develop' into mex-exam-fix
Wellheor1 df0e0e7
* fix - оч много итераций)
Wellheor1 e352e41
Merge branch 'develop' into jsonForZip_pc
urchinpro 9f0f5c4
*переключение компании - очищение selectedCards
Wellheor1 580c244
* Проверка на наличие дефолтных вредных факторо в local_settings
Wellheor1 6e20b63
Merge branch 'develop' into mex-exam-fix
Wellheor1 9c0f565
* fix lint semicolon
Wellheor1 2b3113d
Merge remote-tracking branch 'origin/mex-exam-fix' into mex-exam-fix
Wellheor1 76b1f63
* Исключения id услуг
Wellheor1 3127f6e
* Исключение услуг для печати по одному
Wellheor1 74aec17
xml jinja
urchinpro a577e93
Merge branch 'develop' into jsonForZip_pc
urchinpro bd62a5b
* fix
Wellheor1 b4c6946
.
urchinpro e038f6b
Merge branch 'cpp' into jsonForZip_pc
urchinpro 9130e11
ЦПП - отправка
Wellheor1 4a9a014
.
Wellheor1 d9533eb
Merge branch 'mex-exam-fix' into cpp-send-status
Wellheor1 a4f9314
* Отправка в ЦПП - фронт + api
Wellheor1 2d7ce8c
* .
Wellheor1 7f10c50
get dta for xml
urchinpro 47df33d
.
urchinpro 82334ba
Merge branch 'cpp-send-status' into jsonForZip_pc
urchinpro c901fad
.
urchinpro 960701a
.
urchinpro c047bcd
.
urchinpro 4f7a4a0
генерация zip для отправки в ЦПП
urchinpro fdf2d63
генерация zip для отправки в ЦПП
urchinpro cfd0b27
генерация zip для отправки в ЦПП
urchinpro 3f98361
fix-ы pep
urchinpro 73dbc65
psycopg2-binary = "^2.9.5"
urchinpro 099256f
.
urchinpro 0ba512c
.
urchinpro 5057ce0
fix
urchinpro 2f8648f
fix
urchinpro dc75776
.
urchinpro 02b1648
Merge remote-tracking branch 'origin/jsonForZip_pc' into jsonForZip_pc
urchinpro a7abac8
.
urchinpro a1a0b21
Update utils/nsi_directories.py
urchinpro 6d4a57a
Update forms/views.py
urchinpro 914001f
Update utils/nsi_directories.py
urchinpro 59dbc8c
Update utils/nsi_directories.py
urchinpro 4043fb9
Update api/views.py
urchinpro a340c0a
Update api/views.py
urchinpro 89a9de2
Update api/directions/views.py
urchinpro 942024d
Update utils/nsi_directories.py
urchinpro ae21e7a
Update api/directions/views.py
urchinpro c87dcd4
rename to jinaja
urchinpro 22fda0a
Merge remote-tracking branch 'origin/jsonForZip_pc' into jsonForZip_pc
urchinpro bbda8c0
название ф-ла хранить в модели полностью с расширением
urchinpro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ def as_json(price): | |
"end": price.date_end, | ||
"company": company_id, | ||
"companyTitle": company_title, | ||
"symbolCode": price.symbol_code, | ||
"uuid": str(price.uuid), | ||
} | ||
return json_data | ||
|
@@ -161,6 +162,7 @@ class Company(models.Model): | |
contract = models.ForeignKey(Contract, blank=True, null=True, db_index=True, on_delete=models.CASCADE) | ||
email = models.CharField(max_length=128, blank=True, default="", help_text="email") | ||
uuid = models.UUIDField(default=uuid.uuid4, editable=False, help_text="UUID, генерируется автоматически", db_index=True) | ||
cpp_send = models.BooleanField(default=False, help_text='отправлять в ЦПП', db_index=True) | ||
|
||
def __str__(self): | ||
return "{}".format(self.title) | ||
|
@@ -201,7 +203,8 @@ def as_json(company): | |
"kpp": company.kpp, | ||
"bik": company.bik, | ||
"contractId": company.contract_id, | ||
"uuid": company.uuid, | ||
"uuid": str(company.uuid), | ||
"cppSend": company.cpp_send, | ||
} | ||
return json_data | ||
|
||
|
@@ -210,6 +213,7 @@ class CompanyDepartment(models.Model): | |
title = models.CharField(max_length=511, help_text="Наименование отдела", db_index=True) | ||
hide = models.BooleanField(default=False, help_text="Скрыть", db_index=True) | ||
company = models.ForeignKey(Company, blank=True, null=True, db_index=True, on_delete=models.CASCADE) | ||
uuid = models.UUIDField(default=uuid.uuid4, editable=False, help_text="UUID, генерируется автоматически", db_index=True) | ||
|
||
def __str__(self): | ||
return "{}".format(self.title) | ||
|
@@ -246,7 +250,6 @@ def get_by_date(date: str, company_id: int, month: bool = False) -> list[dict]: | |
else: | ||
date_start = date | ||
date_end = date | ||
result = [] | ||
last_date_year = f"{current_year()}-12-31" | ||
examination_data = get_examination_data(company_id, date_start, date_end, last_date_year) | ||
male = CONTROL_AGE_MEDEXAM.get("м") | ||
|
@@ -287,17 +290,18 @@ def get_by_date(date: str, company_id: int, month: bool = False) -> list[dict]: | |
tmp_patient["research_titles"].append(f"{i.research_title}; ") | ||
patient_result[i.card_id] = tmp_patient.copy() | ||
|
||
result = [ | ||
{ | ||
"card_id": k, | ||
"fio": v["fio"], | ||
"harmful_factors": list(set(v["harmful_factors"])), | ||
"research_id": list(set(v["research_id"])), | ||
"research_titles": list(set(v["research_titles"])), | ||
"date": v["date"], | ||
} | ||
for k, v in patient_result.items() | ||
] | ||
result = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [flake8] <303> reported by reviewdog 🐶 |
||
{ | ||
"card_id": k, | ||
"fio": v["fio"], | ||
"harmful_factors": list(set(v["harmful_factors"])), | ||
"research_id": list(set(v["research_id"])), | ||
"research_titles": list(set(v["research_titles"])), | ||
"date": v["date"], | ||
"cppSendStatus": "", | ||
} | ||
for k, v in patient_result.items() | ||
] | ||
|
||
if month: | ||
result = sorted(result, key=lambda d: d["date"]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.db import connection | ||
from laboratory.settings import TIME_ZONE | ||
from utils.db import namedtuplefetchall | ||
|
||
|
||
def get_confirm_research(research_id, date_start, date_end): | ||
with connection.cursor() as cursor: | ||
cursor.execute( | ||
""" | ||
SELECT research_id, doc_confirmation_id, | ||
hh.title as title_mo, | ||
hh.oid as oid_mo | ||
FROM directions_issledovaniya | ||
INNER JOIN users_doctorprofile doctor | ||
ON directions_issledovaniya.doc_confirmation_id = doctor.id | ||
LEFT JOIN hospitals_hospitals hh on doctor.hospital_id = hh.id | ||
|
||
WHERE time_confirmation AT TIME ZONE %(tz)s BETWEEN %(date_start)s and %(date_end)s and research_id=%(research_id)s | ||
""", | ||
params={"research_id": research_id, "date_start": date_start, "date_end": date_end, 'tz': TIME_ZONE}, | ||
) | ||
rows = namedtuplefetchall(cursor) | ||
return rows |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns = [ | ||
path('get-confirm-sign-research', views.get_confirm_sign_research), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import simplejson as json | ||
from rest_framework.response import Response | ||
from integration_framework.researches.sql_func import get_confirm_research | ||
from laboratory.utils import current_time | ||
from rest_framework.decorators import api_view | ||
|
||
|
||
@api_view() | ||
def get_confirm_sign_research(request): | ||
if not hasattr(request.user, "hospitals"): | ||
return Response({"ok": False, "message": "Некорректный auth токен"}) | ||
|
||
body = json.loads(request.body) | ||
research_id = body.get("researchId") | ||
date_start = body.get("dateStart", current_time(only_date=True)) | ||
date_start = f"{date_start} 00:00:01" | ||
date_end = body.get("dateEnd", current_time(only_date=True)) | ||
date_end = f"{date_end} 23:59:59" | ||
result = get_confirm_research(research_id, date_start, date_end) | ||
count_mo = {} | ||
for i in result: | ||
if not count_mo.get(i.title_mo): | ||
count_mo[i.title_mo] = 1 | ||
else: | ||
count_mo[i.title_mo] += 1 | ||
return Response(count_mo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[black-format] reported by reviewdog 🐶