Skip to content

Commit

Permalink
Merge pull request #3125 from moodpulse/lab-comment
Browse files Browse the repository at this point in the history
fraction comment
  • Loading branch information
mikhailprivalov authored Oct 14, 2023
2 parents 94791d2 + b829d7e commit 7313c13
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 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
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
49 changes: 43 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,20 @@
/>
</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">
<input
v-model="r.comment"
class="form-control"
type="text"
>
</td>
</tr>
<tr v-if="research.can_comment">
<td>
Expand Down Expand Up @@ -340,6 +354,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 +396,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

0 comments on commit 7313c13

Please sign in to comment.