private void ViewB_Click(object sender, EventArgs e)
        {
            if (patientIDcb.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid Id");
                return;
            }

            if (patientIDcb.SelectedIndex > 0)
            {
                DbConnector dbConn = new DbConnector();
                dbConn.connect();
                PatientHandler patientHandler = new PatientHandler();
                int            patientId      = int.Parse(patientIDcb.SelectedItem.ToString());
                bool           status         = patientHandler.checkPatientID(dbConn.getConn(), patientId);
                string         selected1      = optional1ComboBox.SelectedItem.ToString().ToLower();

                if (status)
                {
                    if (optional1ComboBox.SelectedIndex == 0)
                    {
                        MessageBox.Show("Please select valid value for reading");
                        return;
                    }
                    if (optional1ComboBox.SelectedIndex > 0)
                    {
                        readingGridView.DataSource = patientHandler.patientWithOptional(dbConn.getConn(), patientId, selected1);
                    }
                }
                else
                {
                    MessageBox.Show("Invalid patient ID. Please try again", "Patient Not In Record", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemple #2
0
        public ActionResult GetListData()
        {
            var _draw          = Request.Form.GetValues("draw").FirstOrDefault();
            var _start         = Request.Form.GetValues("start").FirstOrDefault();
            var _length        = Request.Form.GetValues("length").FirstOrDefault();
            var _sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var _sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();
            var _searchValue   = Request.Form.GetValues("search[value]").FirstOrDefault();

            int _pageSize = _length != null?Convert.ToInt32(_length) : 0;

            int _skip = _start != null?Convert.ToInt32(_start) : 0;

            var request = new PatientRequest
            {
                Draw          = _draw,
                SearchValue   = _searchValue,
                SortColumn    = _sortColumn,
                SortColumnDir = _sortColumnDir,
                PageSize      = _pageSize,
                Skip          = _skip,
                Data          = new PatientModel()
            };

            if (Session["UserLogon"] != null)
            {
                request.Data.Account = (AccountModel)Session["UserLogon"];
            }

            var response = new PatientHandler(_unitOfWork, _context).GetListData(request);

            return(Json(new { data = response.Data, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw }, JsonRequestBehavior.AllowGet));
        }
        public async Task <bool> AddAsync(PatientDTO entity)
        {
            _context.Patients.Add(PatientHandler.MapToDb(entity));
            await _context.SaveChangesAsync();

            return(true);
        }
        private void patientIDcomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (patientIDcomboBox.SelectedIndex > 0)
            {
                DbConnector dbConn = new DbConnector();
                dbConn.connect();
                PatientHandler patientHandler = new PatientHandler();

                patientGridView.DataSource = patientHandler.getSpecificPatientList(dbConn.getConn(), patientIDcomboBox.SelectedItem.ToString());
            }
        }
        private void patientInformationBtn_Click(object sender, EventArgs e)
        {
            panelInformationPanel.Show();
            panel2.Hide();
            panel3.Hide();
            DbConnector dBConn = new DbConnector();

            dBConn.connect();
            PatientHandler patientHandler = new PatientHandler();

            patientHandler.FetchId(patientIDcomboBox);
        }
        private void readingBtn_Click(object sender, EventArgs e)
        {
            panelInformationPanel.Hide();
            panel2.Hide();
            panel3.Show();
            DbConnector dBConn = new DbConnector();

            dBConn.connect();
            PatientHandler patientHandler = new PatientHandler();

            patientHandler.FetchId(patientIDcb);
            FetchTableName(optional1ComboBox);
            //FetchTableName(optional2ComboBox);
            //FetchTableName(optional3ComboBox);
        }
Exemple #7
0
        public ActionResult CreateOrEditPatient()
        {
            PatientResponse _response = new PatientResponse();

            if (Request.QueryString["id"] != null)
            {
                var request = new PatientRequest
                {
                    Data = new PatientModel
                    {
                        Id = long.Parse(Request.QueryString["id"].ToString()),
                    }
                };
                if (Session["UserLogon"] != null)
                {
                    request.Data.Account = (AccountModel)Session["UserLogon"];
                }

                PatientResponse resp = new PatientHandler(_unitOfWork, _context).GetDetail(request);

                PatientModel _model = resp.Entity;

                ViewBag.Response     = _response;
                ViewBag.Relation     = BindDropDownRelation();
                ViewBag.PatientType  = BindDropDownPatientType();
                ViewBag.City         = BindDropDownCity();
                ViewBag.EmpReff      = BindDropDownEmployeeReff();
                ViewBag.Marital      = BindDropDownMaritalStatus();
                ViewBag.ReffRelation = BindDropDownReffRelation();
                ViewBag.ActionType   = ClinicEnums.Action.Edit;
                return(View(_model));
            }
            else
            {
                ViewBag.ActionType   = ClinicEnums.Action.Add;
                ViewBag.Response     = _response;
                ViewBag.Relation     = BindDropDownRelation();
                ViewBag.PatientType  = BindDropDownPatientType();
                ViewBag.EmpReff      = BindDropDownEmployeeReff();
                ViewBag.Marital      = BindDropDownMaritalStatus();
                ViewBag.City         = BindDropDownCity();
                ViewBag.ReffRelation = BindDropDownReffRelation();
                return(View("CreateOrEditPatient", new PatientModel()));
            }
        }
        public void TestAddNewPatient()
        {
            DbConnector dbC  = new DbConnector();
            string      resp = dbC.connect();

            Assert.AreEqual("Done", resp);

            Patient pat = new Patient();

            pat.Name  = "Jack Sparrow";
            pat.Age   = 23;
            pat.Mykad = "091209102309";

            PatientHandler pHnd  = new PatientHandler();
            int            resp2 = pHnd.addNewPatient(dbC.getConn(), pat);

            Assert.IsNotNull(resp2);
        }
        public async Task <bool> UpdateAsync(int id, PatientDTO entity)
        {
            try
            {
                var patient = await _context.Patients.Where(x => x.Id == id).FirstOrDefaultAsync();

                patient = PatientHandler.UpdateToDb(patient, entity);

                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Exemple #10
0
        //validate existing bedside from patient id
        public void FetchBedsideExistingPatientId(ComboBox selectedcomboBox)
        {
            selectedcomboBox.Items.Add("--Select ID--");

            selectedcomboBox.SelectedIndex = 0;
            DBConnector dbC = new DBConnector();

            dbC.connect();
            PatientHandler patientHandler = new PatientHandler();
            List <Patient> patientList    = new List <Patient>();

            patientList = patientHandler.getAllPatient(dbC.getConn());
            for (int i = 0; i < patientList.Count; i++)
            {
                if ((patientList[i].BedsideId != 0))
                {
                    selectedcomboBox.Items.Add(patientList[i].Id);
                }
            }
        }
        private void viewBtn_Click(object sender, EventArgs e)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();
            PatientHandler patientHandler = new PatientHandler();

            int patientId = int.Parse(patientIDcomboBox.Text);

            bool status = patientHandler.checkPatientID(dbConn.getConn(), patientId);

            if (status)
            {
                patientGridView.DataSource = patientHandler.getSpecificPatientList(dbConn.getConn(), patientIDcomboBox.Text);
            }
            else
            {
                MessageBox.Show("Invalid patient ID. Please try again", "Patient Not In Record", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #12
0
        public void TestAddNewPatient()
        {
            DbConnector dbC  = new DbConnector();
            string      resp = dbC.connect();

            Assert.AreEqual("Done", resp);

            Patient ptient = new Patient();

            ptient.Name      = "unitTestName";
            ptient.Age       = 23;
            ptient.Gender    = "Male";
            ptient.Wing      = "East Wing";
            ptient.Floor     = "Floor 1";
            ptient.Bedsideid = 3;

            PatientHandler UnitTest1 = new PatientHandler();
            int            resp2     = UnitTest1.addNewPatient(dbC.getConn(), ptient);

            Assert.IsNotNull(resp2);
        }
        public void TestPatient()
        {
            //connect database
            DBConnector dbC  = new DBConnector();
            string      resp = dbC.connect();

            Assert.AreEqual("Done", resp);
            PatientHandler phd      = new PatientHandler();
            Patient        patient1 = new Patient();

            Assert.IsInstanceOfType(patient1, typeof(object));

            //patient1.FullName = "Jason";
            //patient1.Nric = 123456789123;
            //patient1.Address = "13, Jalan Kepong Perdana";
            //patient1.Email = "*****@*****.**";
            //patient1.Gender = "Male";
            //patient1.Phone = 0123435761;
            //patient1.Age = 17;

            //int resp2 = PatientHandler.Instance.addNewPatient(dbC.getConn(), patient1);
            //Assert.IsNotNull(resp2);

            //string resp2 = phd.getLastRecordID(dbC.getConn());
            //Assert.IsNotNull(resp2);

            //int patientId = 1001;
            //bool resp2 = phd.checkPatientID(dbC.getConn(), patientId);
            //Assert.IsNotNull(resp2);

            //int selectedId = 1001;
            //Patient _ = phd.getSpecificPatient(dbC.getConn(), selectedId);

            //int resp2 = phd.updatePatientData(dbC.getConn(), patient1);
            //Assert.IsNotNull(resp2);

            //int id = 1001;
            //int resp2 = phd.deletePatientData(dbC.getConn(), id);
        }
        private void patientProfileBtn_Click(object sender, EventArgs e)
        {
            DBConnector dBConn = new DBConnector();

            dBConn.connect();
            PatientProfileScreen profileScreen = new PatientProfileScreen();

            profileScreen.Show();

            PatientHandler patientHandler = new PatientHandler();
            Patient        oldPatient     = patientHandler.getSpecificPatient(dBConn.getConn(), BedsideLoginScreen.bedside_patient_id);

            profileScreen.BedsideId    = BedsideLoginScreen.bedsideIDPass.ToString();
            profileScreen.PatientId    = oldPatient.Id.ToString();
            profileScreen.PatientName  = oldPatient.FullName;
            profileScreen.PatientNRIC  = oldPatient.IdentityCard.ToString();
            profileScreen.Age          = oldPatient.Age.ToString();
            profileScreen.AlarmDetails = "Blood Pressure Occurs: " + listbloodPressure.Count +
                                         Environment.NewLine + "Breathing Rate Occurs: " + listbreathingRate.Count +
                                         Environment.NewLine + "Pulse Rate Occurs: " + listPulseRate.Count +
                                         Environment.NewLine + "Temperature Occurs: " + listTemperature.Count;
        }
        public async Task <PatientDTO> GetAsync(int id)
        {
            var patient = await _context.Patients.Where(x => x.Id == id).Include(p => p.MedicalRecords).ThenInclude(m => m.User).FirstOrDefaultAsync();

            return(PatientHandler.MapToApp(patient));
        }
Exemple #16
0
 public PatientController(IPatientRepository repository, PatientHandler handler)
 {
     _repository = repository;
     _handler    = handler;
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });


            PatientHandler handler = (PatientHandler)app.ApplicationServices.GetService(typeof(PatientHandler));

            PatientServiceThrift.Processor processor = new PatientServiceThrift.Processor(handler);

            new Thread(() => RunServer(processor)).Start();

            // app.UseWebSockets();

            // app.Use(async (context, next) =>
            // {
            //     if (context.Request.Path == "/ws")
            //     {
            //         if (context.WebSockets.IsWebSocketRequest)
            //         {
            //             var socket = await context.WebSockets.AcceptWebSocketAsync();
            //             var patientService = (PatientService)app.ApplicationServices.GetService(typeof(PatientService));
            //             await patientService.AddUser(socket);
            //             while (socket.State == WebSocketState.Open)
            //             {
            //                 await Task.Delay(TimeSpan.FromMinutes(1));
            //             }
            //         }
            //         else
            //         {
            //             context.Response.StatusCode = 400;
            //         }
            //     }
            //     else
            //     {
            //         await next();
            //     }
            // });
            // app.UseSpa(config =>
            // {
            //     config.Options.SourcePath = "/./medpermapp-spa";
            //     if (env.IsDevelopment())
            //     {
            //         config.UseAngularCliServer("start");
            //     }
            // });
        }
Exemple #18
0
 public PatientController(PatientHandler patientHandler)
 {
     _patientHandler = patientHandler;
 }