Skip to content

Commit

Permalink
Merge pull request #4149 from mikhailprivalov/fastLinkGetMaterial
Browse files Browse the repository at this point in the history
fast get tubes
  • Loading branch information
urchinpro authored Aug 1, 2024
2 parents 3a201a6 + 1a28fe3 commit 880a280
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/contracts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def update_billing(request):
if not billing_data.is_confirmed:
billing_info = BillingRegister.update_billing(billing_id, date_start, date_end, info, price_id, date_from, registry_number)
type_price = body.get("typeCompany")
date_start = f"{date_start} 00:00:00"
date_end = f"{date_end} 23:59:59"
data = researches_for_billing(type_price, hospital_id, date_start, date_end, price_id, billing_data.is_confirmed, billing_id)
structure_data = structure_table(data)
return JsonResponse({"ok": True, "billingInfo": billing_info, **structure_data})
Expand All @@ -58,8 +60,8 @@ def confirm_billing(request):
billing_data = BillingRegister.objects.filter(pk=billing_id).first()
if not billing_data.is_confirmed:
hospital_id = billing_data.hospital_id
date_start = billing_data.date_start
date_end = billing_data.date_end
date_start = f"{billing_data.date_start} 00:00:00"
date_end = f"{billing_data.date_end} 23:59:59"
price_id = billing_data.price_id

data = researches_for_billing(type_price, hospital_id, date_start, date_end, price_id, billing_data.is_confirmed, billing_id)
Expand Down
26 changes: 26 additions & 0 deletions l2-frontend/src/ui-cards/BiomaterialSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ import { debounce } from 'lodash/function';
import * as actions from '@/store/action-types';
import ColorTitled from '@/ui-cards/ColorTitled.vue';
import Modal from '@/ui-cards/Modal.vue';
import UrlData from '@/UrlData';
@Component({
components: {
Expand Down Expand Up @@ -457,13 +458,29 @@ import Modal from '@/ui-cards/Modal.vue';
window.addEventListener('keypress', this.keypressHandler);
},
async mounted() {
const storedData = UrlData.get();
if (storedData && typeof storedData === 'object') {
if (storedData.pk) {
this.query = (storedData.pk).toString();
await this.doSearch();
}
}
this.inited = true;
},
beforeDestroy() {
window.removeEventListener('keypress', this.keypressHandler);
},
watch: {
query() {
this.barScanner(this.query);
},
navState() {
if (this.inited) {
UrlData.set(this.navState);
}
UrlData.title(this.direction);
},
},
})
export default class BiomaterialSearch extends Vue {
Expand Down Expand Up @@ -555,6 +572,15 @@ export default class BiomaterialSearch extends Vue {
this.loading = false;
}
get navState() {
if (!this.direction) {
return null;
}
return {
pk: this.direction,
};
}
get needGlobalCheck() {
for (const tubes of Object.values<any>(this.tubes || {})) {
for (const t of Object.values<any>(tubes || {})) {
Expand Down
24 changes: 24 additions & 0 deletions l2-frontend/src/ui-cards/DirectionsHistory/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,19 @@
:main-direction="row.pk"
:aux-research="row.aux_researches"
/></span>
<span v-if="row.lab && !row.has_hosp && roleCanUseGetBipmaterial">
<a
v-tippy
href="#"
title="Забор биоматериала"
@click.prevent="getTubes(row.pk)"
>
<i
class="fa-solid fa-vial"
style="color: #6f6f72"
/>
</a>
</span>
</td>
<td
class="researches"
Expand Down Expand Up @@ -548,6 +561,14 @@ export default {
}
return false;
},
roleCanUseGetBipmaterial() {
for (const g of this.$store.getters.user_data.groups || []) {
if (g === 'Заборщик биоматериала') {
return true;
}
}
return false;
},
role_can_use_descriptive() {
for (const g of this.$store.getters.user_data.groups || []) {
if (['Врач консультаций', 'Врач параклиники', 'Свидетельство о смерти-доступ'].includes(g)) {
Expand Down Expand Up @@ -784,6 +805,9 @@ export default {
printCurrentBarcodes(pk) {
this.$root.$emit('print:barcodes', [pk]);
},
getTubes(directionId) {
window.open(`/ui/biomaterial/get#{%22pk%22:${directionId}}`, '_blank');
},
},
};
</script>
Expand Down

0 comments on commit 880a280

Please sign in to comment.