Пример #1
0
        public bool Discharge(string patientId)
        {
            var admissionQuery = string.Format("Select * FROM PatientAdmission WHERE PatientId='{0}'", patientId);
            var admissions     = patientAdmissionReader.FetchPatientAdmissions(conString, admissionQuery);

            if (admissions.Any())
            {
                m_patientRepo.AddAdmissionHistory(patientId, new AdmissionHistory
                {
                    AdmissionDate = admissions.First().AdmissionTime.ToString(),
                    Diagnosis     = admissions.First().Diagnosis,
                    Illness       = admissions.First().Illness
                });
                var bed = m_bedRepo.ReadPatientsBed(patientId);
                bed.Occupancy = "";
                m_bedRepo.Update(bed);


                string query = $"DELETE FROM PatientAdmission WHERE PatientId='{patientId}'";
                if (SqlCommands.ExecuteCommand(query, conString))
                {
                    return(DeletePatientDevices(patientId));
                }
            }
            return(false);
        }