public Patient MapDaoToBusinessObject(object daoObj, Patient patientBo) { var patientDao = (DataRow)daoObj; patientBo.LastName = patientDao["LastName"].ToString(); patientBo.FirstName = patientDao["FirstName"].ToString(); patientBo.Pid = patientDao["HospitalNumber"].ToString(); patientBo.LogicalUnitId = int.Parse(patientDao["LOGICALUNITID"].ToString()); decimal length = 0; decimal weight = 0; decimal.TryParse(patientDao["Length"].ToString(), out length); decimal.TryParse(patientDao["Weight"].ToString(), out weight); patientBo.Weight.BaseValue = weight; patientBo.Height.BaseValue = length; var addmissionDate = (DateTime?)patientDao["AddmissionDate"]; if (addmissionDate != null) { var span = DateTime.Now.Subtract(addmissionDate.Value); patientBo.DaysRegistered = span.Days; patientBo.RegisterDate = addmissionDate.Value; } patientBo.Unit = patientDao["LogicalUnitName"].ToString(); patientBo.Bed = patientDao["BedName"].ToString(); patientBo.Gender = patientDao["GenderID"].ToString(); return patientBo; }
public static PatientDto AssemblePatientDto(Patient patient) { var dto = new PatientDto(); dto.Id = patient.Id.ToString(); dto.PID = patient.Pid; dto.Weight = UnitValueDto.AssembleUnitValueDto(patient.Weight); dto.Height = UnitValueDto.AssembleUnitValueDto(patient.Height); return dto; }
public Patient MapDaoToBusinessObject(XElement xmlDaoObj, Patient patientBo) { patientBo.LastName = xmlDaoObj.Descendants("lastname").ElementAt(0).Value; patientBo.FirstName = xmlDaoObj.Descendants("firstname").ElementAt(0).Value; patientBo.Pid = xmlDaoObj.Descendants("hospitalnumber").ElementAt(0).Value; patientBo.RegisterDate = DateTime.Parse(xmlDaoObj.Descendants("admissiondate").ElementAt(0).Value); patientBo.Weight.BaseValue = decimal.Parse(xmlDaoObj.Descendants("weight").ElementAt(0).Value); patientBo.Height.BaseValue = decimal.Parse(xmlDaoObj.Descendants("length").ElementAt(0).Value); patientBo.Unit = xmlDaoObj.Descendants("unit").ElementAt(0).Value; patientBo.Bed = xmlDaoObj.Descendants("bedname").ElementAt(0).Value; return patientBo; }
public Patient[] GetPatientsByLogicalUnitFromDatabase(int logicalUnitId) { var sqlQuery = GetSql(); sqlQuery += "pat.DischargeDate IS NULL AND pat.LOGICALUNITID='" + logicalUnitId + "' ORDER BY pat.LastName;"; var sqlResult = PDMSDataRetriever.ExecuteSQL(sqlQuery); Patient[] patients = new Patient[sqlResult.Tables[0].Rows.Count]; for (int i = 0; i < sqlResult.Tables[0].Rows.Count; i++) { patients[i] = _pdmsMapper.MapDaoToBusinessObject(sqlResult.Tables[0].Rows[i], Patient.NewPatient()); } return patients; }
public static Patient NewPatient() { var patient = new Patient(); patient.Height = UnitValue.NewUnitValue(); patient.Height.Unit = "cm"; patient.Weight = UnitValue.NewUnitValue(); patient.Weight.Unit = "kg"; patient.Prescriptions = new EntitySet<Prescription>(); return patient; }
public Patient[] GetPatientsByLogicalUnitFromXml(int logicalUnitId) { var xmlDoc = XDocument.Parse(Informedica.GenPres.Data.Properties.Resources.patients); XElement logicalUnitElement; try { logicalUnitElement = xmlDoc.Descendants("logicalunit").ElementAt(logicalUnitId); }catch(Exception e) { return new Patient[0]; } var patientsObj = from c in logicalUnitElement.Descendants("patients") select c; var patients = new Patient[patientsObj.Count()]; int id = 0; foreach (var patientObj in patientsObj) { patients[id] = _xmlMapper.MapDaoToBusinessObject(patientObj, Patient.NewPatient()); id++; } return patients; }