public ObservationInfo(DbDataReader dr) { int i = 0; patientId = dr.GetInt32(i++); observationTypeId = (ObservationTypeId)dr.GetInt32(i++); observationTime = dr.GetDateTime(i++); }
public Observation(DbDataReader dr) { GmDataReader gr = new GmDataReader(dr); id = gr.GetInt32(); patientId = gr.GetInt32(); doctorId = gr.GetInt32(); time = gr.GetDateTime(); description = ObservationData.Create(gr.GetString()); observationTypeId = (ObservationTypeId)gr.GetInt32(); }
private TaskTypeId GetTaskTypeId(ObservationTypeId observationTypeId) { switch (observationTypeId) { case ObservationTypeId.ChiefRound: return(TaskTypeId.ChiefRound); case ObservationTypeId.Diary: return(TaskTypeId.Diary); case ObservationTypeId.DoctorRound: return(TaskTypeId.DoctorRound); case ObservationTypeId.TemperatureCard: return(TaskTypeId.TemperatureCard); } return(TaskTypeId.Null); }
public static HandbookGroupId GetHandbookGroupId(ObservationTypeId observationTypeId) { switch (observationTypeId) { case ObservationTypeId.Diary: return(HandbookGroupId.Observation); case ObservationTypeId.DoctorRound: return(HandbookGroupId.DoctorRound); case ObservationTypeId.ChiefRound: return(HandbookGroupId.ChiefRound); case ObservationTypeId.TemperatureCard: return(HandbookGroupId.TemperatureCard); default: throw new HospitalDepartmentException("Unsupported argument in GetHandbookGroupId: " + observationTypeId.ToString()); } }
private void Add(ObservationTypeId observationTypeId) { try { using (WaitCursor wc = new WaitCursor()) { DataRow dr = GetPrevObservationRow(observationTypeId); DateTime prevTime = dr != null ? (DateTime)dr["Time"] : patient.admissionDate; DateTime dt = App.DepartmentConfig.GetNextObservationTime(observationTypeId, patient.patientTypeId, prevTime, dr == null); if (patient.dischargeDate != DateTime.MinValue && dt > patient.dischargeDate) { FormUtils.MessageExcl("Время наблюдения не должно быть позднее времени выписки."); return; } Observation observation = new Observation(observationTypeId); HandbookGroupId hgId = Observation.GetHandbookGroupId(observationTypeId); if (dr != null) { observation.description = ObservationData.Create(dr["Description"] as string); } else { observation.description.Init(App.Config[hgId], patient.patientDescription); } observation.time = dt; observation.patientId = patient.Id; observation.doctorId = App.Instance.UserId; ObservationForm form = new ObservationForm(observation, patientName); if (form.ShowDialog() == DialogResult.OK) { DataRow newRow = dataTable.NewRow(); dataTable.Rows.Add(newRow); UpdateRow(newRow, observation); newRow["ObservationTypeId"] = (int)observationTypeId; newRow["ObservationTypeName"] = observationTypes[observationTypeId]; GridViewUtils.SetCurrentRow(gridView, newRow); } } } catch (Exception ex) { Log.Exception(ex); } }
private TimeSpan GetObservationPeriod(ObservationTypeId observationTypeId, PatientTypeId patientTypeId) { switch (observationTypeId) { case ObservationTypeId.Diary: return(TimeSpan.FromHours(GetObservationPeriod(patientTypeId))); case ObservationTypeId.TemperatureCard: return(TimeSpan.FromHours(depConfig.temperatureObservationPeriod)); case ObservationTypeId.ChiefRound: return(TimeSpan.FromDays(depConfig.chiefRoundPeriod)); case ObservationTypeId.DoctorRound: return(TimeSpan.FromDays(depConfig.doctorRoundPeriod)); default: return(TimeSpan.Zero); } }
public DateTime GetNextObservationTime(ObservationTypeId observationTypeId, PatientTypeId patientTypeId, DateTime prevTime, bool firstObservation) { DateTime prevDate = prevTime.Date; int prevHour = prevTime.Hour; switch (observationTypeId) { case ObservationTypeId.Diary: { int nextHour = GetNextObservationHour(patientTypeId, prevHour); return(prevDate + TimeSpan.FromHours(nextHour)); } case ObservationTypeId.TemperatureCard: { if (firstObservation) { return(prevDate); } int nextHour = GetNextObservationHour(prevHour, temperatureObservationStartHour, temperatureObservationPeriod); return(prevDate + TimeSpan.FromHours(nextHour)); } case ObservationTypeId.ChiefRound: /* int curDay = (int)dt.DayOfWeek; * int targetDay = App.DepartmentConfig.chiefRoundDay; * int dif=targetDay-curDay; * if(dif<=0) dif+=7;*/ return(prevDate + TimeSpan.FromDays(chiefRoundPeriod) + TimeSpan.FromHours(chiefRoundHour)); case ObservationTypeId.DoctorRound: return(prevDate + TimeSpan.FromDays(doctorRoundPeriod) + TimeSpan.FromHours(doctorRoundHour)); default: throw new HospitalDepartmentException("Non supported ObservationTypeId: " + observationTypeId); } }
private DataRow GetPrevObservationRow(ObservationTypeId observationTypeId) { DataRow[] rows = dataTable.Select("ObservationTypeId=" + (int)observationTypeId, "Time"); return(rows.Length > 0? rows[rows.Length - 1] : null); }
private ObservationInfo GetObservationInfo(int patientId, List <ObservationInfo> observations, ObservationTypeId observationTypeId) { foreach (ObservationInfo observationInfo in observations) { if (observationInfo.patientId == patientId && observationInfo.observationTypeId == observationTypeId) { return(observationInfo); } } return(null); }
private void CheckObservations(List <Patient> patients, List <ObservationInfo> observations, ObservationTypeId observationTypeId) { List <Patient> taskPatients = new List <Patient>(); foreach (Patient patient in patients) { ObservationInfo observationInfo = GetObservationInfo(patient.Id, observations, observationTypeId); DateTime prevTime = observationInfo == null ? patient.admissionDate : observationInfo.observationTime; DateTime nextTime = depConfig.GetNextObservationTime(observationTypeId, patient.patientTypeId, prevTime, observationInfo == null); if (nextTime < DateTime.Now) { taskPatients.Add(patient); } } TaskTypeId taskTypeId = GetTaskTypeId(observationTypeId); AddTask(taskTypeId, taskPatients); }
public Observation(ObservationTypeId observationTypeId) { this.observationTypeId = observationTypeId; }