Merge branch 'dd-1' into 'master'

поиск карт

See merge request astra/astra-frontend!513
This commit is contained in:
Dmitriy Derbentsov
2023-10-08 21:26:03 +00:00
5 changed files with 54 additions and 110 deletions

View File

@@ -21,7 +21,7 @@ export default {
medicalCards: [], medicalCards: [],
dataStatus: { dataStatus: {
title: "no data", title: "no data",
message: "Введите номер карты или ФИО пациента", message: "Введите данные Пациента для поиска",
img: nothingChooseImg, img: nothingChooseImg,
}, },
}; };
@@ -31,20 +31,21 @@ export default {
if (!value) { if (!value) {
this.dataStatus = { this.dataStatus = {
title: "no data", title: "no data",
message: "Введите номер карты или ФИО пациента", message: "Введите ФИО Пациента",
img: nothingChooseImg, img: nothingChooseImg,
}; };
this.medicalCards = []; this.medicalCards = [];
return; return;
} }
const data = await fetchWrapper.get(
"medical_cards?searchstring=" + value const data = await fetchWrapper.post("persons/search", {
); full_name: value,
});
if (data?.length === 0) { if (data?.length === 0) {
this.medicalCard = []; this.medicalCard = [];
this.dataStatus = { this.dataStatus = {
title: "not found", title: "not found",
message: `По запросу «${value}» не найдено. message: `По запросу «${value}» Пациентов не найдено.
Переформулируйте запрос и попробуйте снова`, Переформулируйте запрос и попробуйте снова`,
img: nothingSearchImg, img: nothingSearchImg,
}; };

View File

@@ -4,15 +4,15 @@
base-input.search( base-input.search(
:width="438", :width="438",
size="M", size="M",
placeholder="Введите ФИО или номер телефона", placeholder="ФИО Пациента",
icon-left, icon-left,
v-model="filterString" v-model="filterString"
) )
template(#iconLeft) template(#iconLeft)
q-icon.search-icon(name="app:search", size="20px") q-icon.search-icon(name="app:search", size="20px")
base-button(width="216px", @click="showCreateModal = true") base-button(@click="showCreateModal = true")
q-icon.plus.mr-2(name="app:plus", size="24px") q-icon.plus.mr-2(name="app:plus", size="18px")
span Создать медкарту span Новая медкарта
base-modal(v-model="showCreateModal", title="Создать медицинскую карту", modal-padding) base-modal(v-model="showCreateModal", title="Создать медицинскую карту", modal-padding)
patient-creation-form(@close="handleClosePatientForm") patient-creation-form(@close="handleClosePatientForm")
</template> </template>
@@ -72,7 +72,8 @@ export default {
fill: var(--font-grey-color) fill: var(--font-grey-color)
.search :deep(.q-field__prepend) .search :deep(.q-field__prepend)
padding-right: 4px padding-right: 12px
.plus :deep(path) .plus :deep(path)
fill: var(--default-white) fill: var(--default-white)

View File

@@ -17,7 +17,7 @@
v-for="medcard in medicalCards", v-for="medcard in medicalCards",
:key="medcard.id" :key="medcard.id"
:header-style="headerStyle", :header-style="headerStyle",
:medcard-info="medcard", :person="medcard",
) )
</template> </template>
@@ -41,7 +41,6 @@ export default {
headerStyle(field) { headerStyle(field) {
return { return {
...field, ...field,
"justify-content": field.title === "Do" ? "center" : "",
}; };
}, },
}, },

View File

@@ -1,93 +1,69 @@
<template lang="pug"> <template lang="pug">
.w-full.row-wrapper.h-14.flex .w-full.row-wrapper.h-14.flex
.field.gap-x-3( .field(:style="headerStyle(headerConfig[0])")
:style="headerStyle(headerConfig[0])" template(v-if="person.medical_card_id")
) base-button(size="S", @click="openMedicalCard", label="Открыть", color="green")
q-avatar(size="36px") template(v-else)
img(:src="avatar") base-button(size="S", @click="createMedCard", label="Создать")
.field.gap-x-3(:style="headerStyle(headerConfig[1])")
span.font-semibold.text-dark {{patientName}} span.font-semibold.text-dark {{patientName}}
.field(:style="headerStyle(headerConfig[1])")
span.text-dark {{ convertDate(medcardInfo?.person?.birth_date) }} г.
.field(:style="headerStyle(headerConfig[2])") .field(:style="headerStyle(headerConfig[2])")
.medcard-number.rounded.h-7.py-1.pl-3.pr-2.flex.items-center.justify-between.w-full.cursor-pointer( span.text-dark {{ birthDate }}
@click="copyValue(medcardInfo?.number)" .field(:style="{...headerStyle(headerConfig[3])}")
) span.text-dark {{ phones }}
span.text-dark.cursor-pointer {{ medcardInfo?.number }}
q-icon.copy(size="18px", name="app:copy")
.field(:style="headerStyle(headerConfig[3])")
span.text-dark {{ convertDate(medcardInfo?.created_at) }} г.
.field(:style="{...headerStyle(headerConfig[4])}")
q-icon.medcard.cursor-pointer(name="app:medcard", size="20px", @click="openMedicalCard")
</template> </template>
<script> <script>
import { import { searchListConfig } from "@/pages/medcards/utils/medcardsConfig.js";
searchListConfig,
priorityList,
} from "@/pages/medcards/utils/medcardsConfig.js";
import * as moment from "moment/moment"; import * as moment from "moment/moment";
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider"; import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
import { addNotification } from "@/components/Notifications/notificationContext";
import avatar from "@/assets/images/person.png";
import { mapActions } from "vuex"; import { mapActions } from "vuex";
import BaseButton from "@/components/base/BaseButton.vue";
export default { export default {
name: "MedicalCardSearchRow", name: "MedicalCardSearchRow",
components: { TheNotificationProvider }, components: { TheNotificationProvider, BaseButton },
props: { props: {
headerStyle: Function, headerStyle: Function,
medcardInfo: Object, person: Object,
}, },
data() { data() {
return { return {
headerConfig: searchListConfig, headerConfig: searchListConfig,
avatar,
}; };
}, },
computed: { computed: {
patientName() { patientName() {
return `${this.medcardInfo?.person?.last_name} ${this.medcardInfo?.person?.first_name} ${this.medcardInfo?.person?.patronymic}`; return `${this.person?.last_name} ${this.person?.first_name} ${this.person?.patronymic}`;
}, },
patientPriority() { birthDate() {
return priorityList?.find( let retVal =
({ priority }) => (this.medcardInfo.priority || null) === priority this.person?.birth_date &&
); moment(this.person?.birth_date)?.format("DD MMMM YYYY");
return retVal ? retVal + " г." : "";
}, },
thumbStyle() { phones() {
let percentage = this.medcardInfo?.filling_percentage || 0; return this.person?.contacts
return { ?.filter((el) => el.category === "PHONE")
width: `calc(${percentage}%)`, .map((el) => el.value)
"background-color": .join(", ");
percentage < 11
? "var(--system-color-red)"
: percentage < 51
? "var(--bg-yellow-warning)"
: "var(--system-color-green)",
};
}, },
}, },
methods: { methods: {
...mapActions({ ...mapActions({
getMedicalCardData: "getMedicalCardDataByPersonId", getMedicalCardData: "getMedicalCardDataByPersonId",
createMedicalCard: "createMedicalCard",
}), }),
openMedicalCard() { openMedicalCard() {
this.getMedicalCardData({ this.$router.push("medical-card/" + this.person["medical_card_id"]);
personId: this.medcardInfo.person_id, },
successCallback: (id) => this.$router.push("medical-card/" + id), createMedCard() {
this.createMedicalCard({
personId: this.person.id,
}).then(() => {
this.openMedicalCard();
}); });
}, },
convertDate(date) {
return moment(date)?.format("DD MMMM YYYY");
},
copyValue(text) {
navigator.clipboard.writeText(text);
addNotification(
new Date().getTime(),
"",
"Номер медкарты скопирован",
"success",
5000
);
},
}, },
}; };
</script> </script>
@@ -122,8 +98,6 @@ span
.track .track
background: var(--gray-thirdly) background: var(--gray-thirdly)
.thumb
.grey-color .grey-color
color: var(--font-grey-color) color: var(--font-grey-color)
</style> </style>

View File

@@ -1,4 +1,8 @@
export const searchListConfig = [ export const searchListConfig = [
{
title: "Медкарта",
minWidth: "140px",
},
{ {
title: "ФИО", title: "ФИО",
width: "100%", width: "100%",
@@ -9,42 +13,7 @@ export const searchListConfig = [
minWidth: "220px", minWidth: "220px",
}, },
{ {
title: "№ медкарты", title: "Телефон",
minWidth: "280px", minWidth: "220px",
},
{
title: "Дата создания",
minWidth: "215px",
},
{
title: "Do",
minWidth: "60px",
},
];
export const priorityList = [
{
priority: 1,
id: 1,
text: "Высокий",
color: "var(--system-color-red)",
},
{
priority: 2,
id: 2,
text: "Средний",
color: "var(--bg-yellow-warning)",
},
{
priority: 3,
id: 3,
text: "Низкий",
color: "var(--btn-blue-color)",
},
{
priority: null,
id: 4,
text: "-",
color: "#9294A7",
}, },
]; ];