public async Task <ActionResult> AppointmentMedicalRecord(int id, int?page) { var appointment = await _appointmentservices.GetAppointment(id); int pageIndex = page ?? 1; int dataCount = 3; ViewBag.patId = appointment.Pat_Id; ViewBag.phyId = appointment.Phys_id; ViewBag.appointNo = appointment.No; var patientRecordDetails = new PatientMedicalRecordDetailsViewModel { AppointmentId = appointment.No, PatientId = appointment.Pat_Id, PhyId = appointment.Phys_id, Phy_abr = _userphysicianservices.GetUserPhysician_By_Id(appointment.Phys_id).Abr, Patient = _patientservices.GetPatientById(appointment.Pat_Id) }; var medicalRecord = _patientrecordservices.GetAllRecords(appointment.Pat_Id, appointment.Phys_id); patientRecordDetails.MedicalRecordList = medicalRecord.OrderByDescending(t => t.RecordNo).ToList() .ToPagedList(pageIndex, dataCount); if (Request.IsAjaxRequest()) { return(PartialView("_RecordListPartialView", (PagedList <MedicalRecord>)patientRecordDetails.MedicalRecordList)); } return(View("MedicalHistory", patientRecordDetails)); }
public async Task <ActionResult> ServeAppointment(int apptId) { var appointment = await _appointmentServices.GetAppointment(apptId); if (appointment != null) { appointment.Status = true; _appointmentServices.ModifyAppointment(appointment); _unitOfWork.Commit(); var _url = Url.Action("GetAppointmentByDoctor", "DocAppointment", new { area = "Doctor", id = appointment.Phys_id, appointmentDate = appointment.AppointDate }); return(Json(new { success = true, url = _url }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> AppointmentOptions(AppointmentOptionsViewModel appointmentoption) { bool success = false; if (!ModelState.IsValid) { return(PartialView("_AppointmentOptions", appointmentoption)); } var appointment = await _appointmentServices.GetAppointment(appointmentoption.AppNo); string phyId = appointment.Phys_id; DateTime appdate = (DateTime)appointment.AppointDate; switch (appointmentoption.AppOptions) { case AppointOptions.Cancel: appointment.IsCancelled = true; _appointmentServices.ModifyAppointment(appointment); success = true; break; case AppointOptions.Remove: _appointmentServices.RemoveAppointment(appointment); success = true; break; case AppointOptions.Replace: if (appointment.Pat_Id != appointmentoption.RepIdNo) { //get medical record var medicalRecord = _patientRecordServices.GetMedicalRecordByAppointment(appointment.No); if (medicalRecord != null) { //remove medical record _patientRecordServices.RemoveMedicalRecord(medicalRecord); } //update appointment appointment.Pat_Id = appointmentoption.RepIdNo; _appointmentServices.ModifyAppointment(appointment); success = true; } break; case AppointOptions.Serve: appointment.Status = true; _appointmentServices.ModifyAppointment(appointment); success = true; break; } if (success == true) { appointHub = new AppointHub(); //var id = _userPhysicianService.GetPhysicianUserId(phyId); _unitofwork.Commit(); var appointSchedulebydoctor = await _appointmentServices.GetAllAppointmentList(); appointHub.SendAppointment(phyId, appointSchedulebydoctor.Where(t => t.PhyId == phyId && t.AppointDate == appdate).ToList()); } var url = Url.Action("GetAppointment_By_Doctor", "Appointment", new { id = phyId, appdate = appdate }); return(Json(new { success = success, url = url }, JsonRequestBehavior.AllowGet)); }