-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3239 from mikhailprivalov/jsonForZip_pc
Json for zip pc
- Loading branch information
Showing
26 changed files
with
1,121 additions
and
445 deletions.
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
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.