private void ReadCell(Patient patient, IRow row, PatientHospitalAdmission admission, int cellIndex) { string header = _headers.ElementAt(cellIndex); string newObjectFields = (string)_dictonary[header]; string propertyValue = row.GetCell(cellIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString(); if (!string.IsNullOrEmpty(propertyValue) && newObjectFields != null) { var klassAndField = newObjectFields.Split("."); string propertyName = klassAndField[1]; if (klassAndField[0] == "PatientHospitalAdmission") { if (propertyName == "PreVisit") { if (propertyValue == "1") { admission.PreVisit = true; } } if (propertyName == "ICU") { if (propertyValue == "1") { admission.ICU = true; } } if (propertyName == "OneOrMoreAdmissions") { if (propertyValue == "1") { admission.OneOrMoreAdmissions = true; } } if (propertyName == "MoreThanOneAdmission") { if (propertyValue == "1") { admission.MoreThanOneAdmission = true; } } } } }
private Patient ReadCellsForPatient(Patient patient, IRow row, int cellCount) { var admission = new PatientHospitalAdmission(); admission.PatientId = patient.ID; for (int cellCursor = 0; cellCursor < cellCount; cellCursor++) { if (row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK) != null) { ReadCell(patient, row, admission, cellCursor); } } patient.PatientHospitalAdmissions.Add(admission); if (admission.PatientId != 0 && admission.PatientId > 0) { Imported.Add(admission); } return(patient); }