public Patient() { _patientId = -1; _patientInfo = new PatientInformation(); _monitoring = new List<Monitoring>(); _bloodwork = new Bloodwork(); _clinicalFindings = new ClinicalFindings(); _anestheticPlan = new AnestheticPlan(); _maintenance = new Maintenance(); }
public void SaveClinicalFindings(ClinicalFindings clinicalFindings) { if (service.UpdateClinicalFinding(clinicalFindings) == 0) { service.CreateClinicalFinding(clinicalFindings); } if (clinicalFindings.PriorAnesthesia.DateOfProblem != DateTime.MinValue || clinicalFindings.PriorAnesthesia.Problem != null) { clinicalFindings.PriorAnesthesia.PatientId = clinicalFindings.PatientId; SavePriorAnesthesia(clinicalFindings.PriorAnesthesia); } if (clinicalFindings.AnesthesiaConcerns.Count > 0) { service.DeleteAnesthesiaConcern(clinicalFindings.PatientId); SaveAnesthesiaConcerns(clinicalFindings.AnesthesiaConcerns, clinicalFindings.PatientId); } }
public void CreateClinicalFinding(ClinicalFindings cFind) { using (SqlConnection conn = new SqlConnection(connString)) { string sql = @"INSERT INTO dbo.Clinical_Findings ( PatientId, Temperature, PulseRate, RespiratoryRate, CardiacAuscultationId, PulseQualityId, MucousMembraneColorId, CapillaryRefillTimeId, RespiratoryAuscultationId, PhysicalStatusClassId, ReasonForClassification, CurrentMedications, OtherAnestheticConcerns ) VALUES ( @PatientId, @Temperature, @PulseRate, @RespiratoryRate, @CardiacAuscultationId, @PulseQualityId, @MucousMembraneColorId, @CapillaryRefillTimeId, @RespiratoryAuscultationId, @PhysicalStatusClassId, @ReasonForClassification, @CurrentMedications, @OtherAnestheticConcerns )"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@PatientId", SqlDbType.Int).Value = cFind.PatientId; if (cFind.Temperature == 0.0M) cmd.Parameters.Add("@Temperature", SqlDbType.Decimal).Value = DBNull.Value; else cmd.Parameters.Add("@Temperature", SqlDbType.Decimal).Value = cFind.Temperature; if (cFind.PulseRate == 0.0M) cmd.Parameters.Add("@PulseRate", SqlDbType.Decimal).Value = DBNull.Value; else cmd.Parameters.Add("@PulseRate", SqlDbType.Decimal).Value = cFind.PulseRate; if (cFind.RespiratoryRate == 0.0M) cmd.Parameters.Add("@RespiratoryRate", SqlDbType.Decimal).Value = DBNull.Value; else cmd.Parameters.Add("@RespiratoryRate", SqlDbType.Decimal).Value = cFind.RespiratoryRate; if (cFind.CardiacAuscultation.Id == -1) cmd.Parameters.Add("@CardiacAuscultationId", SqlDbType.Int).Value = DBNull.Value; else cmd.Parameters.Add("@CardiacAuscultationId", SqlDbType.Int).Value = cFind.CardiacAuscultation.Id; if (cFind.PulseQuality.Id == -1) cmd.Parameters.Add("@PulseQualityId", SqlDbType.Int).Value = DBNull.Value; else cmd.Parameters.Add("@PulseQualityId", SqlDbType.Int).Value = cFind.PulseQuality.Id; if (cFind.MucousMembraneColor.Id == -1) cmd.Parameters.Add("@MucousMembraneColorId", SqlDbType.NVarChar).Value = DBNull.Value; else cmd.Parameters.Add("@MucousMembraneColorId", SqlDbType.NVarChar).Value = cFind.MucousMembraneColor.Id; if (cFind.CapillaryRefillTime.Id == -1) cmd.Parameters.Add("@CapillaryRefillTimeId", SqlDbType.Int).Value = DBNull.Value; else cmd.Parameters.Add("@CapillaryRefillTimeId", SqlDbType.Int).Value = cFind.CapillaryRefillTime.Id; if (cFind.RespiratoryAuscultation.Id == -1) cmd.Parameters.Add("@RespiratoryAuscultationId", SqlDbType.Int).Value = DBNull.Value; else cmd.Parameters.Add("@RespiratoryAuscultationId", SqlDbType.Int).Value = cFind.RespiratoryAuscultation.Id; if (cFind.PhysicalStatusClassification.Id == -1) cmd.Parameters.Add("@PhysicalStatusClassId", SqlDbType.Int).Value = DBNull.Value; else cmd.Parameters.Add("@PhysicalStatusClassId", SqlDbType.Int).Value = cFind.PhysicalStatusClassification.Id; if (cFind.ReasonForClassification == null) cmd.Parameters.Add("@ReasonForClassification", SqlDbType.NVarChar).Value = DBNull.Value; else cmd.Parameters.Add("@ReasonForClassification", SqlDbType.NVarChar).Value = cFind.ReasonForClassification; if (cFind.CurrentMedications == null) cmd.Parameters.Add("@CurrentMedications", SqlDbType.NVarChar).Value = DBNull.Value; else cmd.Parameters.Add("@CurrentMedications", SqlDbType.NVarChar).Value = cFind.CurrentMedications; if (cFind.OtherAnestheticConcerns == null) cmd.Parameters.Add("@OtherAnestheticConcerns", SqlDbType.NVarChar).Value = DBNull.Value; else cmd.Parameters.Add("@OtherAnestheticConcerns", SqlDbType.NVarChar).Value = cFind.OtherAnestheticConcerns; try { conn.Open(); cmd.ExecuteNonQuery(); } catch (Exception e) { throw e; } finally { conn.Close(); } } }
public ClinicalFindings GetClinicalFindings(int patientId, params ClinicalFindings.LazyComponents[] lazyComponents) { ClinicalFindings clinincalFindings = new ClinicalFindings(); using (SqlConnection conn = new SqlConnection(connString)) { string sql = BuildClinicalFindingsSQL(); string from = @"FROM dbo.Clinical_Findings AS a"; string where = @" WHERE a.PatientId = @PatientId "; foreach (ClinicalFindings.LazyComponents a in lazyComponents) { if (a == ClinicalFindings.LazyComponents.LOAD_CARDIAC_WITH_DETAILS) { sql += @", b.CategoryId as 'b.CategoryId', b.Label as 'b.Label', b.OtherFlag as 'b.OtherFlag', b.Description as 'b.Description', b.Concentration as 'b.Concentration' "; from += @" LEFT OUTER JOIN dbo.Dropdown_Types as b ON a.CardiacAuscultationId = b.Id "; } else if (a == ClinicalFindings.LazyComponents.LOAD_PHYSICAL_STATUS_WITH_DETAILS) { sql += @", c.CategoryId as 'c.CategoryId', c.Label as 'c.Label', c.OtherFlag as 'c.OtherFlag', c.Description as 'c.Description', c.Concentration as 'c.Concentration' "; from += @" LEFT OUTER JOIN dbo.Dropdown_Types as c ON a.PhysicalStatusClassId = c.Id "; } else if (a == ClinicalFindings.LazyComponents.LOAD_PULSE_QUALITY_WITH_DETAILS) { sql += @", d.CategoryId as 'd.CategoryId', d.Label as 'd.Label', d.OtherFlag as 'd.OtherFlag', d.Description as 'd.Description', d.Concentration as 'd.Concentration' "; from += @" LEFT OUTER JOIN dbo.Dropdown_Types as d ON a.PulseQualityId = d.Id "; } else if (a == ClinicalFindings.LazyComponents.LOAD_RESPIRATORY_AUSCULTATION_WITH_DETAILS) { sql += @", e.CategoryId as 'e.CategoryId', e.Label as 'e.Label', e.OtherFlag as 'e.OtherFlag', e.Description as 'e.Description', e.Concentration as 'e.Concentration' "; from += @" LEFT OUTER JOIN dbo.Dropdown_Types as e ON a.RespiratoryAuscultationId = e.Id "; } else if (a == ClinicalFindings.LazyComponents.LOAD_MUCOUS_MEMBRANE_WITH_DETAILS) { sql += @", f.CategoryId as 'f.CategoryId', f.Label as 'f.Label', f.OtherFlag as 'f.OtherFlag', f.Description as 'f.Description', f.Concentration as 'f.Concentration' "; from += @" LEFT OUTER JOIN dbo.Dropdown_Types as f ON a.MucousMembraneColorId = f.Id "; } else if (a == ClinicalFindings.LazyComponents.LOAD_CAP_REFILL_WITH_DETAILS) { sql += @", g.CategoryId as 'g.CategoryId', g.Label as 'g.Label', g.OtherFlag as 'g.OtherFlag', g.Description as 'g.Description', g.Concentration as 'g.Concentration' "; from += @" LEFT OUTER JOIN dbo.Dropdown_Types as g ON a.CapillaryRefillTimeId = g.Id "; } } sql = sql + from + where; SqlCommand cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@PatientId", SqlDbType.Int).Value = patientId; try { conn.Open(); SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { clinincalFindings = new ClinicalFindingsCallback().ProcessRow(read, lazyComponents); } } catch (Exception e) { throw e; } finally { conn.Close(); } } return clinincalFindings; }