Skip to content

Commit

Permalink
Merge branch 'develop' into printResult_formPdf
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro committed Oct 14, 2023
2 parents 441975e + cf7a7c6 commit 38f384d
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 11 deletions.
5 changes: 4 additions & 1 deletion api/laboratory/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ def form(request):
"selectedReference": selected_reference,
"norm": r.get_is_norm(recalc=True)[0] if r else None,
"value": str(r.value if r else '').replace('&lt;', '<').replace('&gt;', '>'),
"comment": str(r.comment if r else '').replace('&lt;', '<').replace('&gt;', '>'),
}
)

Expand Down Expand Up @@ -512,9 +513,11 @@ def save(request):
created = True

value = bleach.clean(r["value"], tags=['sup', 'sub', 'br', 'b', 'i', 'strong', 'a', 'img', 'font', 'p', 'span', 'div']).replace("<br>", "<br/>")
comment = bleach.clean(r.get('comment', ''), tags=['sup', 'sub', 'br', 'b', 'i', 'strong', 'a', 'img', 'font', 'p', 'span', 'div']).replace("<br>", "<br/>").strip()

if not created or value:
if not created or value or comment:
fraction_result.value = value
fraction_result.comment = comment
fraction_result.get_units(needsave=False)
fraction_result.iteration = 1

Expand Down
3 changes: 2 additions & 1 deletion appconf/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class SettingManager:
VERSION = f"{laboratory.VERSION}-10"
VERSION = f"{laboratory.VERSION}-12"
WARMUP_TEST_KEY = f'SettingManager:test-warmup:v{VERSION}'
FULL_CACHE_L2_KEY = f'SettingManager:l2:v{VERSION}'
FULL_CACHE_EN_KEY = f'SettingManager:en:v{VERSION}'
Expand Down Expand Up @@ -170,6 +170,7 @@ def l2_modules() -> dict:
"ftp",
"case",
"hide_show_count_param",
"fraction_comment",
]
},
"consults_module": SettingManager.get("consults_module", default='false', default_type='b'),
Expand Down
10 changes: 9 additions & 1 deletion directions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,16 @@ class NapravleniyaHL7FilesAdmin(admin.ModelAdmin):
)


class ResultAdmin(admin.ModelAdmin):
autocomplete_fields = ('issledovaniye',)
list_display = (
'issledovaniye',
'fraction',
)


admin.site.register(TubesRegistration)
admin.site.register(Result)
admin.site.register(Result, ResultAdmin)
admin.site.register(FrequencyOfUseResearches)
admin.site.register(CustomResearchOrdering)
admin.site.register(ExternalOrganization)
Expand Down
1 change: 1 addition & 0 deletions directions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2994,6 +2994,7 @@ class Result(models.Model):
issledovaniye = models.ForeignKey(Issledovaniya, db_index=True, help_text='Направление на исследование, для которого сохранен результат', on_delete=models.CASCADE)
fraction = models.ForeignKey(directory.Fractions, help_text='Фракция из исследования', db_index=True, on_delete=models.CASCADE)
value = models.TextField(null=True, blank=True, help_text='Значение')
comment = models.TextField(null=True, blank=True, help_text='Комментарий к значению')
iteration = models.IntegerField(default=1, null=True, help_text='Итерация')
is_normal = models.CharField(max_length=255, default="", null=True, blank=True, help_text="Это норма?")
selected_reference = models.IntegerField(default=-2, blank=True, help_text="Выбранный референс")
Expand Down
50 changes: 44 additions & 6 deletions l2-frontend/src/pages/LaboratoryResults/ResultsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@
<col style="width: 31px">
<col>
<col
v-if="!noRefs"
v-if="visibleRefsM"
style="width: 21%"
>
<col
v-if="!noRefs"
v-if="visibleRefsF"
style="width: 21%"
>
<col
v-if="labFractionComment"
style="width: 21%"
>
</colgroup>
Expand All @@ -87,12 +91,15 @@
</button>
</td>
<th>Значение</th>
<th v-if="!noRefs">
<th v-if="visibleRefsM">
Нормы М
</th>
<th v-if="!noRefs">
<th v-if="visibleRefsF">
Нормы Ж
</th>
<th v-if="labFractionComment">
Комментарий
</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -133,13 +140,21 @@
/>
</template>
<Ref
v-if="!noRefs"
v-if="visibleRefsM"
:data="r.ref.m"
/>
<Ref
v-if="!noRefs"
v-if="visibleRefsF"
:data="r.ref.f"
/>
<td v-if="labFractionComment">
<textarea
v-model="r.comment"
v-autosize="r.comment"
class="form-control noresize"
:rows="(r.comment || '').split('\n').length"
/>
</td>
</tr>
<tr v-if="research.can_comment">
<td>
Expand Down Expand Up @@ -340,6 +355,26 @@ export default {
noRefs() {
return this.research.no_units_and_ref || this.research.template === 2;
},
patientSex() {
return this.dirData?.client_sex;
},
isPatientSexF() {
return this.patientSex === 'ж';
},
visibleRefsM() {
if (this.noRefs) {
return false;
}
return !this.labFractionComment || !this.isPatientSexF;
},
visibleRefsF() {
if (this.noRefs) {
return false;
}
return !this.labFractionComment || this.isPatientSexF;
},
execParams() {
const r = [];
if (this.execData.timeSave) {
Expand All @@ -362,6 +397,9 @@ export default {
legalAuthenticator() {
return !!this.$store.getters.modules.legal_authenticator;
},
labFractionComment() {
return !!this.$store.getters.modules.l2_fraction_comment;
},
},
mounted() {
this.$root.$on('laboratory:results:open-form', (pk, allDirPks, dirData) => {
Expand Down
2 changes: 1 addition & 1 deletion laboratory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "2023.10.101250+f83e94"
__version__ = "2023.10.140143+72931f"
VERSION = __version__
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ skip-string-normalization = true

[tool.poetry]
name = "l2"
version = "2023.10.101250+f83e94"
version = "2023.10.140143+72931f"
description = ""
authors = ["Mikhail Privalov <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 38f384d

Please sign in to comment.