예제 #1
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public Invoice()
 {
     PatientCheckIn = new PatientCheckIn();
 }
예제 #2
0
        /// <summary>
        /// Check in a patient
        /// </summary>
        /// <returns></returns>
        public JsonResult AddCheckIn()
        {
            try
            {
                //Get patient object
                int patientID = int.Parse(Request.Form["patientID"]);
                PatientRepository patientRepo = new PatientRepository();
                var patient = patientRepo.Get(patientID);

                //Get Staff Object
                int staffId = int.Parse(Request.Form["staffID"]);
                UserRepository userRepo = new UserRepository();
                var staff = userRepo.Get(staffId);

                //Get Location Object
                int locationId = int.Parse(Request.Form["locationID"]);
                LocationRepository locationRepo = new LocationRepository();
                var location = locationRepo.Get(locationId);

                //Build Check In Object
                PatientCheckIn checkin = new PatientCheckIn();
                checkin.Patient = patient;
                checkin.CheckInTime = DateTime.Now;
                checkin.PatientType = (PatientCheckinType)Enum.Parse(typeof(PatientCheckinType), Request.Form["patientType"]);
                checkin.AttendingStaff = staff;
                checkin.Location = location;
                checkin.IsActive = true;

                //Build Invoice Object
                Invoice invoice = new Invoice();
                invoice.PatientCheckIn = checkin;
                checkin.Invoice = invoice;

                patient.PatientCheckIns.Add(checkin);
                new InvoiceRepository().Add(invoice);

                return Json(new
                {
                    error = "false"
                });
            }
            catch (Exception e)
            {
                return Json(new
                {
                    error = "true",
                    status = e.Message
                });
            }
        }
예제 #3
0
 /// <summary>
 /// Add encounter to a patient check in
 /// </summary>
 /// <param name="checkIn">check in to add the encounter to</param>
 public void AddEncounter(PatientCheckIn checkIn)
 {
     PatientCheckIns.Add(checkIn);
 }
예제 #4
0
 /// <summary>
 /// Remove encounter from a patient check in
 /// </summary>
 /// <param name="checkIn">check in to remove the encounter from</param>
 public void RemoveEncounter(PatientCheckIn checkIn)
 {
     PatientCheckIns.Remove(checkIn);
 }
예제 #5
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 public Invoice()
 {
     PatientCheckIn = new PatientCheckIn();
 }