Exemplo n.º 1
0
        private void Open()
        {
            try
            {
                using (WaitCursor wc = new WaitCursor())
                {
                    int id = SelectedId;
                    if (id != 0)
                    {
                        Observation observation = null;
                        using (GmConnection conn = App.CreateConnection())
                        {
                            observation = Observation.GetObservation(conn, id);
                        }
                        if (observation != null)
                        {
//							string observationTypeName = (string)SelectedRow["ObservationTypeName"];
                            ObservationForm form = new ObservationForm(observation, patientName);
                            if (form.ShowDialog() == DialogResult.OK)
                            {
                                UpdateRow(SelectedRow, observation);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }