Beispiel #1
0
        public PatientQueue GetPatientQueue(int idnt)
        {
            PatientQueue pq = null;

            SqlServerConnection conn = new SqlServerConnection();
            SqlDataReader       dr   = conn.SqlServerConnect("SELECT pq_idnt, pq_queue, pq_date, pq_time, pq_priority, pq_seen, ISNULL(NULLIF(pq_notes,''),'N/A')pq_notes, pt_idnt, ps_idnt, ps_names, ps_dob, ps_gender, bl_idnt, bl_cost, bl_amount, pq_provider, usr_name FROM PatientQueue INNER JOIN Patient ON pq_patient=pt_idnt INNER JOIN Person ON pt_person=ps_idnt LEFT OUTER JOIN Users ON pq_provider=usr_idnt LEFT OUTER JOIN Bills ON pq_bill = bl_idnt WHERE pq_idnt=" + idnt);

            if (dr.Read())
            {
                pq                       = new PatientQueue();
                pq.Id                    = Convert.ToInt16(dr[0]);
                pq.Queue.Id              = Convert.ToInt16(dr[1]);
                pq.Date                  = Convert.ToDateTime(dr[2]);
                pq.Time                  = TimeSpan.Parse(dr[3].ToString());
                pq.Priority              = Convert.ToInt16(dr[4]);
                pq.Seen                  = Convert.ToInt16(dr[5]);
                pq.Notes                 = dr[6].ToString();
                pq.Patient.Id            = Convert.ToInt16(dr[7]);
                pq.Patient.Person.Id     = Convert.ToInt16(dr[8]);
                pq.Patient.Person.Name   = dr[9].ToString();
                pq.Patient.Person.DoB    = Convert.ToDateTime(dr[10]);
                pq.Patient.Person.Gender = dr[11].ToString();
                pq.Bill.Id               = Convert.ToInt16(dr[12]);
                pq.Bill.Cost             = Convert.ToDouble(dr[13]);
                pq.Bill.Amount           = Convert.ToDouble(dr[14]);
                pq.Provider.Id           = Convert.ToInt16(dr[15]);
                pq.Provider.Name         = dr[16].ToString();
            }

            return(pq);
        }
Beispiel #2
0
        public async Task UpdatePatientLocation(string patientId, int locationId, int accountId, int hospitalUnitId, int newHospitalUnitId, int encounterId)
        {
            var patientQueue = await _context.PatientQueue.Where(q => q.PatientId == patientId && q.EncounterId == encounterId &&
                                                                 q.LocationId == locationId && q.AccountId == accountId && q.HospitalUnitId == hospitalUnitId && q.isCurrent == true).FirstOrDefaultAsync();

            if (patientQueue != null)
            {
                patientQueue.isCurrent         = false;
                patientQueue.ChangedLocationAt = DateTime.Now;
                _context.Update(patientQueue);
                await _context.SaveChangesAsync();

                PatientQueue newQueue = new PatientQueue();

                newQueue                   = patientQueue;
                newQueue.isCurrent         = true;
                newQueue.DateAdded         = DateTime.Now;
                newQueue.ChangedLocationAt = null;
                newQueue.HospitalUnitId    = newHospitalUnitId;
                newQueue.PatientQueueId    = 0;
                await _context.AddAsync(newQueue);

                await _context.SaveChangesAsync();

                //_context.Update(patientQueue);
                //await _context.SaveChangesAsync();
            }
        }
Beispiel #3
0
        public PatientDashboardOpdClinicViewModel()
        {
            queue = new Queue();
            pq    = new PatientQueue();

            notes = new ClinicalNotes();
        }
Beispiel #4
0
        public PatientQueue UpdatePatientQueueProvider(PatientQueue queue)
        {
            SqlServerConnection conn = new SqlServerConnection();

            queue.Id = conn.SqlServerUpdate("UPDATE PatientQueue SET pq_provider=" + queue.Provider.Id + " OUTPUT INSERTED.pq_idnt WHERE pq_idnt=" + queue.Id);

            return(queue);
        }
Beispiel #5
0
        public PatientQueue SavePatientQueue(PatientQueue queue)
        {
            SqlServerConnection conn = new SqlServerConnection();

            queue.Id = conn.SqlServerUpdate("IF NOT EXISTS (SELECT pq_idnt FROM PatientQueue WHERE pq_idnt=" + queue.Id + ") BEGIN INSERT INTO PatientQueue(pq_queue, pq_patient, pq_bill, pq_priority, pq_provider, pq_notes) OUTPUT INSERTED.pq_idnt VALUES (" + queue.Queue.Id + ", " + queue.Patient.Id + ", " + queue.Bill.Id + ", " + queue.Priority + ", " + queue.Provider.Id + ", '" + queue.Notes + "') END ELSE BEGIN UPDATE PatientQueue SET pq_date='" + queue.Date + "', pq_priority=" + queue.Priority + ", pq_provider=" + queue.Provider.Id + ", pq_notes='" + queue.Notes + "' OUTPUT INSERTED.pq_idnt WHERE pq_idnt=" + queue.Id + " END");

            return(queue);
        }
        public PatientDashboardTriageViewModel()
        {
            queue  = new Queue();
            pq     = new PatientQueue();
            triage = new Triage();

            lmp = "";
        }
        public IActionResult PostRegistration(RegistrationNewViewModel model)
        {
            Input.Patient.Person.DoB = DateTime.ParseExact(Input.DoB, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            Input.Patient.Save();

            Input.NextOfKin.Person = Input.Patient.Person;
            Input.NextOfKin.Save();

            Bills bill = new Bills
            {
                Amount  = Input.Billables.Amount,
                Patient = Input.Patient,
                Notes   = "New Patient Visit"
            };

            if (bill.Amount.Equals(0))
            {
                bill.Flag = 1;
            }

            bill.Save();

            BillsItems items = new BillsItems
            {
                Bill        = bill,
                Item        = Input.Billables,
                Amount      = Input.Billables.Amount,
                Description = Input.Billables.Description
            };

            items.Save();

            PatientQueue queue = new PatientQueue
            {
                Patient = Input.Patient,
                Queue   = new Queue(Input.Room),
                Bill    = bill
            };

            queue.Save();

            return(LocalRedirect("/patient-registration/new-patient"));
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            Console.WriteLine("**1. Luodaan henkilö");
            //new Personnel.Person ("Kake");
            //nimiavaruus 2 tapaa hoitaa (using Personnel tai Personnel.)
            Person p1 = new Person("Maija");
            Person p2 = new Person("Paavo");

            Console.WriteLine(p1.ToString());
            //Console.WriteLine (p1); sama kuin yllä
            Console.WriteLine("1. person " + p1.GetInfo());
            Console.WriteLine("2. person " + p2.GetInfo());

            Console.WriteLine("**2. Luodaan potilaita");
            Patient pat1 = new Patient("Kake", "lobotomia");
            Patient pat2 = new Patient("Kake2", "varpaan poisto");
            Patient pat3 = new Patient("Kake3", "uusi silmä");
            Patient pat4 = new Patient("Kake4", "uusi käsi");
            Patient pat5 = new Patient("Kake5", "uusi maksa");

            Console.WriteLine("1. patient " + pat1.GetInfo());
            Console.WriteLine("2. patient " + pat2.GetInfo());
            Console.WriteLine("3. patient " + pat3.GetInfo());
            Console.WriteLine("4. patient " + pat4.GetInfo());
            Console.WriteLine("5. patient " + pat5.GetInfo());

            Console.WriteLine("**3. Luodaan lääkäri");
            Doctor doc = new Doctor("Sara", "aivokirurgi");

            Console.WriteLine("1. doctor " + doc.GetInfo());

            Console.WriteLine("**4. Luodaan hoitojono");
            PatientQueue pq = new PatientQueue("HUS", doc);

            pq.AddPatient(pat1);
            pq.AddPatient(pat2);
            pq.AddPatient(pat3);
            pq.AddPatient(pat4);
            pq.AddPatient(pat5);
            Console.WriteLine(pq.GetInfo());
        }
Beispiel #9
0
        public List <PatientQueue> GetPatientQueues(Queue q)
        {
            List <PatientQueue> queues = new List <PatientQueue>();

            SqlServerConnection conn = new SqlServerConnection();
            SqlDataReader       dr   = conn.SqlServerConnect("SELECT pq_idnt, pq_queue, pq_date, pq_time, pq_priority, pq_seen, ISNULL(NULLIF(pq_notes,''),'N/A')pq_notes, pt_idnt, ps_idnt, ps_names, ps_dob, ps_gender, bl_idnt, bl_cost, bl_amount, pq_provider, usr_name FROM PatientQueue INNER JOIN Patient ON pq_patient=pt_idnt INNER JOIN Person ON pt_person=ps_idnt LEFT OUTER JOIN Users ON pq_provider=usr_idnt LEFT OUTER JOIN Bills ON pq_bill = bl_idnt WHERE pq_seen IN (0) AND (bl_flag IS NULL OR bl_flag=1) AND pq_queue=" + q.Id + " ORDER BY pq_date, pq_priority DESC, pq_time");

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    PatientQueue pq = new PatientQueue
                    {
                        Id       = Convert.ToInt16(dr[0]),
                        Queue    = q,
                        Date     = Convert.ToDateTime(dr[2]),
                        Time     = TimeSpan.Parse(dr[3].ToString()),
                        Priority = Convert.ToInt16(dr[4]),
                        Seen     = Convert.ToInt16(dr[5]),
                        Notes    = dr[6].ToString()
                    };

                    pq.Patient.Id            = Convert.ToInt16(dr[7]);
                    pq.Patient.Person.Id     = Convert.ToInt16(dr[8]);
                    pq.Patient.Person.Name   = dr[9].ToString();
                    pq.Patient.Person.DoB    = Convert.ToDateTime(dr[10]);
                    pq.Patient.Person.Gender = dr[11].ToString();

                    pq.Bill.Id       = Convert.ToInt16(dr[12]);
                    pq.Bill.Cost     = Convert.ToDouble(dr[13]);
                    pq.Bill.Amount   = Convert.ToDouble(dr[14]);
                    pq.Provider.Id   = Convert.ToInt16(dr[15]);
                    pq.Provider.Name = dr[16].ToString();

                    queues.Add(pq);
                }
            }

            return(queues);
        }
Beispiel #10
0
        /// <summary>
        /// Creates 30 patients and adds them to the PatienQueue
        /// </summary>
        public void ThreadOne()
        {
            lock (krankenhausLock)
            {
                using (var db = new KrankenhausContext())
                {
                    for (int i = 0; i < 30; i++)
                    {
                        var newQueueSlip = new PatientQueue();
                        db.PatientQueue.Add(newQueueSlip);
                        db.SaveChanges();

                        var newPatient = KrankenhausHelpMethods.GetANewRandomPatient(rnd);
                        newPatient.PatientQueue = newQueueSlip;
                        db.Patients.Add(newPatient);
                        db.SaveChanges();
                    }

                    db.SaveChanges();
                }
            }
        }