public ActionResult Edit([Bind(Include = "MedicalRecordID,Name,LastName,BornDate,UserID")] MedicalRecord medicalRecord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(medicalRecord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(medicalRecord));
 }
        public MedicalRecord UpdateAllergies(Allergens allergy, MedicalRecord medicalRecord)
        {
            MedicalRecord medicalRecordToUpdate = medicalRecordRepository.GetObject(medicalRecord.IdRecord);

            if (!medicalRecordToUpdate.Allergies.Any(entity => entity.Allergen.Equals(allergy.Allergen)))
            {
                medicalRecordToUpdate.Allergies.Add(allergy);
            }
            return(medicalRecordRepository.Update(medicalRecordToUpdate));
        }
        public MedicalRecord UpdateLabResults(ListOfResults labResult, MedicalRecord medicalRecord)
        {
            MedicalRecord medicalRecordToUpdate = medicalRecordRepository.GetObject(medicalRecord.IdRecord);

            if (!medicalRecordToUpdate.ListOfResults.Any(entity => entity.Id == labResult.Id))
            {
                medicalRecordToUpdate.ListOfResults.Add(labResult);
            }
            return(medicalRecordRepository.Update(medicalRecordToUpdate));
        }
        public MedicalRecord UpdateVaccines(Vaccines vaccine, MedicalRecord medicalRecord)
        {
            MedicalRecord medicalRecordToUpdate = medicalRecordRepository.GetObject(medicalRecord.IdRecord);

            if (!medicalRecordToUpdate.Vaccines.Any(entity => entity.Name.Equals(vaccine.Name)))
            {
                medicalRecordToUpdate.Vaccines.Add(vaccine);
            }
            return(medicalRecordRepository.Update(medicalRecordToUpdate));
        }
        public MedicalRecord UpdateTherapy(Therapy therapy, MedicalRecord medicalRecord)
        {
            MedicalRecord medicalRecordToUpdate = medicalRecordRepository.GetObject(medicalRecord.IdRecord);

            if (!medicalRecordToUpdate.Therapies.Any(entity => entity.Medication.MedId == therapy.Medication.MedId))
            {
                medicalRecordToUpdate.Therapies.Add(therapy);
            }
            return(medicalRecordRepository.Update(medicalRecordToUpdate));
        }
Exemple #6
0
        public IActionResult Update(MedicalRecord medicalRecord)
        {
            var item = _context.MedicalRecords.Find(medicalRecord.Id);

            item.PatientId        = medicalRecord.PatientId;
            item.ShortDescription = medicalRecord.ShortDescription;
            _context.Update(item);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <int> CreateRecordAsync()
        {
            MedicalRecord record = new MedicalRecord();

            await this.recordsRepository.AddAsync(record);

            await this.recordsRepository.SaveChangesAsync();

            return(record.Id);
        }
        public async Task <IActionResult> CreateImmunizationDb(Immunization immunization)
        {
            _context.Immunizations.Add(immunization);
            await _context.SaveChangesAsync();

            var           medicalId     = immunization.MedicalRecordId;
            MedicalRecord medicalRecord = _context.MedicalRecords.Where(r => r.MedicalRecordId == medicalId).FirstOrDefault();

            return(RedirectToAction("Index", "MedicalRecords", new { petId = medicalRecord.PetId }));
        }
Exemple #9
0
        /// <summary>
        /// Removes a medical record from the db
        /// </summary>
        /// <param name="record">record to be removed</param>
        /// <exception cref="ArgumentNullException"></exception>
        public void RemoveMedicalRecord(MedicalRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            _context.MedicalRecords.Remove(record);
            _context.SaveChanges();
        }
Exemple #10
0
        public ReferralToHospitalTreatment WriteReferralToHospitalTreatment(Treatment treatment, DateTime startDate, DateTime endDate, string cause, List <Drug> drugs, RehabilitationRoom room)
        {
            ReferralToHospitalTreatment referralToHospitalTreatment = new ReferralToHospitalTreatment(cause, drugs);

            treatment.ReferralToHospitalTreatment = referralToHospitalTreatment;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);

            RehabilitationRoomService.Instance.AddPatient(medicalRecord, room);
            return(treatment.ReferralToHospitalTreatment);
        }
Exemple #11
0
        public MedicalRecordWindow(PatientManagementView pmv)
        {
            InitializeComponent();

            VM = pmv;

            MedicalRecord = VM.ClonedMedicalRecord;

            DataContext = VM;
        }
Exemple #12
0
        public MedicalRecordDTO CreateMedicalRecord([FromBody] MedicalRecordDTO medicalRecord)
        {
            MedicalRecord medicalRecordEntity = _mapper.Map <MedicalRecord>(medicalRecord);

            _repository.CreateMedicalRecord(medicalRecordEntity);
            _repository.Save();
            MedicalRecordDTO newMedicalRecord = _mapper.Map <MedicalRecordDTO>(medicalRecordEntity);

            return(newMedicalRecord);
        }
Exemple #13
0
        public UpdateMedicalRecordDTO UpdateMedicalRecord(int id, [FromBody] UpdateMedicalRecordDTO medicalRecord)
        {
            MedicalRecord medicalRecordEntity = _repository.GetMedicalRecordById(id);

            medicalRecord.Id = medicalRecordEntity.Id;
            _mapper.Map(medicalRecord, medicalRecordEntity);
            _repository.UpdateMedicalRecord(medicalRecordEntity);
            _repository.Save();
            return(medicalRecord);
        }
Exemple #14
0
 public ActionResult Edit([Bind(Include = "MedicalRecordID,Weight,Heigth,Age,ClientID")] MedicalRecord medicalRecord)
 {
     if (ModelState.IsValid)
     {
         medicalRepository.UpdateMedicalRecord(medicalRecord);
         medicalRepository.Save();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClientID = new SelectList(clientRepository.GetClients(), "ClientID", "FirstName", medicalRecord.ClientID);
     return(View(medicalRecord));
 }
        public MedicalRecord UpdateFamilyIllnessHistory(FamilyIllnessHistory diagnosis, MedicalRecord medicalRecord)
        {
            MedicalRecord medicalRecordToUpdate = medicalRecordRepository.GetObject(medicalRecord.IdRecord);

            if (!medicalRecordToUpdate.FamilyIllnessHistory.Any(entity => entity.Diagnosis.Any(diagnosis => diagnosis.Code == diagnosis.Code) &&
                                                                entity.RelativeMember == diagnosis.RelativeMember))
            {
                medicalRecordToUpdate.FamilyIllnessHistory.Add(diagnosis);
            }
            return(medicalRecordRepository.Update(medicalRecordToUpdate));
        }
        public void AddMedicalRecord_ShouldAdd()
        {
            Patient       patient  = new Patient("Foo", "Numb");
            MedicalRecord expected = new MedicalRecord(patient, DateTime.Parse("2019-01-01"), DateTime.Now, "Cancer");

            _controller.AddMedicalRecord(expected);

            var actual = (List <MedicalRecord>)_controller.GetPatientsMedicalRecords(patient);

            Assert.Contains(expected, actual);
        }
        public IActionResult SaveMedicalRecord(MedicalRecord medicalRecord)
        {
            MedicalRecord newMedicalRecord = _medicalRecordService.CreateMedicalRecord(medicalRecord);

            if (newMedicalRecord == null)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Exemple #18
0
        [HttpGet("activatePatientMedicalRecord/{username}")]       // GET /api/medicalRecord/activatePatientMedicalRecord/{username}
        public IActionResult ActivatePatientMedicalRecord(string username)
        {
            MedicalRecord medicalRecord = App.Instance().MedicalRecordService.FindPatientMedicalRecordByUsername(username);

            if (medicalRecord == null)
            {
                return(BadRequest());
            }
            App.Instance().MedicalRecordService.ActivatePatientMedicalRecord(medicalRecord.Id);
            return(Redirect("http://localhost:51182/index.html#/"));
        }
Exemple #19
0
        private Patient AddNewMedicalRecord(Patient patient)
        {
            //TODO: Treba srediti insurance policy tako da podatak bude upotrebljiv a ne uvek isti
            MedicalRecord        medicalRecord        = new MedicalRecord(new InsurancePolicy(30), patient);
            MedicalRecordService medicalRecordService = new MedicalRecordService();

            medicalRecord       = medicalRecordService.AddMedicalRecord(medicalRecord);
            patient.MedRecordId = medicalRecord.GetId();

            return(patient);
        }
Exemple #20
0
        public ActionResult fillRx(String patient)
        {
            MedicalRecord model = svc.getMedicalRecordsForPatient(patient);

            if (!String.IsNullOrEmpty(Request.Form["prescriptions"]))
            {
                //mark prescriptions as "filled"
            }
            svc.updateMedicalecordsForPatient(patient, model);
            return(RedirectToAction("Medical", "Records", new { patient = patient }));
        }
Exemple #21
0
        public ActionResult Medical(String patient)
        {
            if (patient == null || User.IsInRole("Patient"))
            {
                return(RedirectToAction("Index"));
            }
            ViewData["patient"] = patient;
            MedicalRecord model = svc.getMedicalRecordsForPatient(patient);

            return(View(model));
        }
Exemple #22
0
        public ActionResult UpdatePrev(String patient)
        {
            MedicalRecord model = svc.getMedicalRecordsForPatient(patient);

            if (!String.IsNullOrEmpty(Request.Form["previousMedicalHistory"]))
            {
                model.prevMedHistory = Request.Form["previousMedicalHistory"];
            }
            svc.updateMedicalecordsForPatient(patient, model);
            return(RedirectToAction("Medical", "Records", new { patient = patient }));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //View pitent + doctor
        //x.Id = 1;
        // d.Id = 1;

        MedicalRecord m = (MedicalRecord)Session["medical"];

        x = (Patient)Session["patient"];
        x = Q.Patients.Where(z => z.Id == x.Id).SingleOrDefault();
        // PersonalInfo  p1= Q.PersonalInfos.Where(w => w.Id == x.PersonalInfoId).SingleOrDefault();
        d = (Doctor)Session["doctor"];
        d = Q.Doctors.Where(z => z.Id == d.Id).SingleOrDefault();
        //   PersonalInfo  p2 = Q.PersonalInfos.Where(w => w.Id == d.PersonalInfoId).SingleOrDefault();

        if (!IsPostBack)
        {
            Label3.Text           = x.Id.ToString();
            Label3.ForeColor      = System.Drawing.Color.Red;
            Label3.Font.Underline = true;


            Label15.Text           = d.Id.ToString();
            Label15.ForeColor      = System.Drawing.Color.Red;
            Label15.Font.Underline = true;


            Label5.Text      = x.PersonalInfo.FirstName;
            Label5.ForeColor = System.Drawing.Color.Red;


            Label6.Text      = x.PersonalInfo.LastName;
            Label6.ForeColor = System.Drawing.Color.Red;


            Label8.Text      = d.PersonalInfo.FirstName;
            Label8.ForeColor = System.Drawing.Color.Red;


            Label9.Text      = d.PersonalInfo.LastName;
            Label9.ForeColor = System.Drawing.Color.Red;



            //  view disease

            DropDownList1.DataSource = Q.Sicknesses;
            // DropDownList1.Items.Add(s.Disease);
            //DropDownList1.DataBind();
            DropDownList1.DataTextField  = "Disease";
            DropDownList1.DataValueField = "Id";
            DropDownList1.DataBind();
        }
    }
Exemple #24
0
        public SpecialistAppointment ScheduleSpecialistAppointment(Doctor specialist, String cause, Treatment treatment, ExamOperationRoom room, DateTime startDate, DateTime endDate)
        {
            SpecialistAppointment specialistAppointment = new SpecialistAppointment(cause, specialist);

            treatment.SpecialistAppointment = specialistAppointment;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);
            Patient       patient       = medicalRecord.Patient;
            Appointment   appointment   = new Appointment(specialist, patient, room, TypeOfAppointment.EXAM, startDate, endDate);

            AppointmentRepository.Instance.Save(appointment);
            return(treatment.SpecialistAppointment);
        }
Exemple #25
0
        public void ScheduleCheckup(Checkup checkup)
        {
            if (doctorService.IsDoctorFree(checkup.DoctorId, checkup.StartTime, checkup.EndTime))
            {
                MedicalRecord medicalRecord = medicalRecordService.GetMedicalRecordById(checkup.MedicalRecordId);

                medicalRecord.Checkups.Add(checkup.Id);
                medicalRecordService.UpdateMedicalRecord(medicalRecord);

                checkupRepository.Save(checkup);
            }
        }
Exemple #26
0
        public ScheduledSurgery ScheduleSurgery(Treatment treatment, DateTime startDate, DateTime endDate, string cause, Surgeon surgeon, ExamOperationRoom room)
        {
            ScheduledSurgery scheduledSurgery = new ScheduledSurgery(startDate, endDate, cause, surgeon);

            treatment.ScheduledSurgery = scheduledSurgery;
            MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id);
            Patient       patient       = medicalRecord.Patient;
            Appointment   surgery       = new Appointment(surgeon, patient, room, TypeOfAppointment.SURGERY, startDate, endDate);

            AppointmentRepository.Instance.Save(surgery);
            return(treatment.ScheduledSurgery);
        }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        MedicalRecord             mr = new MedicalRecord();
        EMRDataClassesDataContext dd = new EMRDataClassesDataContext();
        // Label1.Text = (String)Session["mySessionVar"];
        var gg = from a in dd.MedicalRecords
                 where a.Id == 2
                 select a;

        Session["nnn"] = gg.Single();
        Response.Redirect("Session_test.aspx");
    }
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     if (TxtBox_ShortDescription.Text.Equals(""))
     {
         MessageBox.Show("Adja meg a kezelés rövid leírását!", "Hiányzó adat", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
     else
     {
         MedicalRecord = new MedicalRecord(TxtBox_ShortDescription.Text);
         DialogResult  = true;
     }
 }
        public MedicalRecord Add(MedicalRecord medicalRecord)
        {
            if (Get(medicalRecord.Id) == null)
            {
                List <MedicalRecord> medicalRecords = GetAll();
                medicalRecords.Add(medicalRecord);
                WriteAll(medicalRecords);

                return(medicalRecord);
            }
            return(null);
        }
        public void RemoveMedicalRecord_ShouldRemove()
        {
            Patient       patient        = new Patient("Foo", "To record");
            MedicalRecord recordToRemove = new MedicalRecord
                                               (patient, DateTime.Parse("2019-10-10"), DateTime.Parse("2019-12-12"), "Cancer");

            _controller.AddMedicalRecord(recordToRemove);
            Assert.Equal(recordToRemove, _controller.GetMedicalRecord(recordToRemove.Id));

            _controller.RemoveMedicalRecord(recordToRemove);
            Assert.Null(_controller.GetMedicalRecord(recordToRemove.Id));
        }
    protected void PopulateNameandBrgy()
    {
        mr = new MedicalRecord();

        patientData = mr.GetNameForMedHistory(Convert.ToString(Session["patientId"]));

        if (patientData.Rows.Count > 0)
        {
            foreach (DataRow dr in patientData.Rows)
            {

                lbl_PatientName.Text = dr["PatientLName"].ToString().Trim() + ", " + dr["PatientFName"].ToString().Trim() + " " + dr["PatientMName"].ToString().Trim();
                lbl_PatientBarangay.Text = dr["PatientBarangay"].ToString().Trim();
            }
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        mr = new MedicalRecord();

        patientData = mr.GetValuesConsultation(patientId.ToString());
        Session["PatientData"] = patientData;

        if (patientData.Rows.Count > 0)
        {
            foreach (DataRow dr in patientData.Rows)
            {
                
                txtlname.Text = dr["PatientLName"].ToString().Trim();
                txtfname.Text = dr["PatientFName"].ToString().Trim();
                txtmname.Text = dr["PatientMName"].ToString().Trim();
                txtPhilhealthNum.Text = dr["PatientFaxNumber"].ToString().Trim();

                txtDatepick.Text = dr["PatientBirthdate"].ToString().Trim();
                
                txtAddress.Text = dr["PatientAddress"].ToString().Trim();
                ddlBarangay.Text = dr["PatientBarangay"].ToString().Trim();
                txtAddress.ReadOnly = true;
                txtlname.ReadOnly = true;
                txtfname.ReadOnly = true;
                txtmname.ReadOnly = true;
                txtPhilhealthNum.ReadOnly = true;
                
                ddlBarangay.Enabled = false;


                DateTime bdate = DateTime.Parse(dr["PatientBirthdate"].ToString().Trim());
                calcAge a = new calcAge();
                txtAge.Text = a.GetAge(bdate);
                txtAge.ReadOnly = true;
                
            }
        }
    }
    protected void LoadDataFromEncounter()
    {
        mr = new MedicalRecord();
        dis = new Disease();
        List<string> patientDisease = new List<string>();

        ptData = mr.GetEncounterData(encId);
        foreach (DataRow dr in ptData.Rows)
        {
            txtTemp.Text = dr["Temp"].ToString().Trim();
            txtTemp.ReadOnly = true;
            txtAge.Text = dr["Age"].ToString().Trim();
            txtAge.ReadOnly = true;
            string bp = dr["Bloodpressure"].ToString().Trim();
            string[] bpressure = bp.Split('/');
            txtBpressure.Text = bpressure[0];
            txtBpressure.ReadOnly = true;
            txtBpressure0.Text = bpressure[1];
            txtBpressure0.ReadOnly = true;           
            txtDiagnosis.Text = dr["Diagnosis"].ToString().Trim();
            txtDiagnosis.ReadOnly = true;
            txtPulseRate.Text = dr["PulseRate"].ToString().Trim();
            string Height = dr["Height"].ToString().Trim();
            string[] heightDetails = Height.Split('-');
            txtHt_feet.Text = heightDetails[0];
            txtHt_feet.ReadOnly = true;
            txtHt_inch.Text = heightDetails[1];
            txtHt_inch.ReadOnly = true;
            txtWt.Text = dr["Weight"].ToString().Trim();
            txtWt.ReadOnly = true;
            txtRecomendation.Text = dr["Treatment"].ToString().Trim();
            txtRecomendation.ReadOnly = true;
        }
        patientDisease =  dis.GetPatientsDisease(patientId.ToString(), encId);
        checkbox_DiseaseList.DataBind();
        foreach (string pd in patientDisease)
        {
            foreach (ListItem li in checkbox_DiseaseList.Items)
            {
                if (pd.ToString() == li.Text)
                    li.Selected = true;
            }
        }
        btnSave.Enabled = false;
        btnSearch.Enabled = false;
    }
    protected void GridSearchName_SelectedIndexChanged(object sender, EventArgs e)
    {
        patientId = Int32.Parse(GridSearchName.Rows[GridSearchName.SelectedIndex].Cells[1].Text);
        Session["ptId"] = patientId;
        mr = new MedicalRecord();

        patientData = mr.GetValuesConsultation(patientId.ToString());
        Session["PatientData"] = patientData;

        if (patientData.Rows.Count > 0)
        {
            foreach (DataRow dr in patientData.Rows)
            {
                txtlname.Text = dr["PatientLName"].ToString().Trim();
                txtfname.Text = dr["PatientFName"].ToString().Trim();
                txtmname.Text = dr["PatientMName"].ToString().Trim();
                txtPhilhealthNum.Text = dr["PatientFaxNumber"].ToString().Trim();
                
                txtDatepick.Text = dr["PatientBirthdate"].ToString().Trim();
                txtAddress.Text = dr["PatientAddress"].ToString().Trim();
                ddlBarangay.Text = dr["PatientBarangay"].ToString().Trim();
                txtAddress.ReadOnly = true;
                txtlname.ReadOnly = true;
                txtfname.ReadOnly = true;
                txtmname.ReadOnly = true;
                txtPhilhealthNum.ReadOnly = true;



                DateTime bdate = DateTime.Parse(dr["PatientBirthdate"].ToString().Trim());
                calcAge a = new calcAge();
                txtAge.Text = a.GetAge(bdate);
            //    txtAge.Text = (Int32.Parse(DateTime.Now.ToString("yyyy")) - Int32.Parse(ddlYear.Text)).ToString();
                txtAge.ReadOnly = true;
            }
        }

    }
        public ActionResult Patient_Update([DataSourceRequest]DataSourceRequest request, EditPatientMedicalRecordsViewModel editRequest)
        {
            if (this.ModelState.IsValid)
            {

                if (editRequest.File.ContentLength > 0)
                {
                    var file = editRequest.File;
                    var fileExtension = Path.GetExtension(file.FileName);

                    var medicalRecord = new MedicalRecord()
                    {
                        DentistId = this.User.Identity.GetUserId(),
                        Extension = fileExtension,
                        PatientId = editRequest.Id,
                        OriginalName = file.FileName,
                    };

                    this.medicalRecords.AddNewMedicalRecord(medicalRecord);

                    var folder = medicalRecord.Id % 10;
                    var virtualFileName = medicalRecord.FileName.ToString();

                    var path = Path.Combine(this.Server.MapPath(MedicalRecordsPath + folder), virtualFileName + fileExtension);
                    file.SaveAs(path);
                }
            }

            return this.Json(new[] { editRequest }.ToDataSourceResult(request, this.ModelState));
        }
Exemple #36
0
        public void GivenAModelWithUserAuditingEnabled_Save_ShouldApplyTheCurrentUserToUpdatedByProperty()
        {
            MedicalRecord.DropBehaviors();

            NoRMaticConfig.SetCurrentUserProvider(() => "user1");
            MedicalRecord.EnableUserAuditing();

            var medicalRecord = new MedicalRecord {
                PatientIdentifier = "12345",
                FirstName = "Tom",
                LastName = "Burris",
                Temperature = 98,
                Weight = 173
            };

            medicalRecord.Save();

            Assert.AreEqual(medicalRecord.UpdatedBy, "user1");
        }
    protected void ButtonProceed_Click(object sender, EventArgs e)
    {
        string Patient_id = patientId.ToString();

        mr = new MedicalRecord();

        patientData = mr.GetValuesConsultation(Patient_id);
        Session["PatientData"] = patientData;

        if (patientData.Rows.Count > 0)
        {
            foreach (DataRow dr in patientData.Rows)
            {
                //txtlname.Text = dr["PatientLName"].ToString().Trim();
                txtlname.Text = dr["PatientLName"].ToString().Trim();
                txtfname.Text = dr["PatientFName"].ToString().Trim();
                txtmname.Text = dr["PatientMName"].ToString().Trim();
                txtPhilhealthNum.Text = dr["PatientFaxNumber"].ToString().Trim();


                txtDatepick.Text = dr["PatientBirthdate"].ToString().Trim();
                txtAddress.Text = dr["PatientAddress"].ToString().Trim();
                ddlBarangay.Text = dr["PatientBarangay"].ToString().Trim();
                txtAddress.ReadOnly = true;
                txtlname.ReadOnly = true;
                txtfname.ReadOnly = true;
                txtmname.ReadOnly = true;
                txtPhilhealthNum.ReadOnly = true;




                DateTime bdate = DateTime.Parse(dr["PatientBirthdate"].ToString().Trim());
                calcAge a = new calcAge();
                txtAge.Text = a.GetAge(bdate);
              //  txtAge.Text = (Int32.Parse(DateTime.Now.ToString("yyyy")) - Int32.Parse(ddlYear.Text)).ToString();
                txtAge.ReadOnly = true;
            }
        }
       
    }
 public void AddNewMedicalRecord(MedicalRecord record)
 {
     this.medicalRecords.Add(record);
     this.medicalRecords.Save();
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DateTime timeSave;
        if (txtlname.Text != "")
        {
            try
            {
                //To save data on db
                ddlBarangay.Enabled = true;

                if (txtHt_feet.Text == "" && txtHt_inch.Text == "")
                {
                    txtHt_feet.Text = "0";
                    txtHt_inch.Text = "0";
                }
                else if (txtHt_feet.Text == "")
                {
                    txtHt_feet.Text = "0";
                }
                else if (txtHt_inch.Text == "")
                {
                    txtHt_inch.Text = "0";
                }
                
                height = txtHt_feet.Text + "-" + txtHt_inch.Text + "";
                /**
                 * Added by Lakhi Save 1/5/2011
                 * This Saves patient daily Medical record
                 */
                mr = new MedicalRecord();
                dis = new Disease();
                if (txtDiagnosis.Text.Length > 0 || Request.QueryString["id"] != null)
                {
                    timeSave = DateTime.Now;
                    
                    if (Request.QueryString["id"] != null)
                    {
                        mr.SavePatientDailyMedicalRecord
                            (
                                Convert.ToInt32(Request.QueryString["id"]),
                                txtAge.Text,
                                txtPulseRate.Text,
                                Convert.ToDecimal(txtTemp.Text),
                                Convert.ToDecimal(txtWt.Text),
                                (height),
                                (txtBpressure.Text + "/" + txtBpressure0.Text),

                                txtDiagnosis.Text,
                                txtRecomendation.Text,
                                (string)Page.User.Identity.Name
                            );
                        foreach (ListItem li in checkbox_DiseaseList.Items)
                        {
                            if (li.Selected)
                            {
                                dis.SavePatientDisease(Request.QueryString["id"].ToString(), li.Text, timeSave);
                            }
                        }
                        txtAge.Text = string.Empty;
                        txtHt_feet.Text = string.Empty;
                        txtHt_inch.Text = string.Empty;
                        Response.Write("<script> window.alert('Saved Consultation Successfully.')</script>");
                    }
                    else
                    {
                        mr.SavePatientDailyMedicalRecord
                            (
                                Convert.ToInt32(Session["ptId"]),
                                txtAge.Text,
                                txtPulseRate.Text,
                                Convert.ToDecimal(txtTemp.Text),
                                Convert.ToDecimal(txtWt.Text),
                                (height),
                                (txtBpressure.Text + "/" + txtBpressure0.Text),

                                txtDiagnosis.Text,
                                txtRecomendation.Text,
                                (string)Page.User.Identity.Name
                            );
                        foreach (ListItem li in checkbox_DiseaseList.Items)
                        {
                            if (li.Selected)
                            {
                                dis.SavePatientDisease(Convert.ToString(Session["ptId"]), li.Text, timeSave);
                            }
                        }
                        txtAge.Text = string.Empty;
                        txtHt_feet.Text = string.Empty;
                        txtHt_inch.Text = string.Empty;
                        Response.Write("<script> window.alert('Saved Consultation Successfully.')</script>");
                    }
                }
                else
                {
                    Response.Write("<script> window.alert('Please fillup required fields.')</script>");
                }
            }

            catch (Exception ex)
            {
                err = ex.ToString();
                showErrorSave(err);
            }
            finally
            {
                if (err == null)
                {
                    //reset upon save
                    txtDatepick.Text = string.Empty;
                    txtAge.Text = string.Empty;
                    txtTemp.Text = string.Empty;
                    txtWt.Text = string.Empty;
                    txtHt_feet.Text = string.Empty;
                    txtHt_inch.Text = string.Empty;
                    txtBpressure.Text = string.Empty;
                    txtBpressure0.Text = string.Empty;
                    txtDiagnosis.Text = string.Empty;
                    txtRecomendation.Text = string.Empty;
                    txtPulseRate.Text = string.Empty;
                    checkbox_DiseaseList.ClearSelection();
                    //clear patient loaded info upon save
                    txtlname.Text = string.Empty;
                    txtfname.Text = string.Empty;
                    txtmname.Text = string.Empty;
                    txtAddress.Text = string.Empty;
                    txtPhilhealthNum.Text = string.Empty;
                    ddlBarangay.SelectedIndex = 1;
                   
                    txtAddress.Text = string.Empty;

                    ddlBarangay.Enabled = false;
                }
            }
        }
        else
            Response.Write("<script> window.alert('Please select Patient first before saving.')</script>");
    }