diff --git a/ShoulderCase/@Patient/Patient.m b/ShoulderCase/@Patient/Patient.m index 7c940af..f1f1c12 100644 --- a/ShoulderCase/@Patient/Patient.m +++ b/ShoulderCase/@Patient/Patient.m @@ -1,35 +1,47 @@ classdef Patient < handle - %CLASSPATIENT Summary of this class goes here - % Detailed explanation goes here - - properties - id % id in the anonymized database - idMed % id of the medical center (anonymous key, but IPP while SecTrial not active) - gender % M or F - age % year at toime of preoperative CTscan - ethnicity - weight - height - BMI - comment - SCase + %CLASSPATIENT Summary of this class goes here + % Detailed explanation goes here + + properties + id % id in the anonymized database + idMed % id of the medical center (anonymous key, but IPP while SecTrial not active) + gender % M or F + age % year at toime of preoperative CTscan + ethnicity + weight + height + BMI + comment + SCase + end + + methods (Access = ?ShoulderCase) % Only ShoulderCase is allowed to construct a Patient + function obj = Patient(SCase) + %CLASSPATIENT Construct an instance of this class + % Detailed explanation goes here + obj.SCase = SCase; + obj.id = SCase.id; + obj.idMed = ''; + obj.gender = ''; + obj.age = []; + obj.ethnicity = ''; + obj.weight = []; + obj.height = []; + obj.BMI = []; + obj.comment = ''; end - - methods (Access = ?ShoulderCase) % Only ShoulderCase is allowed to construct a Patient - function obj = Patient(SCase) - %CLASSPATIENT Construct an instance of this class - % Detailed explanation goes here - obj.SCase = SCase; - obj.id = SCase.id; - obj.idMed = ''; - obj.gender = ''; - obj.age = []; - obj.ethnicity = ''; - obj.weight = []; - obj.height = []; - obj.BMI = []; - obj.comment = ''; - end + end + + methods + function output = loadData(obj) + % Call methods that can be run after the ShoulderCase object has + % been instanciated. + success = Logger.timeLogExecution(... + "Patient data: ",... + @(obj) obj.readPatientData(), obj); + output = success; end + end + end diff --git a/ShoulderCase/@Patient/readPatientData.m b/ShoulderCase/@Patient/readPatientData.m new file mode 100644 index 0000000..d8edb8b --- /dev/null +++ b/ShoulderCase/@Patient/readPatientData.m @@ -0,0 +1,25 @@ +function readPatientData(obj) + filename = fullfile(getConfig().dataDir, "Excel", "ShoulderDataBase.xlsx"); + patientData = readtable(filename, "Sheet", "SCase", "Text", "String"); + patientData = patientData(patientData.SCase_ID == obj.SCase.id,:); + + obj.SCase.diagnosis = patientData.diagnosis_name; + obj.SCase.treatment = patientData.treatment_name; + obj.SCase.patient.gender = patientData.patient_gender; + obj.SCase.patient.age = patientData.patient_age; + obj.SCase.patient.height = patientData.patient_height; + obj.SCase.patient.weight = patientData.patient_weight; + obj.SCase.patient.BMI = patientData.patient_BMI; + + if isequal(patientData.shoulder_side, "R") + obj.SCase.shoulders.right.auto.scapula.glenoid.walch =... + patientData.glenoid_walchClass; + obj.SCase.shoulders.right.manual.scapula.glenoid.walch =... + patientData.glenoid_walchClass; + elseif isequal(patientData.shoulder_side, "L") + obj.SCase.shoulders.left.auto.scapula.glenoid.walch =... + patientData.glenoid_walchClass; + obj.SCase.shoulders.left.manual.scapula.glenoid.walch =... + patientData.glenoid_walchClass; + end +end \ No newline at end of file