WIP Поправил отправку данных с мед карты, добавил обновление данных
This commit is contained in:
@@ -7,90 +7,90 @@
|
||||
base-detail-info(
|
||||
:title="configData.identity_document.title"
|
||||
:height="configData.identity_document.height"
|
||||
:data="medicalDataInit.identity_document"
|
||||
:data="defineEmptyData(configData.identity_document.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.identity_document.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.identity_document"
|
||||
:data="medicalDataInit"
|
||||
:mask="field.mask"
|
||||
)
|
||||
.flex.flex-col.gap-30px
|
||||
base-detail-info(
|
||||
:title="configData.registration_address.title"
|
||||
:height="configData.registration_address.height"
|
||||
:data="medicalDataInit.registration_address"
|
||||
:data="defineEmptyData(configData.registration_address.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.registration_address.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.registration_address"
|
||||
:data="medicalDataInit"
|
||||
)
|
||||
base-detail-info(
|
||||
:title="configData.temporary_address.title"
|
||||
:height="configData.temporary_address.height"
|
||||
:data="medicalDataInit.temporary_address"
|
||||
:data="defineEmptyData(configData.temporary_address.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.temporary_address.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.temporary_address"
|
||||
:data="medicalDataInit"
|
||||
)
|
||||
.flex.flex-col.gap-2
|
||||
base-detail-info(
|
||||
:title="configData.snils.title"
|
||||
:height="configData.snils.height"
|
||||
:data="medicalDataInit.snils"
|
||||
:data="defineEmptyData(configData.snils.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.snils.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.snils"
|
||||
:data="medicalDataInit"
|
||||
:mask="field.mask"
|
||||
)
|
||||
base-detail-info(
|
||||
:title="configData.policy.title"
|
||||
:height="configData.policy.height"
|
||||
:data="medicalDataInit.policy"
|
||||
:data="defineEmptyData(configData.policy.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.policy.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.policy"
|
||||
:data="medicalDataInit"
|
||||
:mask="field.mask"
|
||||
)
|
||||
base-detail-info(
|
||||
:title="configData.policy_organization.title"
|
||||
:height="configData.policy_organization.height"
|
||||
:data="medicalDataInit.policy_organization"
|
||||
:data="defineEmptyData(configData.policy_organization.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.policy_organization.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.policy_organization"
|
||||
:data="medicalDataInit"
|
||||
)
|
||||
.flex.flex-col.gap-4
|
||||
base-detail-info(
|
||||
:title="configData.additional.title"
|
||||
:height="configData.additional.height"
|
||||
:data="medicalDataInit.additional"
|
||||
:data="defineEmptyData(configData.additional.fields)"
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.additional.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.additional"
|
||||
:data="medicalDataInit"
|
||||
:mask="field.mask"
|
||||
)
|
||||
base-detail-info(
|
||||
:title="configData.agreement_form.title"
|
||||
:height="configData.agreement_form.height"
|
||||
:data="medicalDataInit.agreement_form"
|
||||
:data="defineEmptyData(configData.agreement_form.fields)"
|
||||
direction-row
|
||||
)
|
||||
base-detail-input(
|
||||
v-for="field in configData.agreement_form.fields"
|
||||
:field="field"
|
||||
:data="medicalDataInit.agreement_form"
|
||||
:data="medicalDataInit"
|
||||
)
|
||||
.flex.flex-col(class="px-92px gap-y-60px")
|
||||
.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 { medicalDetailConfig } 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 BaseInput from "@/components/base/BaseInput.vue";
|
||||
import ClientDetailInput from "@/pages/clients/components/ClientDetailInput.vue";
|
||||
@@ -132,140 +137,195 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
medicalCardData: undefined,
|
||||
personId: "",
|
||||
identityDocumentId: "",
|
||||
responseMedicalCardData: undefined,
|
||||
responseMedicalDentalData: {},
|
||||
numberCard: "",
|
||||
configData: medicalDetailConfig,
|
||||
medicalDataInit: {
|
||||
identity_document: {
|
||||
number_series: null,
|
||||
issued_by_org: null,
|
||||
issued_by_org_code: null,
|
||||
issued_by_date: null,
|
||||
},
|
||||
registration_address: {
|
||||
registration_address: null,
|
||||
},
|
||||
temporary_address: {
|
||||
temporary_address: null,
|
||||
},
|
||||
snils: {
|
||||
insurance_number: null,
|
||||
},
|
||||
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,
|
||||
},
|
||||
number_series: undefined,
|
||||
issued_by_org: undefined,
|
||||
issued_by_org_code: undefined,
|
||||
issued_by_date: undefined,
|
||||
registration_address: undefined,
|
||||
temporary_address: undefined,
|
||||
insurance_number: undefined,
|
||||
policy_series: undefined,
|
||||
policy_number: undefined,
|
||||
policy_organization: undefined,
|
||||
name_confidant: undefined,
|
||||
phone_confidant: undefined,
|
||||
benefit_code: undefined,
|
||||
agreement: undefined,
|
||||
agreement_date: undefined,
|
||||
},
|
||||
dentalIndications: {
|
||||
complaints: "",
|
||||
allergic_history: "",
|
||||
past_diseases: "",
|
||||
medications_taken: "",
|
||||
thermometry: "",
|
||||
tonometry: "",
|
||||
disease_progress: "",
|
||||
visual_examination: "",
|
||||
oral_examination: "",
|
||||
complaints: undefined,
|
||||
allergic: undefined,
|
||||
past_diseases: undefined,
|
||||
medications_taken: undefined,
|
||||
thermometry: undefined,
|
||||
tonometry: undefined,
|
||||
disease_progress: undefined,
|
||||
visual_examination: undefined,
|
||||
oral_examination: undefined,
|
||||
dental_formula: formulaDataMap,
|
||||
dental_bite: "",
|
||||
hygiene_index: "",
|
||||
dmf_index: "",
|
||||
diagnostic_findings: "",
|
||||
icd_code: "",
|
||||
survey_plan: "",
|
||||
survey_data: "",
|
||||
clinical_diagnosis: "",
|
||||
treatment_plan: "",
|
||||
treatment_protocol: "",
|
||||
dental_bite: undefined,
|
||||
hygiene_index: undefined,
|
||||
dmf_index: undefined,
|
||||
diagnostic_findings: undefined,
|
||||
icd_code: undefined,
|
||||
survey_plan: undefined,
|
||||
survey_data: undefined,
|
||||
clinical_diagnosis: undefined,
|
||||
treatment_plan: undefined,
|
||||
treatment_protocol: undefined,
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
defineEmptyData(fields) {
|
||||
return fields.map((field) => this.medicalDataInit[field.label]);
|
||||
},
|
||||
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) => {
|
||||
if (key === "dental_formula") {
|
||||
const notEmptyEntries =
|
||||
this.dentalIndications.dental_formula[0].columns
|
||||
.concat(this.dentalIndications.dental_formula[1].columns)
|
||||
.filter((el) => el.dental_condition && el.tooth_mobility);
|
||||
createEntryMedicalCard(
|
||||
notEmptyEntries,
|
||||
key,
|
||||
localStorage.getItem("medicalId")
|
||||
);
|
||||
notEmptyEntries.forEach((tooth) => {
|
||||
const toothResponse = this.responseMedicalDentalData[key].find(
|
||||
(el) => el.tooth_number === tooth.tooth_number
|
||||
);
|
||||
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) {
|
||||
createEntryMedicalCard(
|
||||
if (
|
||||
key !== "dental_formula" &&
|
||||
!this.responseMedicalDentalData[key] &&
|
||||
this.dentalIndications[key]
|
||||
) {
|
||||
requestCreateMedicalCard(
|
||||
this.dentalIndications[key],
|
||||
key,
|
||||
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) {
|
||||
this.medicalCardData = data;
|
||||
this.personId = data?.person?.id;
|
||||
this.numberCard = data?.number;
|
||||
const confidant = data ? data["confidant"] : undefined;
|
||||
const pass = data
|
||||
? data?.person?.identity_document?.find((el) => el.kind === "PASSPORT")
|
||||
: null;
|
||||
this.identityDocumentId = pass?.id;
|
||||
this.medicalDataInit = {
|
||||
...data,
|
||||
identity_document: {
|
||||
...pass,
|
||||
number_series: `${pass.series} ${pass.number}`,
|
||||
issued_by_date: new Date(pass.issued_by_date),
|
||||
},
|
||||
registration_address: {
|
||||
registration_address: data?.person?.address?.find(
|
||||
(el) => !el["registration_flg"]
|
||||
)?.join_adress,
|
||||
},
|
||||
temporary_address: {
|
||||
temporary_address: data?.person?.address?.find(
|
||||
(el) => !el["temporary_registration_flg"]
|
||||
)?.join_adress,
|
||||
},
|
||||
snils: {
|
||||
insurance_number: data?.person["insurance_number"],
|
||||
},
|
||||
policy: {
|
||||
...this.medicalDataInit.policy,
|
||||
...data?.person["insurance_policy"][0],
|
||||
},
|
||||
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,
|
||||
},
|
||||
...this.medicalDataInit,
|
||||
issued_by_org: pass.issued_by_org,
|
||||
issued_by_org_code: pass.issued_by_org_code,
|
||||
number_series: `${pass.series} ${pass.number}`,
|
||||
issued_by_date: new Date(pass.issued_by_date),
|
||||
registration_address: data?.person?.address?.find(
|
||||
(el) => el["registration_flg"]
|
||||
)?.join_address,
|
||||
temporary_address: data?.person?.address?.find(
|
||||
(el) => el["temporary_registration_flg"]
|
||||
)?.join_address,
|
||||
insurance_number: data?.person["insurance_number"] || undefined,
|
||||
policy_number: data?.person["insurance_policy"][0]?.number,
|
||||
policy_series: data?.person["insurance_policy"][0]?.series,
|
||||
policy_organization: data?.person["insurance_policy"][0]?.organization,
|
||||
name_confidant:
|
||||
confidant &&
|
||||
`${confidant?.last_name} ${confidant?.last_name} ${confidant?.patronymic}`,
|
||||
phone_confidant: confidant?.contacts?.find((el) => el?.kind === "PHONE")
|
||||
?.username,
|
||||
benefit_code: data?.person?.benefit_code,
|
||||
agreement: data?.agreement,
|
||||
agreement_date: undefined,
|
||||
};
|
||||
Object.keys(this.dentalIndications).forEach((key) => {
|
||||
if (key === "dental_formula" && data[key].length) {
|
||||
this.responseMedicalDentalData[key] = data[key];
|
||||
data[key].forEach((tooth) => {
|
||||
if (tooth.dental_condition && tooth.tooth_mobility) {
|
||||
if (17 < tooth.tooth_number < 29) {
|
||||
@@ -308,15 +368,20 @@ export default {
|
||||
});
|
||||
} else {
|
||||
this.dentalIndications[key] = data[key]?.length
|
||||
? data[key]
|
||||
.map((el) => {
|
||||
let value = el.title || el["index_calculation"];
|
||||
return value || "";
|
||||
})
|
||||
.join("")
|
||||
? getDentalEntiesValue(data[key].at(-1), key)
|
||||
: this.dentalIndications[key];
|
||||
this.dentalIndications.allergic = data?.person?.allergic
|
||||
? data?.person?.allergic
|
||||
: this.dentalIndications.allergic;
|
||||
this.responseMedicalDentalData[key] = data[key]?.length
|
||||
? data[key].at(-1)
|
||||
: this.dentalIndications[key];
|
||||
}
|
||||
});
|
||||
this.responseMedicalCardData = getRequestDataPerson(
|
||||
this.medicalDataInit,
|
||||
this.dentalIndications
|
||||
);
|
||||
},
|
||||
async fetchDataMedicalCard() {
|
||||
await fetchWrapper
|
||||
|
||||
Reference in New Issue
Block a user