WIP Поправил отправку данных с мед карты, добавил обновление данных
This commit is contained in:
@@ -4,13 +4,13 @@
|
|||||||
span.text-sm.font-semibold.whitespace-normal {{title}}
|
span.text-sm.font-semibold.whitespace-normal {{title}}
|
||||||
.flex.gap-y-4.px-4.py-3(
|
.flex.gap-y-4.px-4.py-3(
|
||||||
:style="{height: `${height}px`}"
|
:style="{height: `${height}px`}"
|
||||||
v-if="!isNoData"
|
v-if="isNoData"
|
||||||
:class="{'flex-col': !directionRow}"
|
:class="{'flex-col': !directionRow}"
|
||||||
)
|
)
|
||||||
slot
|
slot
|
||||||
.section-add.flex.justify-center.items-center.cursor-pointer(
|
.section-add.flex.justify-center.items-center.cursor-pointer(
|
||||||
:style="{height: `${height}px`}"
|
:style="{height: `${height}px`}"
|
||||||
v-if="isNoData"
|
v-if="!isNoData"
|
||||||
@click="openAddDoc"
|
@click="openAddDoc"
|
||||||
) Добавить данные
|
) Добавить данные
|
||||||
</template>
|
</template>
|
||||||
@@ -21,28 +21,26 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
height: Number,
|
height: Number,
|
||||||
data: Object,
|
data: Array,
|
||||||
directionRow: Boolean,
|
directionRow: Boolean,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isNoData: true,
|
isNoData: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openAddDoc() {
|
openAddDoc() {
|
||||||
this.isNoData = false;
|
this.isNoData = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
data() {
|
data() {
|
||||||
Object.values(this.data)
|
this.data.forEach((el) => {
|
||||||
.map((el) => (el !== undefined && el !== null ? el : undefined))
|
if (el !== undefined) {
|
||||||
.forEach((el) => {
|
this.isNoData = true;
|
||||||
if (el !== undefined) {
|
}
|
||||||
this.isNoData = false;
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export default {
|
|||||||
lazyRule: [Boolean, String],
|
lazyRule: [Boolean, String],
|
||||||
noErrorIcon: Boolean,
|
noErrorIcon: Boolean,
|
||||||
itemAligned: Boolean,
|
itemAligned: Boolean,
|
||||||
modelValue: [String, Date],
|
modelValue: [String, Date, Number],
|
||||||
placeholder: String,
|
placeholder: String,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
label: String,
|
label: String,
|
||||||
|
|||||||
@@ -7,90 +7,90 @@
|
|||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.identity_document.title"
|
:title="configData.identity_document.title"
|
||||||
:height="configData.identity_document.height"
|
:height="configData.identity_document.height"
|
||||||
:data="medicalDataInit.identity_document"
|
:data="defineEmptyData(configData.identity_document.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.identity_document.fields"
|
v-for="field in configData.identity_document.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.identity_document"
|
:data="medicalDataInit"
|
||||||
:mask="field.mask"
|
:mask="field.mask"
|
||||||
)
|
)
|
||||||
.flex.flex-col.gap-30px
|
.flex.flex-col.gap-30px
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.registration_address.title"
|
:title="configData.registration_address.title"
|
||||||
:height="configData.registration_address.height"
|
:height="configData.registration_address.height"
|
||||||
:data="medicalDataInit.registration_address"
|
:data="defineEmptyData(configData.registration_address.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.registration_address.fields"
|
v-for="field in configData.registration_address.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.registration_address"
|
:data="medicalDataInit"
|
||||||
)
|
)
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.temporary_address.title"
|
:title="configData.temporary_address.title"
|
||||||
:height="configData.temporary_address.height"
|
:height="configData.temporary_address.height"
|
||||||
:data="medicalDataInit.temporary_address"
|
:data="defineEmptyData(configData.temporary_address.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.temporary_address.fields"
|
v-for="field in configData.temporary_address.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.temporary_address"
|
:data="medicalDataInit"
|
||||||
)
|
)
|
||||||
.flex.flex-col.gap-2
|
.flex.flex-col.gap-2
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.snils.title"
|
:title="configData.snils.title"
|
||||||
:height="configData.snils.height"
|
:height="configData.snils.height"
|
||||||
:data="medicalDataInit.snils"
|
:data="defineEmptyData(configData.snils.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.snils.fields"
|
v-for="field in configData.snils.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.snils"
|
:data="medicalDataInit"
|
||||||
:mask="field.mask"
|
:mask="field.mask"
|
||||||
)
|
)
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.policy.title"
|
:title="configData.policy.title"
|
||||||
:height="configData.policy.height"
|
:height="configData.policy.height"
|
||||||
:data="medicalDataInit.policy"
|
:data="defineEmptyData(configData.policy.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.policy.fields"
|
v-for="field in configData.policy.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.policy"
|
:data="medicalDataInit"
|
||||||
:mask="field.mask"
|
:mask="field.mask"
|
||||||
)
|
)
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.policy_organization.title"
|
:title="configData.policy_organization.title"
|
||||||
:height="configData.policy_organization.height"
|
:height="configData.policy_organization.height"
|
||||||
:data="medicalDataInit.policy_organization"
|
:data="defineEmptyData(configData.policy_organization.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.policy_organization.fields"
|
v-for="field in configData.policy_organization.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.policy_organization"
|
:data="medicalDataInit"
|
||||||
)
|
)
|
||||||
.flex.flex-col.gap-4
|
.flex.flex-col.gap-4
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.additional.title"
|
:title="configData.additional.title"
|
||||||
:height="configData.additional.height"
|
:height="configData.additional.height"
|
||||||
:data="medicalDataInit.additional"
|
:data="defineEmptyData(configData.additional.fields)"
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.additional.fields"
|
v-for="field in configData.additional.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.additional"
|
:data="medicalDataInit"
|
||||||
:mask="field.mask"
|
:mask="field.mask"
|
||||||
)
|
)
|
||||||
base-detail-info(
|
base-detail-info(
|
||||||
:title="configData.agreement_form.title"
|
:title="configData.agreement_form.title"
|
||||||
:height="configData.agreement_form.height"
|
:height="configData.agreement_form.height"
|
||||||
:data="medicalDataInit.agreement_form"
|
:data="defineEmptyData(configData.agreement_form.fields)"
|
||||||
direction-row
|
direction-row
|
||||||
)
|
)
|
||||||
base-detail-input(
|
base-detail-input(
|
||||||
v-for="field in configData.agreement_form.fields"
|
v-for="field in configData.agreement_form.fields"
|
||||||
:field="field"
|
:field="field"
|
||||||
:data="medicalDataInit.agreement_form"
|
:data="medicalDataInit"
|
||||||
)
|
)
|
||||||
.flex.flex-col(class="px-92px gap-y-60px")
|
.flex.flex-col(class="px-92px gap-y-60px")
|
||||||
.flex.flex-col(class="gap-y-2.5")
|
.flex.flex-col(class="gap-y-2.5")
|
||||||
@@ -116,7 +116,12 @@ import BaseDetailInfo from "@/components/base/BaseDetailInfo.vue";
|
|||||||
import { formulaDataMap } from "@/pages/medicalCard/utils/medicalConfig";
|
import { formulaDataMap } from "@/pages/medicalCard/utils/medicalConfig";
|
||||||
import { medicalDetailConfig } from "@/pages/medicalCard/utils/medicalConfig";
|
import { medicalDetailConfig } from "@/pages/medicalCard/utils/medicalConfig";
|
||||||
import { mobilityMap } from "@/pages/medicalCard/utils/medicalConfig";
|
import { mobilityMap } from "@/pages/medicalCard/utils/medicalConfig";
|
||||||
import { createEntryMedicalCard } from "@/pages/medicalCard/utils/wrapperMedicalCard";
|
import {
|
||||||
|
getDentalEntiesValue,
|
||||||
|
requestUpdateMedicalCard,
|
||||||
|
requestCreateMedicalCard,
|
||||||
|
getRequestDataPerson,
|
||||||
|
} from "@/pages/medicalCard/utils/wrapperMedicalCard";
|
||||||
import { fetchWrapper } from "@/shared/fetchWrapper";
|
import { fetchWrapper } from "@/shared/fetchWrapper";
|
||||||
import BaseInput from "@/components/base/BaseInput.vue";
|
import BaseInput from "@/components/base/BaseInput.vue";
|
||||||
import ClientDetailInput from "@/pages/clients/components/ClientDetailInput.vue";
|
import ClientDetailInput from "@/pages/clients/components/ClientDetailInput.vue";
|
||||||
@@ -132,140 +137,195 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
medicalCardData: undefined,
|
personId: "",
|
||||||
|
identityDocumentId: "",
|
||||||
|
responseMedicalCardData: undefined,
|
||||||
|
responseMedicalDentalData: {},
|
||||||
numberCard: "",
|
numberCard: "",
|
||||||
configData: medicalDetailConfig,
|
configData: medicalDetailConfig,
|
||||||
medicalDataInit: {
|
medicalDataInit: {
|
||||||
identity_document: {
|
number_series: undefined,
|
||||||
number_series: null,
|
issued_by_org: undefined,
|
||||||
issued_by_org: null,
|
issued_by_org_code: undefined,
|
||||||
issued_by_org_code: null,
|
issued_by_date: undefined,
|
||||||
issued_by_date: null,
|
registration_address: undefined,
|
||||||
},
|
temporary_address: undefined,
|
||||||
registration_address: {
|
insurance_number: undefined,
|
||||||
registration_address: null,
|
policy_series: undefined,
|
||||||
},
|
policy_number: undefined,
|
||||||
temporary_address: {
|
policy_organization: undefined,
|
||||||
temporary_address: null,
|
name_confidant: undefined,
|
||||||
},
|
phone_confidant: undefined,
|
||||||
snils: {
|
benefit_code: undefined,
|
||||||
insurance_number: null,
|
agreement: undefined,
|
||||||
},
|
agreement_date: undefined,
|
||||||
policy: {
|
|
||||||
series: null,
|
|
||||||
number: null,
|
|
||||||
},
|
|
||||||
policy_organization: {
|
|
||||||
policy_organization: null,
|
|
||||||
},
|
|
||||||
additional: {
|
|
||||||
name_confidant: null,
|
|
||||||
phone_confidant: null,
|
|
||||||
benefit_code: null,
|
|
||||||
},
|
|
||||||
agreement_form: {
|
|
||||||
agreement: null,
|
|
||||||
agreement_date: null,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
dentalIndications: {
|
dentalIndications: {
|
||||||
complaints: "",
|
complaints: undefined,
|
||||||
allergic_history: "",
|
allergic: undefined,
|
||||||
past_diseases: "",
|
past_diseases: undefined,
|
||||||
medications_taken: "",
|
medications_taken: undefined,
|
||||||
thermometry: "",
|
thermometry: undefined,
|
||||||
tonometry: "",
|
tonometry: undefined,
|
||||||
disease_progress: "",
|
disease_progress: undefined,
|
||||||
visual_examination: "",
|
visual_examination: undefined,
|
||||||
oral_examination: "",
|
oral_examination: undefined,
|
||||||
dental_formula: formulaDataMap,
|
dental_formula: formulaDataMap,
|
||||||
dental_bite: "",
|
dental_bite: undefined,
|
||||||
hygiene_index: "",
|
hygiene_index: undefined,
|
||||||
dmf_index: "",
|
dmf_index: undefined,
|
||||||
diagnostic_findings: "",
|
diagnostic_findings: undefined,
|
||||||
icd_code: "",
|
icd_code: undefined,
|
||||||
survey_plan: "",
|
survey_plan: undefined,
|
||||||
survey_data: "",
|
survey_data: undefined,
|
||||||
clinical_diagnosis: "",
|
clinical_diagnosis: undefined,
|
||||||
treatment_plan: "",
|
treatment_plan: undefined,
|
||||||
treatment_protocol: "",
|
treatment_protocol: undefined,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
defineEmptyData(fields) {
|
||||||
|
return fields.map((field) => this.medicalDataInit[field.label]);
|
||||||
|
},
|
||||||
validateFormCard() {
|
validateFormCard() {
|
||||||
|
const dataRequestPerson = getRequestDataPerson(
|
||||||
|
this.medicalDataInit,
|
||||||
|
this.dentalIndications
|
||||||
|
);
|
||||||
|
Object.keys(dataRequestPerson).forEach((key) => {
|
||||||
|
let valuesData = [
|
||||||
|
...new Set(
|
||||||
|
Object.values(this.responseMedicalCardData[key]).map((el) =>
|
||||||
|
el === null || el === undefined ? undefined : el
|
||||||
|
)
|
||||||
|
),
|
||||||
|
];
|
||||||
|
let isUpdateData = false;
|
||||||
|
let isCreateData =
|
||||||
|
valuesData.length === 1 &&
|
||||||
|
valuesData[0] === undefined &&
|
||||||
|
Object.values(dataRequestPerson[key]).find((el) => el !== undefined);
|
||||||
|
Object.keys(dataRequestPerson[key]).forEach((entries) => {
|
||||||
|
if (
|
||||||
|
this.responseMedicalCardData[key][entries] &&
|
||||||
|
dataRequestPerson[key][entries] !==
|
||||||
|
this.responseMedicalCardData[key][entries]
|
||||||
|
) {
|
||||||
|
isUpdateData = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (isUpdateData) {
|
||||||
|
requestUpdateMedicalCard(
|
||||||
|
dataRequestPerson[key],
|
||||||
|
key,
|
||||||
|
key === "identity_document"
|
||||||
|
? this.identityDocumentId
|
||||||
|
: this.personId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (isCreateData) {
|
||||||
|
requestCreateMedicalCard(
|
||||||
|
dataRequestPerson[key],
|
||||||
|
key,
|
||||||
|
key === "identity_document"
|
||||||
|
? this.identityDocumentId
|
||||||
|
: this.personId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
Object.keys(this.dentalIndications).forEach((key) => {
|
Object.keys(this.dentalIndications).forEach((key) => {
|
||||||
if (key === "dental_formula") {
|
if (key === "dental_formula") {
|
||||||
const notEmptyEntries =
|
const notEmptyEntries =
|
||||||
this.dentalIndications.dental_formula[0].columns
|
this.dentalIndications.dental_formula[0].columns
|
||||||
.concat(this.dentalIndications.dental_formula[1].columns)
|
.concat(this.dentalIndications.dental_formula[1].columns)
|
||||||
.filter((el) => el.dental_condition && el.tooth_mobility);
|
.filter((el) => el.dental_condition && el.tooth_mobility);
|
||||||
createEntryMedicalCard(
|
notEmptyEntries.forEach((tooth) => {
|
||||||
notEmptyEntries,
|
const toothResponse = this.responseMedicalDentalData[key].find(
|
||||||
key,
|
(el) => el.tooth_number === tooth.tooth_number
|
||||||
localStorage.getItem("medicalId")
|
);
|
||||||
);
|
const isCreate =
|
||||||
|
!toothResponse &&
|
||||||
|
!!tooth.tooth_mobility &&
|
||||||
|
!!tooth.dental_condition;
|
||||||
|
if (isCreate) {
|
||||||
|
requestCreateMedicalCard(
|
||||||
|
tooth,
|
||||||
|
key,
|
||||||
|
localStorage.getItem("medicalId")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
toothResponse &&
|
||||||
|
toothResponse.tooth_mobility.label !==
|
||||||
|
tooth.tooth_mobility.label &&
|
||||||
|
toothResponse.dental_condition !== tooth.dental_condition
|
||||||
|
) {
|
||||||
|
requestUpdateMedicalCard(tooth, key, toothResponse.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (this.dentalIndications[key] && !this.medicalCardData[key].length) {
|
if (
|
||||||
createEntryMedicalCard(
|
key !== "dental_formula" &&
|
||||||
|
!this.responseMedicalDentalData[key] &&
|
||||||
|
this.dentalIndications[key]
|
||||||
|
) {
|
||||||
|
requestCreateMedicalCard(
|
||||||
this.dentalIndications[key],
|
this.dentalIndications[key],
|
||||||
key,
|
key,
|
||||||
localStorage.getItem("medicalId")
|
localStorage.getItem("medicalId")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
key !== "dental_formula" &&
|
||||||
|
this.dentalIndications[key] &&
|
||||||
|
getDentalEntiesValue(this.responseMedicalDentalData[key], key) !==
|
||||||
|
this.dentalIndications[key]
|
||||||
|
) {
|
||||||
|
requestUpdateMedicalCard(
|
||||||
|
this.dentalIndications[key],
|
||||||
|
key,
|
||||||
|
this.responseMedicalDentalData[key]?.id
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveDataMedical(data) {
|
saveDataMedical(data) {
|
||||||
this.medicalCardData = data;
|
this.personId = data?.person?.id;
|
||||||
this.numberCard = data?.number;
|
this.numberCard = data?.number;
|
||||||
const confidant = data ? data["confidant"] : undefined;
|
const confidant = data ? data["confidant"] : undefined;
|
||||||
const pass = data
|
const pass = data
|
||||||
? data?.person?.identity_document?.find((el) => el.kind === "PASSPORT")
|
? data?.person?.identity_document?.find((el) => el.kind === "PASSPORT")
|
||||||
: null;
|
: null;
|
||||||
|
this.identityDocumentId = pass?.id;
|
||||||
this.medicalDataInit = {
|
this.medicalDataInit = {
|
||||||
...data,
|
...this.medicalDataInit,
|
||||||
identity_document: {
|
issued_by_org: pass.issued_by_org,
|
||||||
...pass,
|
issued_by_org_code: pass.issued_by_org_code,
|
||||||
number_series: `${pass.series} ${pass.number}`,
|
number_series: `${pass.series} ${pass.number}`,
|
||||||
issued_by_date: new Date(pass.issued_by_date),
|
issued_by_date: new Date(pass.issued_by_date),
|
||||||
},
|
registration_address: data?.person?.address?.find(
|
||||||
registration_address: {
|
(el) => el["registration_flg"]
|
||||||
registration_address: data?.person?.address?.find(
|
)?.join_address,
|
||||||
(el) => !el["registration_flg"]
|
temporary_address: data?.person?.address?.find(
|
||||||
)?.join_adress,
|
(el) => el["temporary_registration_flg"]
|
||||||
},
|
)?.join_address,
|
||||||
temporary_address: {
|
insurance_number: data?.person["insurance_number"] || undefined,
|
||||||
temporary_address: data?.person?.address?.find(
|
policy_number: data?.person["insurance_policy"][0]?.number,
|
||||||
(el) => !el["temporary_registration_flg"]
|
policy_series: data?.person["insurance_policy"][0]?.series,
|
||||||
)?.join_adress,
|
policy_organization: data?.person["insurance_policy"][0]?.organization,
|
||||||
},
|
name_confidant:
|
||||||
snils: {
|
confidant &&
|
||||||
insurance_number: data?.person["insurance_number"],
|
`${confidant?.last_name} ${confidant?.last_name} ${confidant?.patronymic}`,
|
||||||
},
|
phone_confidant: confidant?.contacts?.find((el) => el?.kind === "PHONE")
|
||||||
policy: {
|
?.username,
|
||||||
...this.medicalDataInit.policy,
|
benefit_code: data?.person?.benefit_code,
|
||||||
...data?.person["insurance_policy"][0],
|
agreement: data?.agreement,
|
||||||
},
|
agreement_date: undefined,
|
||||||
policy_organization: {
|
|
||||||
...this.medicalDataInit.policy_organization,
|
|
||||||
...data?.person["insurance_policy"][0],
|
|
||||||
},
|
|
||||||
additional: {
|
|
||||||
name_confidant: confidant
|
|
||||||
? `${confidant?.last_name} ${confidant?.last_name} ${confidant?.patronymic}`
|
|
||||||
: null,
|
|
||||||
phone_confidant: confidant?.contacts?.find(
|
|
||||||
(el) => el?.kind === "PHONE"
|
|
||||||
)?.username,
|
|
||||||
benefit_code: data?.benefit_code,
|
|
||||||
},
|
|
||||||
agreement_form: {
|
|
||||||
agreement: data?.agreement,
|
|
||||||
agreement_date: null,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
Object.keys(this.dentalIndications).forEach((key) => {
|
Object.keys(this.dentalIndications).forEach((key) => {
|
||||||
if (key === "dental_formula" && data[key].length) {
|
if (key === "dental_formula" && data[key].length) {
|
||||||
|
this.responseMedicalDentalData[key] = data[key];
|
||||||
data[key].forEach((tooth) => {
|
data[key].forEach((tooth) => {
|
||||||
if (tooth.dental_condition && tooth.tooth_mobility) {
|
if (tooth.dental_condition && tooth.tooth_mobility) {
|
||||||
if (17 < tooth.tooth_number < 29) {
|
if (17 < tooth.tooth_number < 29) {
|
||||||
@@ -308,15 +368,20 @@ export default {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.dentalIndications[key] = data[key]?.length
|
this.dentalIndications[key] = data[key]?.length
|
||||||
? data[key]
|
? getDentalEntiesValue(data[key].at(-1), key)
|
||||||
.map((el) => {
|
: this.dentalIndications[key];
|
||||||
let value = el.title || el["index_calculation"];
|
this.dentalIndications.allergic = data?.person?.allergic
|
||||||
return value || "";
|
? data?.person?.allergic
|
||||||
})
|
: this.dentalIndications.allergic;
|
||||||
.join("")
|
this.responseMedicalDentalData[key] = data[key]?.length
|
||||||
|
? data[key].at(-1)
|
||||||
: this.dentalIndications[key];
|
: this.dentalIndications[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.responseMedicalCardData = getRequestDataPerson(
|
||||||
|
this.medicalDataInit,
|
||||||
|
this.dentalIndications
|
||||||
|
);
|
||||||
},
|
},
|
||||||
async fetchDataMedicalCard() {
|
async fetchDataMedicalCard() {
|
||||||
await fetchWrapper
|
await fetchWrapper
|
||||||
|
|||||||
@@ -92,13 +92,13 @@ export const medicalDetailConfig = {
|
|||||||
title: "ПОЛИС",
|
title: "ПОЛИС",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
label: "series",
|
label: "policy_series",
|
||||||
title: "Серия",
|
title: "Серия",
|
||||||
type: "text",
|
type: "text",
|
||||||
mask: "####",
|
mask: "####",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "number",
|
label: "policy_number",
|
||||||
title: "Номер",
|
title: "Номер",
|
||||||
type: "text",
|
type: "text",
|
||||||
mask: "#######",
|
mask: "#######",
|
||||||
@@ -110,7 +110,7 @@ export const medicalDetailConfig = {
|
|||||||
title: "Страховая организация",
|
title: "Страховая организация",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
label: "organization",
|
label: "policy_organization",
|
||||||
title: "Название",
|
title: "Название",
|
||||||
type: "text",
|
type: "text",
|
||||||
},
|
},
|
||||||
@@ -172,7 +172,7 @@ export const medicalDetailConfig = {
|
|||||||
},
|
},
|
||||||
dental_indications: {
|
dental_indications: {
|
||||||
complaints: "Жалобы",
|
complaints: "Жалобы",
|
||||||
allergic_history: "Аллергологический анамнез",
|
allergic: "Аллергологический анамнез",
|
||||||
past_diseases: "Перенесённые и сопутствующие заболевания",
|
past_diseases: "Перенесённые и сопутствующие заболевания",
|
||||||
medications_taken: "Принимаемые лекарственные препараты",
|
medications_taken: "Принимаемые лекарственные препараты",
|
||||||
thermometry: "Термометрия (по показаниям)",
|
thermometry: "Термометрия (по показаниям)",
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import { fetchWrapper } from "@/shared/fetchWrapper";
|
import { fetchWrapper } from "@/shared/fetchWrapper";
|
||||||
export async function createEntryMedicalCard(entry, key, id) {
|
import moment from "moment";
|
||||||
|
export function requestCreateMedicalCard(entry, key, id) {
|
||||||
const url = `medical_card/${key}/create/`;
|
const url = `medical_card/${key}/create/`;
|
||||||
|
let arrayValue;
|
||||||
|
if (["tonometry", "dental_bite", "dmf_index"].includes(key)) {
|
||||||
|
arrayValue = entry.split(",");
|
||||||
|
}
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "complaints":
|
case "complaints":
|
||||||
case "medications_taken":
|
case "medications_taken":
|
||||||
@@ -12,7 +17,7 @@ export async function createEntryMedicalCard(entry, key, id) {
|
|||||||
case "treatment_protocol":
|
case "treatment_protocol":
|
||||||
return fetchWrapper.post(url, {
|
return fetchWrapper.post(url, {
|
||||||
title: entry,
|
title: entry,
|
||||||
description: "string",
|
description: entry,
|
||||||
medical_history: id,
|
medical_history: id,
|
||||||
});
|
});
|
||||||
case "thermometry":
|
case "thermometry":
|
||||||
@@ -24,30 +29,23 @@ export async function createEntryMedicalCard(entry, key, id) {
|
|||||||
case "tonometry":
|
case "tonometry":
|
||||||
return fetchWrapper.post(url, {
|
return fetchWrapper.post(url, {
|
||||||
title: entry,
|
title: entry,
|
||||||
sys: Number(entry),
|
sys: Number(arrayValue[0]),
|
||||||
dia: Number(entry),
|
dia: Number(arrayValue[1]),
|
||||||
pul: Number(entry),
|
pul: Number(arrayValue[2]),
|
||||||
medical_history: id,
|
medical_history: id,
|
||||||
});
|
});
|
||||||
case "dental_bite":
|
case "dental_bite":
|
||||||
return fetchWrapper.post(url, {
|
return fetchWrapper.post(url, {
|
||||||
custom: entry,
|
custom: arrayValue[0],
|
||||||
physiological: entry,
|
physiological: arrayValue[1],
|
||||||
abnormal: entry,
|
abnormal: arrayValue[2],
|
||||||
medical_history: id,
|
|
||||||
});
|
|
||||||
case "hygiene_index":
|
|
||||||
return fetchWrapper.post(url, {
|
|
||||||
number_teeth: Number(entry),
|
|
||||||
dental_plaque: Number(entry),
|
|
||||||
calculus_plaque: Number(entry),
|
|
||||||
medical_history: id,
|
medical_history: id,
|
||||||
});
|
});
|
||||||
case "dmf_index":
|
case "dmf_index":
|
||||||
return fetchWrapper.post(url, {
|
return fetchWrapper.post(url, {
|
||||||
caries: Number(entry),
|
caries: Number(arrayValue[0]),
|
||||||
filling: Number(entry),
|
filling: Number(arrayValue[1]),
|
||||||
remote: Number(entry),
|
remote: Number(arrayValue[2]),
|
||||||
medical_history: id,
|
medical_history: id,
|
||||||
});
|
});
|
||||||
case "clinical_diagnosis":
|
case "clinical_diagnosis":
|
||||||
@@ -58,15 +56,171 @@ export async function createEntryMedicalCard(entry, key, id) {
|
|||||||
icd10: id,
|
icd10: id,
|
||||||
});
|
});
|
||||||
case "dental_formula":
|
case "dental_formula":
|
||||||
return Promise.all(
|
return fetchWrapper.post(url, {
|
||||||
entry.map((el) =>
|
...entry,
|
||||||
fetchWrapper.post(url, {
|
tooth_mobility: entry.tooth_mobility ? entry.tooth_mobility.label : "",
|
||||||
...el,
|
tooth_number: entry.tooth_number,
|
||||||
tooth_mobility: el.tooth_mobility ? el.tooth_mobility.label : "",
|
medical_history: id,
|
||||||
tooth_number: el.tooth_number,
|
});
|
||||||
medical_history: id,
|
case "registration_address":
|
||||||
})
|
return fetchWrapper.post(`general/address/create/`, {
|
||||||
)
|
...entry,
|
||||||
);
|
person: id,
|
||||||
|
registration_flg: true,
|
||||||
|
});
|
||||||
|
case "temporary_address":
|
||||||
|
return fetchWrapper.post(`general/address/create/`, {
|
||||||
|
...entry,
|
||||||
|
person: id,
|
||||||
|
temporary_registration_flg: true,
|
||||||
|
});
|
||||||
|
case "identity_document":
|
||||||
|
return fetchWrapper.post(`general/identity_document/create/`, {
|
||||||
|
...entry,
|
||||||
|
person: id,
|
||||||
|
});
|
||||||
|
case "insurance_policy":
|
||||||
|
return fetchWrapper.post(`general/insurance_policy/create/`, {
|
||||||
|
...entry,
|
||||||
|
title: "string",
|
||||||
|
person: id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function requestUpdateMedicalCard(entry, key, id) {
|
||||||
|
const url = `medical_card/${key}/${id}/update/`;
|
||||||
|
let arrayValue;
|
||||||
|
if (["tonometry", "dental_bite", "dmf_index"].includes(key)) {
|
||||||
|
arrayValue = entry.split(",");
|
||||||
|
}
|
||||||
|
switch (key) {
|
||||||
|
case "complaints":
|
||||||
|
case "medications_taken":
|
||||||
|
case "disease_progress":
|
||||||
|
case "visual_examination":
|
||||||
|
case "diagnostic_findings":
|
||||||
|
case "survey_plan":
|
||||||
|
case "treatment_plan":
|
||||||
|
case "treatment_protocol":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
title: entry,
|
||||||
|
description: entry,
|
||||||
|
});
|
||||||
|
case "thermometry":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
title: entry,
|
||||||
|
temperature: Number(entry),
|
||||||
|
});
|
||||||
|
case "tonometry":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
title: entry,
|
||||||
|
sys: Number(arrayValue[0]),
|
||||||
|
dia: Number(arrayValue[1]),
|
||||||
|
pul: Number(arrayValue[2]),
|
||||||
|
});
|
||||||
|
case "dental_bite":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
custom: entry,
|
||||||
|
physiological: entry,
|
||||||
|
abnormal: entry,
|
||||||
|
});
|
||||||
|
case "dmf_index":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
caries: Number(entry),
|
||||||
|
filling: Number(entry),
|
||||||
|
remote: Number(entry),
|
||||||
|
});
|
||||||
|
case "clinical_diagnosis":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
title: entry,
|
||||||
|
description: "string",
|
||||||
|
icd10: id,
|
||||||
|
});
|
||||||
|
case "dental_formula":
|
||||||
|
return fetchWrapper.post(url, {
|
||||||
|
...entry,
|
||||||
|
tooth_mobility: entry.tooth_mobility ? entry.tooth_mobility.label : "",
|
||||||
|
tooth_number: entry.tooth_number,
|
||||||
|
});
|
||||||
|
case "registration_address":
|
||||||
|
return fetchWrapper.post(`general/address/${id}/update/`, {
|
||||||
|
...entry,
|
||||||
|
registration_flg: true,
|
||||||
|
});
|
||||||
|
case "temporary_address":
|
||||||
|
return fetchWrapper.post(`general/address/${id}/update/`, {
|
||||||
|
...entry,
|
||||||
|
temporary_registration_flg: true,
|
||||||
|
});
|
||||||
|
case "identity_document":
|
||||||
|
return fetchWrapper.post(`general/identity_document/${id}/update/`, {
|
||||||
|
...entry,
|
||||||
|
});
|
||||||
|
case "insurance_policy":
|
||||||
|
return fetchWrapper.post(`general/insurance_policy/${id}/update/`, {
|
||||||
|
...entry,
|
||||||
|
title: "string",
|
||||||
|
});
|
||||||
|
case "person":
|
||||||
|
return fetchWrapper.post(`general/person/${id}/update/`, {
|
||||||
|
...entry,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRequestDataPerson(person, dental) {
|
||||||
|
const dataPersonRequest = {
|
||||||
|
identity_document: {
|
||||||
|
issued_by_org: person.issued_by_org,
|
||||||
|
issued_by_org_code: person.issued_by_org_code,
|
||||||
|
issued_by_date: moment(person.issued_by_date).format("YYYY-MM-DD"),
|
||||||
|
number: person.number_series.split(" ")[1],
|
||||||
|
series: person.number_series.split(" ")[0],
|
||||||
|
},
|
||||||
|
registration_address: {
|
||||||
|
full_address: person.registration_address,
|
||||||
|
},
|
||||||
|
temporary_address: {
|
||||||
|
full_address: person.temporary_address,
|
||||||
|
},
|
||||||
|
insurance_policy: {
|
||||||
|
series: person.policy_series,
|
||||||
|
number: person.policy_number,
|
||||||
|
organization: person.policy_organization,
|
||||||
|
},
|
||||||
|
person: {
|
||||||
|
insurance_number: person.insurance_number,
|
||||||
|
benefit_code: person.benefit_code,
|
||||||
|
allergic: dental.allergic,
|
||||||
|
},
|
||||||
|
agreement: {
|
||||||
|
agreement: person.agreement,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return dataPersonRequest;
|
||||||
|
}
|
||||||
|
export function getDentalEntiesValue(data, key) {
|
||||||
|
switch (key) {
|
||||||
|
case "complaints":
|
||||||
|
case "medications_taken":
|
||||||
|
case "disease_progress":
|
||||||
|
case "visual_examination":
|
||||||
|
case "diagnostic_findings":
|
||||||
|
case "survey_plan":
|
||||||
|
case "treatment_plan":
|
||||||
|
case "treatment_protocol":
|
||||||
|
case "clinical_diagnosis":
|
||||||
|
return data?.description;
|
||||||
|
case "thermometry":
|
||||||
|
return `${data?.temperature}`;
|
||||||
|
case "tonometry":
|
||||||
|
return `${data?.sys},${data?.dia},${data?.pul}`;
|
||||||
|
case "dental_bite":
|
||||||
|
return `${data?.custom},${data?.physiological},${data?.abnormal}`;
|
||||||
|
case "dmf_index":
|
||||||
|
return data["index_calculation"];
|
||||||
|
case "hygiene_index":
|
||||||
|
return data["index_calculation"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user