예제 #1
0
        public static void saveInjection(string accessionNumber)
        {
            Injection injection;

            if (InjectionsManager.hasInjection(accessionNumber))
            {
                injection = InjectionsManager.getInjection(accessionNumber);
            }
            else
            {
                Console.Error.WriteLine("Injection with accessionNumber: {0} does not exist, @saveInjection()/InjectionManager", accessionNumber);
                return;
            }

            XElement xmlFile = injection.toXML();

            string date = DateTime.Now.ToString("ddMMyyyy");
            string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "InjectionSoftware", date, "injection");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string fullpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\InjectionSoftware\" + date + @"\injection\" + accessionNumber + ".xml";

            Console.WriteLine("[InjectionManager] saving injection of accessionNumber: {0}, to: {1}", accessionNumber, fullpath);
            xmlFile.Save(fullpath);
        }
예제 #2
0
        public static void LoadAllPatientFromSchedular()
        {
            string fullpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\InjectionSoftware\" + @"\Schedular";

            if (!Directory.Exists(fullpath))
            {
                Directory.CreateDirectory(fullpath);
            }

            foreach (var file in
                     Directory.EnumerateFiles(fullpath, "*.hl7"))
            {
                try
                {
                    string  text    = System.IO.File.ReadAllText(file);
                    Hl7file ff      = Hl7file.load(text);
                    Patient patient = new Patient(ff);
                    Console.Out.WriteLine("[PatientManager] Loading patient information from HL7 file with patientID:" + patient.PatientID);
                    if (patient.PatientID == "")
                    {
                        Console.WriteLine("[PatientManager.LoadAllPatient()] " + file + " path contain corrupted information, the patient information has failed to load");
                        continue;
                    }
                    ModPatient(patient);
                }
                catch (System.Exception e)
                {
                    Console.Error.WriteLine(e);
                }
            }

            InjectionsManager.recreateObservableList();
        }
예제 #3
0
        private static void reassignRoom()
        {
            // reassign patient (waiting for injection) to a list
            registeredPatients.Clear();
            foreach (Patient patient in PatientManager.Patients)
            {
                if (!InjectionsManager.hasInjection_patientID(patient.PatientID))
                {
                    registeredPatients.Add(patient);
                }
            }

            // assign patient with injection to corresponding room
            foreach (Room room in Room.Rooms)
            {
                //clear all previous injections of the room
                room.Injections.Clear();
                //loop through all injections one by one and assign them to room
                foreach (Injection injection in injections)
                {
                    if (injection.SelectedRoom == room && injection.patientStatus != "Discharged")
                    {
                        room.Injections.Add(injection);
                    }
                }
                //trigger the room injection changed method, it is used for changing the room page grid size
                room.InjectionsChanged();
            }

            // for the discharged row at the bottom of room page
            dischargedInjections.Clear();
            foreach (Injection injection in injections)
            {
                if (injection.patientStatus == "Discharged")
                {
                    dischargedInjections.Add(injection);
                }
            }
        }