Skip to content

Commit

Permalink
Случаи в истории
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro committed Sep 26, 2023
1 parent 0326357 commit 1b0b7b2
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 12 deletions.
4 changes: 3 additions & 1 deletion api/directions/sql_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk
directory_researches.is_paraclinic,
directory_researches.is_form,
directory_researches.is_microbiology,
directory_researches.is_case,
directory_researches.podrazdeleniye_id,
directions_napravleniya.parent_id as dir_parent_id,
directions_napravleniya.data_sozdaniya as dir_data_sozdaniya,
Expand Down Expand Up @@ -106,7 +107,8 @@ def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk
ud.patronymic,
directions_napravleniya.visit_date,
directions_napravleniya.time_microbiology_receive,
directions_napravleniya.time_gistology_receive
directions_napravleniya.time_gistology_receive,
is_case
FROM t_iss_tubes
LEFT JOIN t_recive
ON t_iss_tubes.tubesregistration_id = t_recive.id_t_recive
Expand Down
11 changes: 8 additions & 3 deletions api/directions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def directions_history(request):
# status: 4 - выписано пользователем, 0 - только выписанные, 1 - Материал получен лабораторией. 2 - результат подтвержден, 3 - направления пациента, -1 - отменено,
if req_status == 4:
user_creater = request.user.doctorprofile.pk
if req_status in [0, 1, 2, 3, 5]:
if req_status in [0, 1, 2, 3, 5, 7]:
patient_card = pk

if req_status == 5:
Expand Down Expand Up @@ -459,6 +459,10 @@ def directions_history(request):
continue
elif type_service == 'is_lab' and (i[11] or i[14] or i[15] or i[16] or i[17] or i[18] or i[19]):
continue
elif req_status == 7 and not i[36]:
continue
elif i[36] and req_status != 7:
continue
if i[0] != last_dir:
status = min(status_set)
if len(lab) > 0:
Expand All @@ -470,7 +474,7 @@ def directions_history(request):
if aux_researches_obj.exists():
aux_researches = [{"pk": i.aux_research.pk, "title": i.aux_research.title} for i in aux_researches_obj]
has_aux = True
if (req_status == 2 and status == 2) or (req_status in [3, 4] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
if (req_status == 2 and status == 2) or (req_status in [3, 4, 7] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
final_result.append(
{
'pk': dir,
Expand Down Expand Up @@ -581,7 +585,7 @@ def directions_history(request):
if aux_researches_obj.exists():
aux_researches = [{"pk": i.aux_research.pk, "title": i.aux_research.title} for i in aux_researches_obj]
has_aux = True
if (req_status == 2 and status == 2) or (req_status in [3, 4] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
if (req_status == 2 and status == 2) or (req_status in [3, 4, 7] and status != -2) or (req_status == 1 and status == 1) or (req_status == 0 and status == 0):
final_result.append(
{
'pk': dir,
Expand Down Expand Up @@ -1442,6 +1446,7 @@ def directions_paraclinic_form(request):
| Q(research__is_monitoring=True)
| Q(research__is_expertise=True)
| Q(research__is_aux=True)
| Q(research__is_case=True)
)
)
.select_related('research', 'research__microbiology_tube', 'research__podrazdeleniye')
Expand Down
9 changes: 5 additions & 4 deletions api/researches/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def researches_by_department(request):
q = DResearches.objects.filter(is_monitoring=True).order_by("title")
elif department_pk == -13:
q = DResearches.objects.filter(is_expertise=True).order_by("title")
elif department_pk == -16:
elif department_pk == -14:
q = DResearches.objects.filter(is_case=True).order_by("title")
else:
q = DResearches.objects.filter(podrazdeleniye__pk=department_pk).order_by("title")
Expand Down Expand Up @@ -407,6 +407,7 @@ def researches_params(request):
def researches_update(request):
response = {"ok": False}
request_data = json.loads(request.body)
print(request_data)
pk = request_data.get("pk", -2)
if pk > -2:
department_pk = request_data.get("department")
Expand Down Expand Up @@ -457,7 +458,7 @@ def researches_update(request):
if tube == -1:
tube = None
stationar_slave = is_simple and -500 >= department_pk > -600 and main_service_pk != 1
desc = stationar_slave or department_pk in [-2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -16]
desc = stationar_slave or department_pk in [-2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -16]
if len(title) > 0 and (desc or Podrazdeleniya.objects.filter(pk=department_pk).exists()):
department = None if desc else Podrazdeleniya.objects.filter(pk=department_pk)[0]
res = None
Expand Down Expand Up @@ -486,7 +487,7 @@ def researches_update(request):
is_application=department_pk == -11,
is_monitoring=department_pk == -12,
is_expertise=department_pk == -13,
is_case=department_pk == -16,
is_case=department_pk == -14,
is_slave_hospital=stationar_slave,
microbiology_tube_id=tube if department_pk == -6 else None,
site_type_id=site_type,
Expand Down Expand Up @@ -530,7 +531,7 @@ def researches_update(request):
res.is_application = department_pk == -11
res.is_monitoring = department_pk == -12
res.is_expertise = department_pk == -13
res.is_case = department_pk == -16
res.is_case = department_pk == -14
res.microbiology_tube_id = tube if department_pk == -6 else None
res.paraclinic_info = info
res.hide = hide
Expand Down
5 changes: 3 additions & 2 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def departments(request):
data = {
"departments": deps,
"can_edit": can_edit,
"types": [*[{"pk": str(x[0]), "title": x[1]} for x in Podrazdeleniya.TYPES if x[0] not in [8, 12] and en.get(x[0], True)], *more_types],
"types": [*[{"pk": str(x[0]), "title": x[1]} for x in Podrazdeleniya.TYPES if x[0] not in [8, 12, 16] and en.get(x[0], True)], *more_types],
}
if hasattr(request, 'plain_response') and request.plain_response:
return data
Expand Down Expand Up @@ -2635,6 +2635,7 @@ def get_price_data(request):
@group_required('Конструктор: Настройка организации')
def update_price(request):
request_data = json.loads(request.body)
print(request_data)
current_price = None
if request_data["id"] == -1:
if request_data.get("typePrice") == "Работодатель":
Expand All @@ -2658,7 +2659,7 @@ def update_price(request):
current_price.title = request_data["title"]
current_price.date_start = request_data["start"]
current_price.date_end = request_data["end"]
if request_data.get("typePrice") == "Профосмотр":
if request_data.get("typePrice") == "Заказчик" or request_data.get("typePrice") == "Работодатель":
current_price.company_id = request_data["company"]
else:
hospital = Hospitals.objects.filter(pk=int(request_data["company"])).first()
Expand Down
4 changes: 2 additions & 2 deletions l2-frontend/src/construct/ParaclinicResearchEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
</div>
</template>
<div
v-if="ex_dep === 7 || ex_dep ===16"
v-if="ex_dep === 7"
class="department-select"
>
<Treeselect
Expand All @@ -480,7 +480,7 @@
>
</div>
</div>
<template v-if="ex_dep !== 7 && ex_dep !== 16">
<template v-if="ex_dep !== 7">
<div
v-for="(group, gi) in orderBy(groups, 'order')"
:key="gi"
Expand Down
1 change: 1 addition & 0 deletions l2-frontend/src/ui-cards/DirectionsHistory/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export default {
{ pk: 4, title: 'Созданы пользователем' },
{ pk: 5, title: 'Договоры пациента' },
{ pk: 6, title: 'Регистратура пациента', module: 'rmisQueue' },
{ pk: 7, title: 'Случаи пациента' },
],
active_type: this.onlyType || 3,
checked_obj: {},
Expand Down
39 changes: 39 additions & 0 deletions l2-frontend/src/ui-cards/SelectedResearches.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@
/>
</td>
</tr>
<tr v-if="needChangeCase">
<th :class="needSelectCase && 'has-error-message'">
Случай пациента:
</th>
<td class="cl-td">
<Treeselect
v-model="research_case"
:multiple="false"
:disable-branch-nodes="true"
class="treeselect-noborder treeselect-wide"
:options="patient_case"
:append-to-body="true"
placeholder="По умолчанию"
:clearable="false"
/>
</td>
</tr>
<tr v-if="direction_purpose_enabled && !hide_params">
<th>Цель направления:</th>
<td class="cl-td">
Expand Down Expand Up @@ -683,6 +700,7 @@ export default {
hospital_department_override: -1,
hospital_overrides: [{ id: -1, label: 'По умолчанию' }],
hospital_override: -1,
research_case: -2,
service_locations: {},
need_update_comment: [],
need_update_localization: [],
Expand All @@ -705,6 +723,7 @@ export default {
researches_direction_params: {},
tableFieldsErrors: {},
selectedCardLocal: null,
patient_case: [{ id: -2, label: ' Не выбрано ' }],
};
},
computed: {
Expand Down Expand Up @@ -763,6 +782,9 @@ export default {
needShowPriceCategory() {
return this.l2_price_with_categories && this.pay_source && this.priceCategories.length > 0 && this.show_additions;
},
needChangeCase() {
return this.$store.getters.modules.l2_case;
},
researches_departments() {
const r = {};
const deps = {
Expand Down Expand Up @@ -833,6 +855,10 @@ export default {
return false;
}
if (this.needSelectCase) {
return false;
}
return !this.researches.find(pk => {
if (!this.form_params[pk]) {
return false;
Expand All @@ -844,6 +870,9 @@ export default {
needSelectHospital() {
return this.canChangeHospitalDirection && this.hospital_override === -1;
},
needSelectCase() {
return this.needChangeCase && this.research_case === -2;
},
need_update_object() {
const r = [];
const toUpd = [...this.need_update_comment];
Expand Down Expand Up @@ -1133,6 +1162,7 @@ export default {
}
this.load_direction_params();
this.load_stationar_deparments();
this.load_patient_open_case();
this.$root.$on('table-field:errors:set', (fieldPk, hasInvalid) => {
this.tableFieldsErrors = {
...this.tableFieldsErrors,
Expand Down Expand Up @@ -1337,6 +1367,7 @@ export default {
this.global_current_direction_param = -1;
this.hospital_department_override = -1;
this.hospital_override = -1;
this.research_case = -1;
this.tableFieldsErrors = {};
},
clear_fin() {
Expand Down Expand Up @@ -1399,6 +1430,14 @@ export default {
this.hospital_department_overrides = [{ id: -1, label: 'По умолчанию' }, ...data];
this.hospital_overrides = [{ id: -1, label: 'По умолчанию' }, ...hospitals];
},
async load_patient_open_case() {
const patienCases = [
{ id: -11, label: ' Терапевт-212121' },
{ id: -12, label: ' Травматолог -23232' },
{ id: -13, label: ' Нвролог-4343434' },
];
this.patient_case = [{ id: -2, label: ' Не выбрано ' }, { id: -1, label: ' Создать новый случай' }, ...patienCases];
},
},
};
</script>
Expand Down

0 comments on commit 1b0b7b2

Please sign in to comment.