コード例 #1
0
        public ActionResult Index()
        {
            ViewBag.Feature = "Danh sách";
            ViewBag.Element = KeyElement;

            if (Request.Url != null)
            {
                ViewBag.BaseURL = Request.Url.LocalPath;
            }

            using (var workScope = new UnitOfWork(new PatientManagementDbContext()))
            {
                var lstRole = RoleKey.GetDic();
                ViewBag.Roles = new SelectList(lstRole, "Value", "Text");

                List <Patient> patients = new List <Patient>();
                patients = new PatientManagementDbContext().Database.SqlQuery <Patient>("exec getPatient").ToList();


                ViewBag.Patients = new SelectList(patients, "Id", "FullName");

                List <BELibrary.Entity.Doctor> doctors = new List <BELibrary.Entity.Doctor>();
                doctors = new PatientManagementDbContext().Database.SqlQuery <BELibrary.Entity.Doctor>("exec getDoctor").ToList();

                ViewBag.Doctors = new SelectList(doctors, "Id", "Name");

                var listData = workScope.Accounts.GetAll().ToList();
                return(View(listData));
            }
        }
コード例 #2
0
        // GET: Admin/Statistical
        public ActionResult Index()
        {
            using (var workScope = new UnitOfWork(new PatientManagementDbContext()))
            {
                var categories = workScope.Categories.GetAll().ToList();
                ViewBag.Categories = new SelectList(categories, "Id", "Name");

                List <Patient> listData = new List <Patient>();
                listData = new PatientManagementDbContext().Database.SqlQuery <Patient>("exec ThongKeBenhNhanDoiThamKham").ToList();
                //ViewBag.Patients = listData;
                return(View(listData));
            }
        }
コード例 #3
0
        public JsonResult GetRegByYear(int year)
        {
            using (var workScope = new UnitOfWork(new PatientManagementDbContext()))
            {
                //var patients = workScope.Patients.GetAll();

                //var date = new DateTime(year, 1, 1);
                //var months = Enumerable.Range(0, 12)
                //    .Select(x => new
                //    {
                //        month = date.AddMonths(x).Month,
                //        year = date.AddMonths(x).Year
                //    }).ToList();

                //var dataPerYearAndMonth =
                //    months.GroupJoin(patients,
                //        m => new { m.month, m.year },
                //        patient => new
                //        {
                //            month = patient.JoinDate.Month,
                //            year = patient.JoinDate.Year
                //        },
                //        (p, g) => new
                //        {
                //            month = "Tháng " + p.month,
                //            p.year,
                //            count = g.Count()
                //        });



                SqlParameter paraYear = new SqlParameter("@year", year);
                paraYear.SqlDbType = SqlDbType.Int;
                List <StatisticPatient> lstPati = new List <StatisticPatient>();
                lstPati = new PatientManagementDbContext().Database.SqlQuery <StatisticPatient>("exec ThongkeBenhNhan_Nam @year", paraYear).ToList();

                return
                    (Json(new
                {
                    status = true,
                    mess = "Thành công ",
                    data = lstPati
                }));
            }
        }
コード例 #4
0
 public UnitOfWork(PatientManagementDbContext context)
 {
     _context            = context;
     Accounts            = new AccountRepository(_context);
     Categories          = new CategoryRepository(_context);
     DetailPrescriptions = new DetailPrescriptionRepository(_context);
     Items             = new ItemRepository(_context);
     DetailRecords     = new DetailRecordRepository(_context);
     Medicines         = new MedicineRepository(_context);
     Patients          = new PatientRepository(_context);
     MedicalSupplies   = new MedicalSupplyRepository(_context);
     Prescriptions     = new PrescriptionRepository(_context);
     Records           = new RecordRepository(_context);
     AttachmentAssigns = new AttachmentAssignRepository(_context);
     Attachments       = new AttachmentRepository(_context);
     Doctors           = new DoctorRepository(_context);
     Faculties         = new FacultyRepository(_context);
 }
コード例 #5
0
 public FacultyRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #6
0
 public DetailRecordRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #7
0
 public DoctorRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #8
0
        public ActionResult All(string patientCode, string indentificationCardId, string fullName)
        {
            ViewBag.Feature = "Danh sách";
            ViewBag.Element = KeyElement;
            ViewBag.BaseURL = "/Admin/Patient";
            if (patientCode == null)
            {
                patientCode = "";
            }

            if (indentificationCardId == null)
            {
                indentificationCardId = "";
            }
            if (fullName == null)
            {
                fullName = "";
            }
            //if (patientCode == "")
            //{
            //    patientCode = null;
            //}
            //if (indentificationCardId == "")
            //{
            //    indentificationCardId = null;
            //}
            //if (fullName == "")
            //{
            //    fullName = null;
            //}

            using (var workScope = new UnitOfWork(new PatientManagementDbContext()))
            {
                //patientCode = "'" + patientCode + "'";
                //indentificationCardId = "'" + indentificationCardId + "'";
                //fullName = "'" + fullName + "'";
                //var listData = workScope.Patients.Query(x => x.Status).OrderByDescending(x => x.JoinDate).ToList();
                SqlParameter patiCode_ = new SqlParameter("@patientcode", patientCode);
                SqlParameter cardId_   = new SqlParameter("@indentificationCardId", indentificationCardId);
                SqlParameter fullname_ = new SqlParameter("@fullname", fullName);
                patiCode_.SqlDbType = SqlDbType.VarChar;
                cardId_.SqlDbType   = SqlDbType.VarChar;
                fullname_.SqlDbType = SqlDbType.VarChar;
                List <Patient> listData = new List <Patient>();

                listData = new PatientManagementDbContext().Database.SqlQuery <Patient>("exec searchPatient @patientcode,@indentificationCardId,@fullname", patiCode_, cardId_, fullname_).ToList();
                //var data = listData.Where(x => x.JoinDate > new DateTime(2020, 5, 1) && x.JoinDate < new DateTime(2020, 6, 1));
                //var r = new Random();
                //foreach (var p in data)
                //{
                //    int rInt = r.Next(-10, 0);
                //    if (rInt % 2 != 0)
                //        p.JoinDate = DateTime.Now.AddMonths(rInt);
                //}
                //workScope.Complete();

                //var q = from mt in listData
                //        where (!string.IsNullOrEmpty(patientCode) && mt.PatientCode.ToLower().Contains(patientCode.ToLower()))
                //              || (!string.IsNullOrEmpty(indentificationCardId) && mt.IndentificationCardId.ToLower().Contains(indentificationCardId.ToLower()))
                //              || (!string.IsNullOrEmpty(fullName) && mt.FullName.ToLower().Contains(fullName.ToLower()))
                //        select mt;
                //if (patientCode == null && indentificationCardId == null && fullName == null)
                //{
                //    return View(listData);
                //}
                return(View(listData));
            }
        }
コード例 #9
0
 public DetailPrescriptionRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #10
0
 public AttachmentRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #11
0
ファイル: Repository.cs プロジェクト: Hoanghieu003/Project3
 public Repository(PatientManagementDbContext context)
 {
     Context = context;
 }
コード例 #12
0
 public MedicalSupplyRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #13
0
 public MedicineRepository(PatientManagementDbContext context)
     : base(context)
 {
 }
コード例 #14
0
 public PatientRepository(PatientManagementDbContext patientManagementDbContext)
 {
     _patientManagementDbContext = patientManagementDbContext;
 }
コード例 #15
0
 public CategoryRepository(PatientManagementDbContext context)
     : base(context)
 {
 }