refactor: change props to encounter data

This commit is contained in:
riefive
2025-11-25 13:15:37 +07:00
parent 0ceaa9c222
commit d0ca67386f
2 changed files with 17 additions and 23 deletions

No files matched your search

+10 -9
View File
@@ -17,6 +17,7 @@ export interface EncounterProps {
}
export interface EncounterListData {
encounter?: any
status?: any
medicalAssessment?: any
medicalAssessmentRehab: any
@@ -233,12 +234,12 @@ export function injectComponents(id: string | number, data: EncounterListData, m
const currentKeys = { ...defaultKeys }
if (currentKeys?.status) {
currentKeys.status['component'] = StatusAsync
currentKeys.status['props'] = { encounter: data?.status }
currentKeys.status['props'] = { encounter: data?.encounter }
}
if (currentKeys?.earlyMedicalAssessment) {
currentKeys.earlyMedicalAssessment['component'] = EarlyMedicalAssesmentListAsync
currentKeys.earlyMedicalAssessment['props'] = {
encounter: data?.medicalAssessment,
encounter: data?.encounter,
type: 'early-medic',
label: currentKeys.earlyMedicalAssessment['title'],
}
@@ -246,7 +247,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
if (currentKeys?.rehabMedicalAssessment) {
currentKeys.rehabMedicalAssessment['component'] = EarlyMedicalRehabListAsync
currentKeys.rehabMedicalAssessment['props'] = {
encounter: data?.medicalAssessmentRehab,
encounter: data?.encounter,
type: 'early-rehab',
label: currentKeys.rehabMedicalAssessment['title'],
}
@@ -254,7 +255,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
if (currentKeys?.functionAssessment) {
currentKeys.functionAssessment['component'] = AssesmentFunctionListAsync
currentKeys.functionAssessment['props'] = {
encounter: data?.functionAssessment,
encounter: data?.encounter,
type: 'function',
label: currentKeys.functionAssessment['title'],
}
@@ -263,13 +264,13 @@ export function injectComponents(id: string | number, data: EncounterListData, m
// TODO: add component for therapyProtocol
currentKeys.therapyProtocol['component'] = null
currentKeys.therapyProtocol['props'] = {
data: data?.protocolTheraphy,
data: data?.encounter,
paginationMeta: meta?.protocolTheraphy,
}
}
if (currentKeys?.chemotherapyProtocol) {
currentKeys.chemotherapyProtocol['component'] = ChemoProtocolListAsync
currentKeys.chemotherapyProtocol['props'] = {
currentKeys.encounter['props'] = {
data: data?.protocolChemotherapy,
paginationMeta: meta?.protocolChemotherapy,
}
@@ -277,7 +278,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
if (currentKeys?.chemotherapyMedicine) {
currentKeys.chemotherapyMedicine['component'] = ChemoMedicineProtocolListAsync
currentKeys.chemotherapyMedicine['props'] = {
data: data?.medicineProtocolChemotherapy,
data: data?.encounter,
paginationMeta: meta?.medicineProtocolChemotherapy,
}
}
@@ -332,7 +333,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
}
if (currentKeys?.consultation) {
currentKeys.consultation['component'] = ConsultationAsync
currentKeys.consultation['props'] = { encounter: data?.consultation }
currentKeys.consultation['props'] = { encounter: data?.encounter }
}
if (currentKeys?.resume) {
currentKeys.resume['component'] = ResumeListAsync
@@ -340,7 +341,7 @@ export function injectComponents(id: string | number, data: EncounterListData, m
}
if (currentKeys?.control) {
currentKeys.control['component'] = ControlLetterListAsync
currentKeys.control['props'] = { encounter: data?.letterOfControl }
currentKeys.control['props'] = { encounter: data?.encounter }
}
if (currentKeys?.screening) {
// TODO: add component for screening