Добавил отображение процентов заполнения мед осмотра
This commit is contained in:
@@ -107,6 +107,12 @@ export default {
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
modelValue: {
|
||||
immediate: true,
|
||||
handler(value) {
|
||||
this.protocolData[this.data.state] = value;
|
||||
},
|
||||
},
|
||||
state: {
|
||||
immediate: true,
|
||||
handler(value) {
|
||||
|
||||
@@ -43,7 +43,9 @@ import MainFactorsForm from "@/pages/newMedicalCard/components/InitialInspection
|
||||
import ToothFormulaForm from "@/pages/newMedicalCard/components/InitialInspectionProtocol/Forms/ToothFormula/ToothFormulaForm.vue";
|
||||
import { protocolForms } from "@/pages/newMedicalCard/utils/medicalConfig.js";
|
||||
import ClinicalForm from "./Forms/ClinicalForm.vue";
|
||||
import { mapGetters, mapState } from "vuex";
|
||||
import { mapState } from "vuex";
|
||||
import { removeEmptyFields } from "@/shared/utils/changesObjects";
|
||||
import toothFormula from "@/store/modules/toothFormula";
|
||||
|
||||
export default {
|
||||
name: "MedicalProtocolsInspection",
|
||||
@@ -60,6 +62,7 @@ export default {
|
||||
props: { inspection: Boolean, fillInspection: Boolean },
|
||||
data() {
|
||||
return {
|
||||
initToothFormula: toothFormula.stateInit,
|
||||
percent: 0,
|
||||
protocolForms: protocolForms,
|
||||
list: [
|
||||
@@ -107,34 +110,64 @@ export default {
|
||||
...mapState({
|
||||
protocolData: (state) => state.medical.protocolData,
|
||||
}),
|
||||
...mapGetters({
|
||||
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;
|
||||
setPercent(data, sum) {
|
||||
switch (data) {
|
||||
case "KPUIndex":
|
||||
case "bite":
|
||||
case "hygieneIndex":
|
||||
if (this.protocolData[data]) sum += 1;
|
||||
break;
|
||||
case "anamnesis":
|
||||
case "cavity":
|
||||
case "clinical":
|
||||
case "complaints":
|
||||
case "illnesses":
|
||||
case "inspection":
|
||||
case "medications":
|
||||
case "survey":
|
||||
if (this.protocolData[data].length) sum += 1;
|
||||
break;
|
||||
case "data": {
|
||||
if (this.protocolData[data].complaints.length) sum += 0.5;
|
||||
this.protocolData[data].files.forEach((e) => {
|
||||
if (e.data.length) sum += 0.25;
|
||||
});
|
||||
break;
|
||||
}
|
||||
sum = Math.ceil(17 / sum);
|
||||
this.percent = sum > 1 ? sum * 10 : sum * 100;
|
||||
case "disease":
|
||||
case "preliminary":
|
||||
if (this.protocolData[data].text || this.protocolData[data].change)
|
||||
sum += 1;
|
||||
break;
|
||||
case "thermometry": {
|
||||
let obj = removeEmptyFields(this.protocolData[data]);
|
||||
for (let el in obj) {
|
||||
if (obj[el].result) sum += 0.25;
|
||||
if (obj[el].value) sum += 0.25;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "tonometry": {
|
||||
let obj = removeEmptyFields(this.protocolData[data]);
|
||||
for (let el in obj) if (obj[el].value) sum += 0.5;
|
||||
break;
|
||||
}
|
||||
case "toothFormula":
|
||||
if (
|
||||
JSON.stringify(this.initToothFormula) !==
|
||||
JSON.stringify(this.protocolData[data])
|
||||
)
|
||||
sum += 1;
|
||||
break;
|
||||
}
|
||||
return sum;
|
||||
},
|
||||
interestСalculation() {
|
||||
let sum = 0;
|
||||
for (let data in this.protocolData) sum = this.setPercent(data, sum);
|
||||
this.percent = Math.round((100 * Math.round(sum)) / 17);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -753,7 +753,6 @@ export const protocolForms = [
|
||||
"Киста в глазу",
|
||||
"Красные пятна на языке",
|
||||
"Фингал под глазом",
|
||||
"Гематома на щеке",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
@@ -374,7 +374,7 @@ const getters = {
|
||||
},
|
||||
toothFormula: {
|
||||
lacticBite: toothFormula.state.lacticBite,
|
||||
formula: toothFormula.state.formula,
|
||||
formula: JSON.parse(JSON.stringify(toothFormula.state.formula)),
|
||||
},
|
||||
data: {
|
||||
complaints: [
|
||||
@@ -427,7 +427,7 @@ const getters = {
|
||||
preliminary: { text: null },
|
||||
toothFormula: {
|
||||
lacticBite: toothFormula.stateInit.lacticBite,
|
||||
formula: toothFormula.stateInit.formula,
|
||||
formula: JSON.parse(JSON.stringify(toothFormula.stateInit.formula)),
|
||||
},
|
||||
data: {
|
||||
complaints: [],
|
||||
|
||||
Reference in New Issue
Block a user