Skip to content

Commit

Permalink
переотправлять направления без приема пробирок
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro committed Sep 20, 2023
1 parent c510b8e commit a7d1c21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ftp_orders/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ftp_orders.sql_func import get_tubesregistration_id_by_iss
from hospitals.models import Hospitals
from directory.models import Researches, Fractions
from laboratory.settings import BASE_DIR
from laboratory.settings import BASE_DIR, NEED_RECIEVE_TUBE_TO_PUSH_ORDER
from laboratory.utils import current_time
from slog.models import Log
from users.models import DoctorProfile
Expand Down Expand Up @@ -661,14 +661,17 @@ def process_push_orders():
if dir_external not in directions:
directions.append(dir_external)

for direction in directions:
is_recieve = False
for tube in TubesRegistration.objects.filter(issledovaniya__napravleniye=direction).distinct():
is_recieve = True
if tube.time_recive is None:
is_recieve = False
if is_recieve:
directions_to_sync.append(direction)
if NEED_RECIEVE_TUBE_TO_PUSH_ORDER:
for direction in directions:
is_recieve = False
for tube in TubesRegistration.objects.filter(issledovaniya__napravleniye=direction).distinct():
is_recieve = True
if tube.time_recive is None:
is_recieve = False
if is_recieve:
directions_to_sync.append(direction)
else:
directions_to_sync.extend(directions)

ftp_connection.log(f"Directions to sync: {[d.pk for d in directions_to_sync]}")

Expand Down
1 change: 1 addition & 0 deletions laboratory/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ def __getitem__(self, item):
ECP_SEARCH_PATIENT = {}
DAYS_AGO_SEARCH_RESULT = {} # {"isLab: 90", "isInstrument: 365"}
NEED_ORDER_DIRECTION_FOR_DEFAULT_HOSPITAL = False
NEED_RECIEVE_TUBE_TO_PUSH_ORDER = False

try:
from laboratory.local_settings import * # noqa: F403,F401
Expand Down

0 comments on commit a7d1c21

Please sign in to comment.