public ActionResult NewPatientRecord(string appointmentId, string practitionerId, string patientId) { NewPatientRecordViewModel result = new NewPatientRecordViewModel(); PatientRecordModel newPatientRecord = new PatientRecordModel(); if (appointmentId != null) { newPatientRecord.AppointmentId = Guid.Parse(appointmentId); } else { newPatientRecord.AppointmentId = Guid.Empty; } newPatientRecord.PractitionerId = Guid.Parse(practitionerId); newPatientRecord.PatientId = Guid.Parse(patientId); //for appointment users and no appointment users //!newPatientRecord.AppointmentId.Equals(Guid.Empty) if (!newPatientRecord.PractitionerId.Equals(Guid.Empty) && !newPatientRecord.PatientId.Equals(Guid.Empty)) { PractitionerProcess process = new PractitionerProcess(); result = process.CreateNewPatientRecord(newPatientRecord); } //for not appointment user else { //no appointment made, retrive practitioner details } return(View(result)); }
public NewPatientRecordViewModel CreateNewRecord(PatientRecordModel vm) { NewPatientRecordViewModel result = new NewPatientRecordViewModel(); if (vm != null) { PractitionerBusiness businessLayer = new PractitionerBusiness(); result = businessLayer.CreateNewRecord(vm); } return(result); }
public NewPatientRecordViewModel CreateNewPatientRecord(PatientRecordModel vm) { var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl); RestRequest request = new RestRequest(ConstantHelper.API.PatientRecord.CreateNewRecord, Method.POST); request.RequestFormat = DataFormat.Json; request.AddBody(vm); IRestResponse <NewPatientRecordViewModel> response = client.Execute <NewPatientRecordViewModel>(request); NewPatientRecordViewModel result = response.Data; return(result); }
public ActionResult NewPatientRecord(NewPatientRecordViewModel vm) { PractitionerProcess process = new PractitionerProcess(); vm.NewPatientRecord.MedicineDropDown = process.GetMedicinesDropDown(vm.PractitionerDetails); var test = vm.NewPatientRecord.MedicineDropDown[vm.NewPatientRecord.MedicinesId1]; if ((vm.NewPatientRecord.AllergicBool.Equals("No")) || ((vm.NewPatientRecord.AllergicBool.Equals("Yes") && !String.IsNullOrEmpty(vm.NewPatientRecord.AllergicType)))) { //Conversion to pdf var viewToString = RenderViewToString(ControllerContext, "~/Views/Shared/RecordTemplate.cshtml", vm, false); FileContentResult fileResult = new FileContentResult(PdfSharpConvert(viewToString), ConstantHelper.AppSettings.RecordFileType); RecordFileSystem fileRecord = new RecordFileSystem(); fileRecord.Id = vm.NewPatientRecord.RecordId; fileRecord.FileContents = fileResult.FileContents; fileRecord.FileDownloadname = DateTime.Now.ToString("dd-MM-yyyy") + "-" + vm.PractitionerDetails.CompanyId + ".pdf"; //Continue call to API vm.NewPatientRecord.CompanyId = vm.PractitionerDetails.CompanyId; int returnResult = process.StoreRecordToDB(fileRecord, vm.NewPatientRecord); if (returnResult != 0) { //return fileResult; return(Content(@"<body> <script type='text/javascript'> if(confirm('Patient Record updated successfully. Press Ok to close current tab.')){ window.close(); window.opener.location.reload(); }; </script> </body> ")); } else { return(Content(@"<body> <script type='text/javascript'> if(confirm('Fail to insert record to database. Press ok to go back.')){ window.history.back(); }; </script> </body> ")); } } else { //Stop, return error return(Json(new { status = "Error", message = "Allergic selected is Yes. The textbox below it cannot be empty." })); } //return View(vm); }
public NewPatientRecordViewModel CreateNewRecord(PatientRecordModel vm) { NewPatientRecordViewModel result = new NewPatientRecordViewModel(); PractitionerData practitionerData = new PractitionerData(); PatientData patientData = new PatientData(); //Retrieve practitioner and company information PractitionerBaseViewModel practitionerId = new PractitionerBaseViewModel(); practitionerId.AccId = vm.PractitionerId; result.PractitionerDetails = practitionerData.GetProfile(practitionerId); // Retrieve patient information result.PatientDetails = patientData.PatientProfile(vm.PatientId); vm.CreatedOn = DateTime.UtcNow; RecordFileSystem fileRecord = new RecordFileSystem(); fileRecord.ContentType = ConstantHelper.AppSettings.RecordFileType; fileRecord.FileContents = new byte[1]; fileRecord.FileDownloadname = DateTime.Now.Date.ToString() + "-" + result.PractitionerDetails.CompanyId; fileRecord.PatientId = result.PatientDetails.AccId; fileRecord.PractitionerId = result.PractitionerDetails.AccId; //Get medicines list in the company result.NewPatientRecord = practitionerData.GetMedicinesList(result.PractitionerDetails.CompanyId); result.NewPatientRecord.AppointmentId = vm.AppointmentId; result.NewPatientRecord.PatientId = vm.PatientId; result.NewPatientRecord.PractitionerId = vm.PractitionerId; //Creating a record in the database result.NewPatientRecord.RecordId = practitionerData.CreatePatientRecord(fileRecord); return(result); }