Beispiel #1
0
        public void InsertData(string currUser, PatientAppointmentModel oClass)
        {
            strSql = strSql + "INSERT INTO " + TABLE_NAME + " (" +
                     COLUMN_CASE_NO + ", " +
                     COLUMN_PATIENT_NO + ", " +
                     COLUMN_DATE + ", " +
                     COLUMN_APPOINTMENT_TYPE + ", " +
                     COLUMN_PHYSICIAN_ID + ", " +
                     COLUMN_STATUS_ID + ", " +
                     COLUMN_REMARKS + ", " +
                     "created_by, created_date, updated_by, updated_date) ";
            strSql = strSql + "values ('" +
                     oClass.CaseNo + "', '" +
                     oClass.PatientNo + "', '" +
                     oClass.AppointmentDate.ToString("yyyy-MM-d HH:MM:ss") + "', '" +
                     oClass.AppointmentType + "', '" +
                     oClass.PhysicianID + "', '" +
                     oClass.StatusID + "', '" +
                     oClass.Remarks.Replace("'", "") + "', '" +
                     currUser + "', " +
                     "CurDate(), '" +
                     currUser + "', " +
                     "CurDate() " +
                     ") ";

            SaveData(strSql);
        }
        private void SaveData()
        {
            string sUserName = Session["User"].ToString();

            oDAL   = new PatientAppointmentDAL();
            oClass = new PatientAppointmentModel();


            oClass.PatientNo       = PatientNo.Value;
            oClass.CaseNo          = "";
            oClass.AppointmentDate = Convert.ToDateTime(AppointmentDate.Value);
            oClass.PhysicianID     = Convert.ToInt16(ddlPhysician.SelectedValue);
            oClass.HospitalID      = Convert.ToInt16(ddlHospital.SelectedValue);
            oClass.StatusID        = 3;
            oClass.Remarks         = txtRemarks.InnerText;

            string id = AppointmentID.Value;

            if (id == "")
            {
                oDAL.InsertData(sUserName, oClass);
                //lblMsg.Text = "New Record has been saved";
            }
            else
            {
                oClass.ID = Convert.ToInt16(id);
                oDAL.UpdateData(sUserName, oClass);
                // lblMsg.Text = "Record has been updated";
            }
        }
Beispiel #3
0
 public JsonResult ReleasePatientFromWards(int id, int wardId)
 {
     using (var db = new MedicalContext())
     {
         PatientAppointmentModel appoint = db.Appointment.Find(id);
         appoint.WardId = 0;
         db.SaveChanges();
     }
     return(Json(1));
 }
Beispiel #4
0
        public DataSet SelectByID(PatientAppointmentModel oClass)
        {
            strSql = "SELECT A.*, Concat(B.FirstName, ' ', B.LastName) as PatientName, B.dob, C.FacilityName, Concat(D.FirstName, ' ', D.LastName) as PhysicianName, E.dname as Status " +
                     "FROM " + TABLE_NAME + " A INNER JOIN " + TABLE_PATIENT + " B on A.PatientNo = B.PatientNo " +
                     " LEFT OUTER JOIN " + TABLE_FACILITY + " C ON C.ID = A." + COLUMN_HOSPITAL_ID +
                     " LEFT OUTER JOIN " + TABLE_PHYSICIAN + " D ON D.ID = A." + COLUMN_PHYSICIAN_ID +
                     " LEFT OUTER JOIN " + TABLE_STATUS + " E ON E.ID = A." + COLUMN_STATUS_ID +
                     " WHERE A." + COLUMN_ID + " = '" + oClass.ID + "' ";

            return(Select(strSql));
        }
Beispiel #5
0
        public void DeleteData(string user, PatientAppointmentModel oClass)
        {
            strSql = "UPDATE " + TABLE_NAME + " SET " +
                     " isDeeleted = 1, " +
                     " ReasonDelete = '" + oClass.ReasonDelete.Replace("'", "''") + "', " +
                     " updated_by = '" + user + "', " +
                     " updated_date = '" + DateTime.Now.ToString("yyyy-MM-d HH:MM:ss") + "' " +
                     " WHERE " + COLUMN_ID + " = '" + oClass.ID + "' ";

            SaveData(strSql);
        }
    public void CreateAppointment(PatientAppointmentModel model)
    {
        var appointment = ModelMapper.Instance.To <PatientAppointment>(model);

        var appointmentAdded = _patientAppointmentLogic.Add(appointment);

        if (appointmentAdded)
        {
            _unitOfWork.SaveChanges();
        }
    }
        public ActionResult Prescription(Prescription prescription, int AppointmentId)
        {
            prescription.DocId   = Convert.ToInt32(Session["DoctorId"]);
            ViewBag.Prescription = "active";
            string searchdate = DateTime.Now.ToString("MM/dd/yyyy");
            string pdfname;

            pdfname = DateTime.Now.ToString("dd-MM-yyyy") + "_" + Guid.NewGuid() + ".pdf";
            using (var db = new MedicalContext())
            {
                if (prescription.WardId > 0)
                {
                    PatientAppointmentModel appointment = db.Appointment.Find(AppointmentId);
                    appointment.WardId = prescription.WardId;
                    db.SaveChanges();
                }
                var presdoc = from ap in db.Appointment
                              join p in db.Registers
                              on ap.PatientId equals p.Id
                              join d in db.Doctors
                              on ap.DoctorId equals d.Id
                              where ap.Id == AppointmentId
                              select new
                {
                    PatientName = p.Name,
                    PatientAge  = p.Age
                };
                foreach (var v in presdoc)
                {
                    prescription.PatientName = privacy.Decrypt(v.PatientName);
                    prescription.PatientAge  = v.PatientAge;
                }

                PatientAppointmentModel app = db.Appointment.Single(c => c.Id == AppointmentId && c.DoctorId == prescription.DocId &&
                                                                    c.Date == searchdate);
                app.Prescription = "Prescriptions/" + pdfname;
                db.SaveChanges();
            }

            var printpdf = new ActionAsPdf("MakePdf", prescription)
            {
                FileName = pdfname
            };
            string path       = Server.MapPath("~/Prescriptions");
            string a          = Path.Combine(path, pdfname);
            var    byteArray  = printpdf.BuildPdf(ControllerContext);
            var    fileStream = new FileStream(a, FileMode.Create, FileAccess.Write);

            fileStream.Write(byteArray, 0, byteArray.Length);
            fileStream.Close();

            return(printpdf);
        }
Beispiel #8
0
        private void LoadAppointment(int appointmentID)
        {
            PatientAppointmentDAL   appointmentDAL   = new PatientAppointmentDAL();
            PatientAppointmentModel appointmentModel = new PatientAppointmentModel();

            appointmentModel.ID = appointmentID;
            oDs = new DataSet();

            oDs = appointmentDAL.SelectByID(appointmentModel);

            //  ddlHospitalName.SelectedValue = oDs.Tables[0].Rows[0]["FacilityID"].ToString();
            ddlPhysician.SelectedValue = oDs.Tables[0].Rows[0]["PhysicianID"].ToString();

            LoadPatient(oDs.Tables[0].Rows[0]["PatientNo"].ToString());
        }
Beispiel #9
0
        public void UpdateData(string user, PatientAppointmentModel oClass)
        {
            strSql = "UPDATE " + TABLE_NAME + " SET " +
                     COLUMN_CASE_NO + " = '" + oClass.CaseNo + "', " +
                     COLUMN_PATIENT_NO + " = '" + oClass.PatientNo + "', " +
                     COLUMN_DATE + " = '" + oClass.AppointmentDate.ToString("yyyy-MM-d HH:MM:ss") + "', " +
                     COLUMN_APPOINTMENT_TYPE + " = '" + oClass.AppointmentType + "', " +
                     COLUMN_PHYSICIAN_ID + " = '" + oClass.PhysicianID + "', " +
                     COLUMN_HOSPITAL_ID + " = '" + oClass.HospitalID + "', " +
                     COLUMN_REMARKS + " = '" + oClass.Remarks.Replace("'", "''") + "', " +
                     " updated_by = '" + user + "', " +
                     " updated_date = '" + DateTime.Now.ToString("yyyy-MM-d HH:MM:ss") + "' " +
                     " WHERE " + COLUMN_ID + " = '" + oClass.ID + "' ";

            SaveData(strSql);
        }
Beispiel #10
0
        protected void Ok_ServerClick(object sender, EventArgs e)
        {
            string UserName = Session["User"].ToString();
            int    ID       = Convert.ToInt32(HiddenFieldItem.Value);

            oDAL   = new PatientAppointmentDAL();
            oClass = new PatientAppointmentModel();
            oDs    = new DataSet();

            oClass.IsDeleted    = true;
            oClass.ReasonDelete = itemname.InnerText;
            string lbl = lblSelectedItem.Text;

            oClass.ID = ID;
            oDAL.DeleteData(UserName, oClass);
            PopulateGrid();
        }
        public ActionResult PatientHistory(int id)
        {
            List <PatientAppointmentModel> appointmentlist = new List <PatientAppointmentModel>();

            using (var db = new MedicalContext())
            {
                int s    = db.Appointment.Where(c => c.Id == id).Select(c => c.PatientId).FirstOrDefault();
                var data = db.Appointment.Where(c => c.PatientId == s).Select(c => new { c.Prescription, c.Date });
                foreach (var d in data)
                {
                    PatientAppointmentModel appoint = new PatientAppointmentModel();
                    appoint.Prescription = d.Prescription;
                    appoint.Date         = d.Date;
                    appointmentlist.Add(appoint);
                }
            }
            return(View(appointmentlist));
        }
        public ActionResult Appointment(PatientAppointmentModel patientAppointment)
        {
            ViewBag.patient = "active";
            patientAppointment.PatientId = Convert.ToInt32(Session["PatientId"]);
            List <SpecialistModel> specialists;

            using (var db = new MedicalContext())
            {
                patientAppointment.Accepted = 3;
                db.Appointment.Add(patientAppointment);
                db.SaveChanges();


                specialists = db.Specialist.ToList();
            }
            ViewBag.Category = specialists;
            ViewBag.Error    = '1';
            return(View());
        }
        private void PopulateData(int id)
        {
            oDAL   = new PatientAppointmentDAL();
            oClass = new PatientAppointmentModel();
            oDs    = new DataSet();

            oClass.ID = id;

            oDs = oDAL.SelectByID(oClass);
            AppointmentID.Value = oDs.Tables[0].Rows[0][0].ToString();
            // CaseNo.Value = oDs.Tables[0].Rows[0][1].ToString();
            AppointmentDate.Value      = oDs.Tables[0].Rows[0][2].ToString();
            PatientNo.Value            = oDs.Tables[0].Rows[0]["PatientNo"].ToString();
            PatientName.Value          = oDs.Tables[0].Rows[0]["PatientName"].ToString();
            DOB.Value                  = Convert.ToDateTime(oDs.Tables[0].Rows[0]["DOB"]).ToShortDateString();
            ddlPhysician.SelectedValue = oDs.Tables[0].Rows[0]["PhysicianID"].ToString();
            ddlHospital.SelectedValue  = oDs.Tables[0].Rows[0]["FacilityID"].ToString();

            //   ddlStatus.SelectedValue = oDs.Tables[0].Rows[0]["StatusID"].ToString();
            txtRemarks.Value = oDs.Tables[0].Rows[0][6].ToString();
        }
        public JsonResult GetAllPatientByDoctorId(int id, string date)
        {
            List <PatientAppointmentModel> patients = new List <PatientAppointmentModel>();

            using (var db = new MedicalContext())
            {
                var a = db.Appointment.Where(s => s.DoctorId == id && s.Date == date);


                foreach (var k in a)
                {
                    PatientAppointmentModel patient = new PatientAppointmentModel();
                    patient.PatientName = k.PatientName;
                    patient.Number      = k.Number;
                    patient.Email       = k.Email;
                    patient.Sex         = k.Sex;
                    patients.Add(patient);
                }
            }
            return(Json(patients));
        }