private Patient ReadCellsForPatient(Patient patient, IRow row, int cellCount) { _resolver = new PatientDrugLevelResolver(_context, _drug, _uom); for (int cellCursor = 0; cellCursor < cellCount; cellCursor++) { if (row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK) != null) { ReadCell(patient, row, _resolver, cellCursor); } } return(_resolver.Resolve(patient)); }
private void ReadCell(Patient patient, IRow row, PatientDrugLevelResolver resolver, int cellCursor) { string header = _headers.ElementAt(cellCursor); string newObjectFields = (string)_dictonary[header]; string propertyValue = row.GetCell(cellCursor, MissingCellPolicy.CREATE_NULL_AS_BLANK).ToString(); if (!string.IsNullOrEmpty(propertyValue) && newObjectFields != null) { var klassAndField = newObjectFields.Split("."); switch (klassAndField[0]) { case "Patient": string propertyName = klassAndField[1]; if (propertyName == "Gender") { if (propertyValue == "F") { propertyValue = "Female"; } else if (propertyValue == "M") { propertyValue = "Male"; } } string valueToSet = propertyValue.Replace("RM2", String.Empty); if (propertyName == "FirstName" || propertyName == "LastName") { valueToSet = valueToSet.ToUpper(); } if (propertyName == "PatientStatusId") { valueToSet = GetPatientStatusId(propertyValue); } SetPatientProperty(patient, propertyName, row, cellCursor, valueToSet); break; case "PatientDrugLevel": resolver.SetProperty(klassAndField[1], propertyValue); break; } } }