Ejemplo n.º 1
0
        private void Save()
        {
            using (WaitCursor wc = new WaitCursor())
            {
                using (GmConnection conn = App.CreateConnection())
                {
                    int           patientId     = patient.Id;
                    int           wardId        = patient.wardId;
                    PatientTypeId patientTypeId = patient.patientTypeId;
                    try
                    {
                        if (ucPassport.Save())
                        {
                            passport.Save(conn);
                            patient.passportId = passport.Id;
                        }

                        if (ucInsurance.Save())
                        {
                            insurance.Save(conn);
                            patient.insuranceId = insurance.Id;
                        }

                        if (ucPatientIdentification.Save())
                        {
                            patientIdentification.Save(conn);
                            patient.patientIdentificationId = patientIdentification.Id;
                        }

                        ucPatientData.Save();
                        ucPatientDescription.Save();
                        ucDiagnoses.Save();
                    }
                    finally
                    {
                        if (patient.doctorId == 0)
                        {
                            patient.doctorId = App.Instance.UserId;
                        }
                        patient.Save(conn);
                        ucPrescriptions.Save(conn);
                        ucAnalyses.Save(conn);
                        if (wardId != patient.wardId || patientTypeId != patient.patientTypeId)
                        {
                            patient.SaveWardHistory(conn);
                        }
                        if (patientId == 0 && App.Instance.UserInfo.HasWatching)
                        {
                            Watching watching = App.Instance.UserInfo.Watching;
                            watching.AddPatient(patient.Id);
                            watching.Save(conn);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        int GetNextObservationHour(PatientTypeId patientTypeId, int prevHour)
        {
            switch (patientTypeId)
            {
            case PatientTypeId.Common: return(GetNextObservationHour(prevHour, commonObservationStartHour, commonObservationPeriod));

            case PatientTypeId.IntensiveCare: return(GetNextObservationHour(prevHour, intensiveCareObservationStartHour, intensiveCareObservationPeriod));

            case PatientTypeId.Reanimation: return(GetNextObservationHour(prevHour, reanimationObservationStartHour, reanimationObservationPeriod));
            }
            return(0);
        }
Ejemplo n.º 3
0
        public int GetObservationPeriod(PatientTypeId patientTypeId)
        {
            switch (patientTypeId)
            {
            case PatientTypeId.Common: return(depConfig.commonObservationPeriod);

            case PatientTypeId.IntensiveCare: return(depConfig.intensiveCareObservationPeriod);

            case PatientTypeId.Reanimation: return(depConfig.reanimationObservationPeriod);

            default: return(0);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        public Patient(DbDataReader dr)
        {
            GmDataReader gr = new GmDataReader(dr);

            id                      = gr.GetInt32();
            passportId              = gr.GetInt32();
            insuranceId             = gr.GetInt32();
            patientIdentificationId = gr.GetInt32();
            doctorId                = gr.GetInt32();
            diagnosisId             = gr.GetInt32();
            patientData             = PatientData.Create(gr.GetString());
            patientDescription      = PatientDescription.Create(gr.GetString());
            admissionDate           = gr.GetDateTime();
            wardId                  = gr.GetInt32();
            patientTypeId           = (PatientTypeId)gr.GetInt32();
            dischargeTypeId         = (DischargeTypeId)gr.GetInt32();
            dischargeData           = DischargeData.Create(gr.GetString());
            dischargeDate           = gr.GetDateTime();
            patientDiagnoses        = PatientDiagnoses.Create(gr.GetString());
            dietNumber              = gr.GetString();
            status                  = (Status)gr.GetInt32();
        }
Ejemplo n.º 6
0
        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);
            }
        }