From 9bafd0f9b5da772de12dcd21a9d702e8b8d92b89 Mon Sep 17 00:00:00 2001 From: megavrilinvv Date: Tue, 27 Jun 2023 17:54:18 +0300 Subject: [PATCH] =?UTF-8?q?[WIP]=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=87?= =?UTF-8?q?=D0=B5=D0=BA=D0=B1=D0=BE=D0=BA=D1=81=D0=B0=D1=85=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=84=D0=BE=D1=80=D0=BC=D0=B5=20=D1=81=D0=BE=D0=B7=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=81=D0=BC=D0=BE=D1=82=D1=80?= =?UTF-8?q?=D0=B0,=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=82=D1=8D=D0=B3=D0=BE=D0=B2,=20=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D1=81=20=D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0=B3=D0=B0=20=D0=B8=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forms/DataForm.vue | 71 +++++++++---------- .../Forms/DiseaseForm.vue | 45 +++--------- .../Forms/MedicalFormTag.vue | 4 +- .../MedicalProtocolsInspection.vue | 38 +++++++++- .../newMedicalCard/utils/medicalConfig.js | 35 +++------ src/store/modules/medicalCard.js | 33 +++++++-- 6 files changed, 122 insertions(+), 104 deletions(-) diff --git a/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DataForm.vue b/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DataForm.vue index 185e181..7f9b949 100644 --- a/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DataForm.vue +++ b/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DataForm.vue @@ -11,13 +11,13 @@ .flex.items-center.gap-x-11px(:class="{'open-header': change || fillInspection}") .flex.flex-col.gap-y-4(:class="{'changed': change || fillInspection}") .flex.flex-col.gap-y-1(:class="{'open-textarea': change || fillInspection}") - .tag-wrap.flex.gap-x-1.gap-y-1(v-if="!fillInspection") + .tag-wrap.flex.gap-x-1.gap-y-1 .tag.flex.items-center.px-3.font-medium.text-smm( :class="{'pointer': fillInspection || change}" - v-for="tag in data.results.tags", :key="tag.id" - ) {{tag.label}} + v-for="tag in protocolData[data.state].complaints", :key="tag.id" + ) {{ tag }} base-input.px-3(v-if="change || fillInspection", type="textarea", autogrow, borderless, placeholder="Введите данные...") - template(v-if="!(change || fillInspection)", v-for="file in data.results.files") + template(v-if="!(change || fillInspection)", v-for="file in protocolData[data.state].files") .wrap.flex.flex-col.gap-1.gap-y-3(v-if="file?.data?.length") .title.font-semibold.text-smm.mb-2 {{file.name}} .wrap.flex.gap-x-1.gap-y-1 @@ -50,21 +50,21 @@ padding="0" ) .field.flex.flex-col.overflow-y-scroll - .checkbox.flex.flex-col(v-for="complaint in textSorting(data.results.complaints)") + .checkbox.flex.flex-col(v-for="complaint in textSorting(data.results.tags)") .letter.flex.items-center.font-bold.justify-center {{ complaint.sym }} - .line.flex.gap-x-4.h-9.items-center(v-for="name in complaint?.array") + .line.flex.gap-x-4.h-9.items-center(v-for="name in complaint.array") q-checkbox( dense, - v-model="selected", - :val="name?.label", + v-model="protocolData[data.state].complaints", + :val="name", :style="{border: 'none', width: '16px', height: '16px'}" ) - .name.flex.items-center.font-medium.text-smm {{ name?.label }} + .name.flex.items-center.font-medium.text-smm {{ name }} .flex.h-10.w-10.absolute.right-4.bottom-4 q-btn(color="primary", dense, padding="4px 12px") q-icon(name="app:icon-plus", size="17px") .flex.gap-x-20.w-full(v-if="change || fillInspection") - .flex.flex-col.gap-y-3.w-full(v-for="file in data.results.files") + .flex.flex-col.gap-y-3.w-full(v-for="file in protocolData[data.state].files") .title.text-smm.font-semibold {{file.name}} .download.flex.relative.w-full base-input.w-full( @@ -99,6 +99,7 @@ import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue"; import BaseButton from "@/components/base/BaseButton.vue"; import BaseInput from "@/components/base/BaseInput.vue"; +import { mapState } from "vuex"; export default { name: "DataForm", @@ -112,9 +113,13 @@ export default { data() { return { change: false, - selected: [], }; }, + computed: { + ...mapState({ + protocolData: (state) => state.medical.protocolData, + }), + }, methods: { checkedName(e) { return e === "Документы" ? true : false; @@ -123,19 +128,21 @@ export default { return name === "Документы" ? this.addNewDoc(e) : this.addNewScan(e); }, textSorting(arr) { - let srt = []; + let sortArr = []; this.abc.forEach((letter) => { arr.forEach((str) => { - let finded = srt.find((obj) => obj.sym === letter); - if (str.label[0] === letter) { + let finded = sortArr.find((obj) => obj.sym === letter); + if (str[0] === letter) { if (!finded) { - srt.push({ sym: letter, array: [{ label: str.label }] }); - } else if (finded.sym === letter) - finded.array.push({ label: str.label }); + sortArr.push({ + sym: letter, + array: [str], + }); + } else if (finded.sym === letter) finded.array.push(str); } }); }); - return srt; + return sortArr; }, openCard() { this.change = true; @@ -150,8 +157,12 @@ export default { doc[0]?.name.substr(doc[0].name.lastIndexOf(".") + 1) ] ) - this.data.results.files.find((e) => e.name === "Документы").data = [ - ...this.data.results.files.find((e) => e.name === "Документы").data, + this.protocolData[this.data.state].files.find( + (e) => e.name === "Документы" + ).data = [ + ...this.protocolData[this.data.state].files.find( + (e) => e.name === "Документы" + ).data, ...arr, ]; }, @@ -161,7 +172,7 @@ export default { [...arr].forEach((file) => { const reader = new FileReader(); reader.onload = (e) => { - this.data.results.files + this.protocolData[this.data.state].files .find((e) => e.name === "Сканы") ?.data.push({ file: e.target.result, @@ -172,17 +183,6 @@ export default { reader.readAsDataURL(file); }); }, - checkSelected() { - this.data.results.tags.forEach((com) => { - this.data.results.complaints.forEach((tag) => { - if ( - tag.label === com.label && - !this.selected.find((e) => e.label === com.label) - ) - this.selected.push(tag.label); - }); - }); - }, }, watch: { fillInspection: { @@ -190,14 +190,13 @@ export default { handler(newVal) { if (newVal) { this.change = false; - this.data.results.files.forEach((e) => (e.data = [])); + this.protocolData[this.data.state].files.forEach( + (e) => (e.data = []) + ); } }, }, }, - mounted() { - this.checkSelected(); - }, }; diff --git a/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DiseaseForm.vue b/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DiseaseForm.vue index 5b4a636..0bfb077 100644 --- a/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DiseaseForm.vue +++ b/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/DiseaseForm.vue @@ -10,16 +10,20 @@ .disease-body.flex .flex.flex-col.gap-y-17px.w-full(v-if="fillInspection || change") .flex.-ml-2(v-if="data.key === 'disease'") - q-checkbox.text-smm.font-medium(v-model="data.results.checked" label="Без особенностей" size="36px") + q-checkbox.text-smm.font-medium( + v-model="protocolData[data.state].checked", + label="Без особенностей", + size="36px" + ) .textarea.flex.w-full base-input.w-full( - v-model="modelValue", + v-model="protocolData[data.state].text", type="textarea", outlined, resize="vertical", placeholder="Введите данные..." ) - .font-medium.text-smm(v-else) {{displayedValue}} + .font-medium.text-smm(v-else) {{protocolData[data.state]?.text}} diff --git a/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/MedicalFormTag.vue b/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/MedicalFormTag.vue index a3d3323..dbc6d59 100644 --- a/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/MedicalFormTag.vue +++ b/src/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/MedicalFormTag.vue @@ -9,7 +9,7 @@ .protocol-body.flex.flex-col .flex.gap-x-4(:style="{height: change || fillInspection ? '300px' : ''}") .flex.flex-col.gap-y-1.overflow-y-auto(:class="{'open-textarea': change || fillInspection}") - .tag-wrap.flex.gap-x-1.gap-y-1(v-if="!fillInspection") + .tag-wrap.flex.gap-x-1.gap-y-1 .tag.flex.items-center.px-3.text-smm( v-for="tag in protocolData[data.state]", :key="tag.id" @@ -39,7 +39,7 @@ .field.flex.flex-col.overflow-y-scroll(v-if="data.results.tags") .checkbox.flex.flex-col(v-for="complaint in textSorting(data.results.tags)") .letter.flex.items-center.font-bold.justify-center {{ complaint.sym }} - .line.flex.gap-x-4.h-9.items-center(:key="name.id", v-for="name in complaint.array") + .line.flex.gap-x-4.h-9.items-center(v-for="name in complaint.array") q-checkbox( dense, v-model="protocolData[data.state]", diff --git a/src/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsInspection.vue b/src/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsInspection.vue index 8f83179..b2f53a1 100644 --- a/src/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsInspection.vue +++ b/src/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsInspection.vue @@ -29,7 +29,7 @@ base-button.text-base.font-semibold(outlined, :size="40") Отменить base-button.text-base.font-semibold(:size="40") Сохранить .flex.items-center.gap-x-3(:style="{color: 'var(--font-grey-color)'}") - .flex.font-semibold.text-7xl 0% + .flex.font-semibold.text-7xl {{ percent + "%" }} .flex.font-medium.text-smm.w-20 заполнение осмотра @@ -60,6 +60,7 @@ export default { props: { inspection: Boolean, fillInspection: Boolean }, data() { return { + percent: 0, protocolForms: protocolForms, list: [ { @@ -110,6 +111,41 @@ export default { protocolDataGet: "getInitProtocol", }), }, + methods: { + interestСalculation() { + const getTypeOf = (obj) => { + return {}.toString.call(obj).slice(8, -1); + }; + let sum = 0; + for (let a in this.protocolData) { + if ( + Array.isArray(this.protocolData[a]) && + this.protocolData[a].length > 0 + ) + sum += 1; + + if (this.protocolData[a] && typeof this.protocolData[a] === "string") + sum += 1; + + if ( + getTypeOf(this.protocolData[a]) === "Object" && + Object.keys(this.protocolData[a]).length + ) + sum += 1; + } + sum = Math.ceil(17 / sum); + this.percent = sum > 1 ? sum * 10 : sum * 100; + }, + }, + watch: { + protocolData: { + deep: true, + immediate: true, + handler() { + this.interestСalculation(); + }, + }, + }, }; diff --git a/src/pages/newMedicalCard/utils/medicalConfig.js b/src/pages/newMedicalCard/utils/medicalConfig.js index 6efe1c3..5307b30 100644 --- a/src/pages/newMedicalCard/utils/medicalConfig.js +++ b/src/pages/newMedicalCard/utils/medicalConfig.js @@ -1229,10 +1229,10 @@ export const protocolForms = [ state: "survey", results: { tags: [ - { id: 1, label: "Общий анализ крови" }, - { id: 2, label: "Консультация узкого специалиста" }, - { id: 3, label: "2 искусственных зуба" }, - { id: 4, label: "Биохимический анализ крови" }, + "Общий анализ крови", + "Консультация узкого специалиста", + "2 искусственных зуба", + "Биохимический анализ крови", ], }, }, @@ -1243,28 +1243,15 @@ export const protocolForms = [ state: "data", results: { tags: [ - { id: 1, label: "Боль при приеме сладкой пищи" }, - { id: 2, label: "Жжение языка" }, - { id: 3, label: "Кровоточивость десен" }, - { id: 4, label: "Лечение у ортодонта не проводилось" }, - { id: 5, label: "Ранее зубы лечили в ЛПУ" }, - { id: 6, label: "Удаление зуба" }, - ], - complaints: [ - { id: 1, label: "Ранее зубы лечили в ЛПУ" }, - { id: 2, label: "Жжение языка" }, - { id: 3, label: "Кровоточивость десен" }, - { id: 4, label: "Лечение у ортодонта не проводилось" }, - { id: 5, label: "Боль при приеме сладкой пищи" }, - { id: 6, label: "Удаление зуба" }, - { id: 7, label: "Кровоточивость языка" }, - ], - files: [ - { name: "Документы", data: [] }, - { name: "Сканы", data: [] }, + "Ранее зубы лечили в ЛПУ", + "Жжение языка", + "Кровоточивость десен", + "Лечение у ортодонта не проводилось", + "Боль при приеме сладкой пищи", + "Удаление зуба", + "Кровоточивость языка", ], }, - selected: [], iconDictionary: { doc: wordIcon, docx: wordIcon, diff --git a/src/store/modules/medicalCard.js b/src/store/modules/medicalCard.js index bfc9c88..db49d86 100644 --- a/src/store/modules/medicalCard.js +++ b/src/store/modules/medicalCard.js @@ -346,9 +346,11 @@ const getters = { bite: "distal bite", hygieneIndex: 2, KPUIndex: 6.1, - disease: - "Пациенту 20 лет. Неделю назад металлокерамический мостовидный протез с опорами на зубы 4.3 и 4.6 зафиксирован на временный цемент. Во время ортопедического лечения интактные зубы 4.3 и 4.6 были препарированы под местной анестезией, после препарирования зубы были защищены временным пластмассовым мостовидным протезом, боли в это время пациент не ощущал. Ноющая боль появилась на второй день после фиксации металлокерамического зубного протеза на временный цемент, интенсивность боли постепенно нарастает, усиливается от холодного. Пациент точно указывает, что боль локализуется в области зуба 4.3", - preliminary: "Средний кариес 36-го зуба (II класс по Блэку)", + disease: { + checked: false, + text: "Пациенту 20 лет. Неделю назад металлокерамический мостовидный протез с опорами на зубы 4.3 и 4.6 зафиксирован на временный цемент. Во время ортопедического лечения интактные зубы 4.3 и 4.6 были препарированы под местной анестезией, после препарирования зубы были защищены временным пластмассовым мостовидным протезом, боли в это время пациент не ощущал. Ноющая боль появилась на второй день после фиксации металлокерамического зубного протеза на временный цемент, интенсивность боли постепенно нарастает, усиливается от холодного. Пациент точно указывает, что боль локализуется в области зуба 4.3", + }, + preliminary: { text: "Средний кариес 36-го зуба (II класс по Блэку)" }, thermometry: { cold: { value: 22, @@ -371,6 +373,20 @@ const getters = { lacticBite: toothFormula.state.lacticBite, formula: toothFormula.state.formula, }, + data: { + complaints: [ + "Боль при приеме сладкой пищи", + "Жжение языка", + "Кровоточивость десен", + "Лечение у ортодонта не проводилось", + "Ранее зубы лечили в ЛПУ", + "Удаление зуба", + ], + files: [ + { name: "Документы", data: [] }, + { name: "Сканы", data: [] }, + ], + }, clinical: [{ id: 0, label: "В00.09", text: "Простой герпес" }], }; }, @@ -404,12 +420,19 @@ const getters = { value: null, }, }, - disease: null, - preliminary: null, + disease: { checked: false, text: null }, + preliminary: { text: null }, toothFormula: { lacticBite: toothFormula.stateInit.lacticBite, formula: toothFormula.stateInit.formula, }, + data: { + complaints: [], + files: [ + { name: "Документы", data: [] }, + { name: "Сканы", data: [] }, + ], + }, clinical: [], }; },