/// <summary>
        /// Retrieve All patients
        /// </summary>
        /// <returns></returns>
        public HttpResponseMessage GetAllPatient()
        {
            HttpResponseMessage httpResponseMessage;

            try
            {
                var patients = _patientServices.GetAllPatients();
                if (patients != null)
                {
                    var patientEntities = patients as List <PatientDetailsEntity> ?? patients.ToList();
                    httpResponseMessage         = new HttpResponseMessage(HttpStatusCode.OK);
                    httpResponseMessage.Content = new ObjectContent(typeof(List <PatientDetailsEntity>), patientEntities, GlobalConfiguration.Configuration.Formatters.JsonFormatter);
                    return(httpResponseMessage);
                }
                else
                {
                    httpResponseMessage         = new HttpResponseMessage(HttpStatusCode.NoContent);
                    httpResponseMessage.Content = new ObjectContent(typeof(string), "Patients data not found", GlobalConfiguration.Configuration.Formatters.JsonFormatter);
                    return(httpResponseMessage);
                }
            }
            catch (Exception ex)
            {
                httpResponseMessage         = new HttpResponseMessage(HttpStatusCode.InternalServerError);
                httpResponseMessage.Content = new ObjectContent(typeof(string), "An error occured while retriving patient inforamtion", GlobalConfiguration.Configuration.Formatters.JsonFormatter);
                return(httpResponseMessage);
            }
        }
        public void GetAllPatientsTest()
        {
            var patients = _patientService.GetAllPatients();

            if (patients != null)
            {
                var patientList =
                    patients.Select(
                        patientEntity =>
                        new PatientDetail {
                    DetailId = patientEntity.DetailId, PatientData = patientEntity.PatientData, Created = patientEntity.Created
                }).
                    ToList();
                var comparer = new PatientComparer();
                Assert.IsNotNull(patients);
            }
        }
Esempio n. 3
0
        public async Task <ActionResult> PrintPrescript(int medRecNo)
        {
            //var reportOption = new ReportOptionViewModel()
            //{
            //   recordNo = medRecNo
            //};

            var medicalRecordList = await _patientRecordServices.GetAllRecordsAsync();

            ContainerClass.MedicalRecord = (from m in medicalRecordList where m.RecordNo == medRecNo
                                            select new PrintMedicalRecordViewModel()
            {
                RecordNo = (int)m.RecordNo,
                PatientId = m.Pat_Id,
                PatFullname = m.Patient.Firstname + ' ' + m.Patient.Lastname,
                PatAddress = m.Patient.Muncity + ' ' + m.Patient.Province,
                PhyId = m.Phys_id,
                RecordedDate = (DateTime)m.RecordDate,
                Gender = m.Patient.Gender[0],
                Age = HelperClass.Utilities.GetAge((System.DateTime)m.Patient.DoB)
            }).ToList();

            var docprescription = _prescriptionServices.GetDocPrescriptionByRecNo(medRecNo).ToList();

            ContainerClass.DocPrescription = (from p in docprescription
                                              select new PrintDocPrescriptionViewModel()
            {
                PrescNo = p.PrescNo,
                RecNo = p.RecNo,
                PrescriptionDetails = p.PrescriptionDetails,
                Sig = p.Sig,
                DispInst = p.DispInst
            }).ToList();

            var patientList = await _patientServices.GetAllPatients();

            ContainerClass.PatientDetails = patientList.Where(t => t.PatientId == ContainerClass.MedicalRecord[0].PatientId).ToList();

            return(View("~/Views/Shared/ReportContainer.cshtml"));
        }
Esempio n. 4
0
        public async Task <JsonResult> GetAllPatientsAsync()
        {
            var patientlist = await _patientServices.GetAllPatients();

            return(Json(new { data = patientlist }, JsonRequestBehavior.AllowGet));
        }