示例#1
0
        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));
        }
示例#2
0
        public int StoreRecordToDB(RecordFileSystem fileSystem, PatientRecordModel patientRecord)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.PatientRecord.StoreRecordToDB, Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(fileSystem);

            IRestResponse <int> response = client.Execute <int>(request);
            int result       = response.Data;
            int secondResult = 0;

            if (result != 0)
            {
                request = new RestRequest(ConstantHelper.API.Appointment.CloseAppointment, Method.POST);
                request.RequestFormat = DataFormat.Json;
                request.AddBody(patientRecord);

                IRestResponse <int> response2 = client.Execute <int>(request);
                secondResult = response.Data;
            }

            return(secondResult);
        }
示例#3
0
        public PatientRecordModel GetMedicinesDropDown(Guid companyId)
        {
            PractitionerData   data   = new PractitionerData();
            PatientRecordModel result = new PatientRecordModel();

            result = data.GetMedicinesList(companyId);

            return(result);
        }
示例#4
0
        public PatientRecordModel GetMedicinesDropDown(PractitionerBaseViewModel vm)
        {
            PatientRecordModel result = new PatientRecordModel();

            if (vm != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.GetMedicinesDropDown(vm.CompanyId);
            }

            return(result);
        }
示例#5
0
        public NewPatientRecordViewModel CreateNewRecord(PatientRecordModel vm)
        {
            NewPatientRecordViewModel result = new NewPatientRecordViewModel();

            if (vm != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.CreateNewRecord(vm);
            }

            return(result);
        }
示例#6
0
        public Dictionary <string, string> GetMedicinesDropDown(PractitionerBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.PatientRecord.GetMedicinesDropDown, Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(vm);

            IRestResponse <PatientRecordModel> response = client.Execute <PatientRecordModel>(request);
            PatientRecordModel result = response.Data;

            return(result.MedicineDropDown);
        }
示例#7
0
        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);
        }
示例#8
0
        public int CloseAppointment(PatientRecordModel patientRecord)
        {
            int result = 0;

            if (patientRecord != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                businessLayer.StockUpdate(patientRecord);

                if (patientRecord.AppointmentId != null || !patientRecord.AppointmentId.Equals(Guid.Empty))
                {
                    result = businessLayer.CloseAppointment(patientRecord.AppointmentId);
                }
            }

            return(result);
        }
示例#9
0
        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);
        }
示例#10
0
 public NewPatientRecordViewModel()
 {
     NewPatientRecord    = new PatientRecordModel();
     PatientDetails      = new PatientViewModel();
     PractitionerDetails = new PractitionerBaseViewModel();
 }
示例#11
0
        public void StockUpdate(PatientRecordModel medicineGiven)
        {
            PractitionerData   data     = new PractitionerData();
            List <StockUpdate> stock    = new List <StockUpdate>();
            StockUpdate        medicine = new StockUpdate();

            if (medicineGiven.QuantityForMedicine1 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId1),
                    Quantity   = medicineGiven.QuantityForMedicine1,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine2 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId2),
                    Quantity   = medicineGiven.QuantityForMedicine2,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine3 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId3),
                    Quantity   = medicineGiven.QuantityForMedicine3,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine4 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId4),
                    Quantity   = medicineGiven.QuantityForMedicine4,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine5 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId5),
                    Quantity   = medicineGiven.QuantityForMedicine5,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine6 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId6),
                    Quantity   = medicineGiven.QuantityForMedicine6,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine7 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId7),
                    Quantity   = medicineGiven.QuantityForMedicine7,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine8 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId8),
                    Quantity   = medicineGiven.QuantityForMedicine8,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine9 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId9),
                    Quantity   = medicineGiven.QuantityForMedicine9,
                };
                stock.Add(medicine);
            }

            if (medicineGiven.QuantityForMedicine10 > 0)
            {
                medicine = new StockUpdate()
                {
                    MedicineId = Guid.Parse(medicineGiven.MedicinesId10),
                    Quantity   = medicineGiven.QuantityForMedicine10,
                };
                stock.Add(medicine);
            }

            data.StockUpdate(stock, medicineGiven);
        }