public void InsertData(string currUser, PatientMedicationModel oClass) { strSql = strSql + "INSERT INTO " + TABLE_NAME + " (" + COLUMN_ENCOUNTER_NO + ", " + COLUMN_CASE_NO + ", " + COLUMN_PATIENT_NO + ", " + COLUMN_DATE + ", " + COLUMN_CODE + ", " + COLUMN_DESCRIPTION + ", " + COLUMN_DOSAGE + ", " + COLUMN_NOTES + ", " + "created_by, created_date, updated_by, updated_date) "; strSql = strSql + "values ('" + oClass.EncounterNo + "', '" + oClass.CaseNo + "', '" + oClass.PatientNo + "', '" + oClass.StartDate.ToString("yyyy-MM-d HH:MM:ss") + "', '" + oClass.Code + "', '" + oClass.Description.Replace("'", "") + "', '" + oClass.Dosage.Replace("'", "") + "', '" + oClass.Notes.Replace("'", "") + "', '" + currUser + "', " + "CurDate(), '" + currUser + "', " + "CurDate() " + ") "; SaveData(strSql); }
//protected void DeleteProcedure_ServerClick(object sender, EventArgs e) //{ // string UserName = Session["User"].ToString(); // int ID = Convert.ToInt32(HiddenFieldPatientProcedure.Value); // PatientProcedureDAL oProcedureDAL = new PatientProcedureDAL(); // PatientProcedureModel oProcedureClass = new PatientProcedureModel(); // oProcedureClass.IsDeleted = true; // oProcedureClass.ReasonDelete = deleteCPTReason.InnerText; // string lbl = lblPatientProcedure.Text; // oProcedureClass.ID = ID; // oProcedureDAL.DeleteData(UserName, oProcedureClass); // PopulateOrders(EncounterNo.Value); //} protected void AddMedication_ServerClick(object sender, EventArgs e) { string sUserName = Session["User"].ToString(); PatientMedicationDAL oMedicationDAL = new PatientMedicationDAL(); PatientMedicationModel oMedicationClass = new PatientMedicationModel(); oMedicationClass.EncounterNo = EncounterNo.Value; oMedicationClass.PatientNo = PatientNo.Value; oMedicationClass.CaseNo = ""; oMedicationClass.Code = medsList.SelectedValue; //txtMedCode.Value; oMedicationClass.Description = medsList.SelectedItem.Text; //txtMedDescription.Value; oMedicationClass.Dosage = Prescription.Value; //txtMedDose.Value; oMedicationClass.PatientNo = PatientNo.Value; oMedicationClass.StartDate = DateTime.Now; oMedicationClass.Notes = ""; oMedicationDAL.InsertData(sUserName, oMedicationClass); if (cbFavorite.Checked == true) { var medFavoriteModel = new PhysicianPrescriptionTemplateModel(); var medFavoriteDal = new PhysicianPrescriptionTemplateDAL(); medFavoriteModel.PhysicianID = Convert.ToInt16(PhysicianID.Value); medFavoriteModel.Dosage = Prescription.Value; medFavoriteDal.InsertData(sUserName, medFavoriteModel); LoadPrescriptionFavorite(Convert.ToInt16(PhysicianID.Value)); } PopulateMeds(EncounterNo.Value); ClearEntry(); }
public DataSet SeachData(PatientMedicationModel oClass) { string fname = ""; string lname = ""; string patientNo = oClass.PatientNo; string caseNo = oClass.CaseNo; strSql = "SELECT A.*, Concat(B.FirstName, ' ', B.LastName) as PatientName " + "FROM " + TABLE_NAME + " A INNER JOIN " + TABLE_PATIENT + " B on A.PatientNo = B.PatientNo Where 1=1 and A.IsDeleted = 0 "; if (fname != "") { strSql = strSql + "AND B." + COLUMN_FIRSTNAME + " like '%" + fname + "%' "; } if (lname != "") { strSql = strSql + "AND B." + COLUMN_LASTNAME + " like '%" + lname + "%' "; } if (patientNo != "") { strSql = strSql + "AND A." + COLUMN_PATIENT_NO + " = '" + patientNo + "' "; } if (caseNo != "") { strSql = strSql + "AND A." + COLUMN_CASE_NO + " like '%" + caseNo + "%' "; } return(Select(strSql)); }
public DataSet SelectByEncounterNo(PatientMedicationModel oClass) { strSql = "SELECT * " + "FROM " + TABLE_NAME + " " + "WHERE " + COLUMN_ENCOUNTER_NO + " = '" + oClass.EncounterNo + "' "; return(Select(strSql)); }
public DataSet SelectByID(PatientMedicationModel oClass) { strSql = "SELECT * " + "FROM " + TABLE_NAME + " " + "WHERE " + COLUMN_ID + " = '" + oClass.ID + "' "; return(Select(strSql)); }
public ActionResult PatientMedicationAddOrEdit([FromBody] PatientMedicationModel model) { APIJsonResult result = new APIJsonResult(); result.Access = true; result.success = true; if (model == null) { result.success = false; result.Msg.Add("Model is NULL"); return(Ok(result)); } var currentUserToken = User.Claims.SingleOrDefault(x => x.Type == "UserRole") != null?User.Claims.SingleOrDefault(x => x.Type == "UserRole").Value : null; if (currentUserToken == null) { result.Msg.Add("Session Time Out"); result.success = false; return(Ok(result)); } if (model.Id == 0) { Medication m = new Medication() { AfternoonCount = model.Afternoon, Doctors = model.DoctorName, MorningCount = model.Morning, PharmacyName = model.PharmacyName, MedicationId = model.Medication, Sideeffect = model.Sideeffect, UserId = Convert.ToInt32(User.Claims.SingleOrDefault(x => x.Type == "UserId") != null ? User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null) }; m.Days = string.Join(",", model.SelectedIds); _medication.Add(m); _context.SaveChanges(); } else { var patientMedication = _medication.Where(x => x.Id == model.Id).FirstOrDefault(); if (patientMedication == null) { result.Msg.Add("Not found"); result.success = false; return(Ok(result)); } patientMedication.MorningCount = model.Morning; patientMedication.MedicationId = model.Medication; patientMedication.PharmacyName = model.PharmacyName; patientMedication.Sideeffect = model.Sideeffect; patientMedication.UserId = Convert.ToInt32(User.Claims.SingleOrDefault(x => x.Type == "UserId") != null ? User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null); patientMedication.Days = string.Join(",", model.SelectedIds); _medication.Update(patientMedication); _context.SaveChanges(); } return(Ok(result)); }
private void PopulateMeds(string encounterNo) { PatientMedicationDAL medsDAL = new PatientMedicationDAL(); PatientMedicationModel medsModel = new PatientMedicationModel(); oDs = new DataSet(); medsModel.EncounterNo = encounterNo; oDs = medsDAL.SelectByEncounterNo(medsModel); gvPrescription.DataSource = oDs.Tables[0]; gvPrescription.DataBind(); }
public void DeleteData(string user, PatientMedicationModel oClass) { strSql = "UPDATE " + TABLE_NAME + " SET " + " isDeleted = 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); }
protected void DeleteMedication_ServerClick(object sender, EventArgs e) { string UserName = Session["User"].ToString(); int ID = Convert.ToInt32(HiddenFieldPatientMedication.Value); PatientMedicationDAL oMedicationDAL = new PatientMedicationDAL(); PatientMedicationModel oMedicationClass = new PatientMedicationModel(); oMedicationClass.IsDeleted = true; oMedicationClass.ReasonDelete = deleteMedicationReason.InnerText; string lbl = lblPatientMedication.Text; oMedicationClass.ID = ID; oMedicationDAL.DeleteData(UserName, oMedicationClass); PopulateMeds(EncounterNo.Value); }
private void PopulateMedication(string caseNo) { PatientMedicationDAL medsDAL = new PatientMedicationDAL(); PatientMedicationModel medsModel = new PatientMedicationModel(); oDs = new DataSet(); medsModel.CaseNo = caseNo; medsModel.PatientNo = PatientNo.Value; oDs = medsDAL.SeachData(medsModel); if (oDs != null) { gvMedications.DataSource = oDs.Tables[0]; gvMedications.DataBind(); } }
public void UpdateData(string user, PatientMedicationModel oClass) { strSql = "UPDATE " + TABLE_NAME + " SET " + COLUMN_ENCOUNTER_NO + " = '" + oClass.EncounterNo + "', " + COLUMN_CASE_NO + " = '" + oClass.CaseNo + "', " + COLUMN_PATIENT_NO + " = '" + oClass.PatientNo + "', " + COLUMN_DATE + " = '" + oClass.StartDate.ToString("yyyy-MM-d HH:MM:ss") + "', " + COLUMN_CODE + " = '" + oClass.Code + "', " + COLUMN_DESCRIPTION + " = '" + oClass.Description.Replace("'", "") + "', " + COLUMN_DOSAGE + " = '" + oClass.Dosage.Replace("'", "") + "', " + COLUMN_NOTES + " = '" + oClass.Notes.Replace("'", "''") + "', " + " updated_by = '" + user + "', " + " updated_date = '" + DateTime.Now.ToString("yyyy-MM-d HH:MM:ss") + "' " + " WHERE " + COLUMN_ID + " = '" + oClass.ID + "' "; SaveData(strSql); }
protected void AddMedication_ServerClick(object sender, EventArgs e) { string sUserName = Session["User"].ToString(); PatientMedicationDAL oMedicationDAL = new PatientMedicationDAL(); PatientMedicationModel oMedicationClass = new PatientMedicationModel(); oMedicationClass.CaseNo = RefNo.Value; oMedicationClass.Code = txtMedCode.Value; oMedicationClass.Description = txtMedDescription.Value; oMedicationClass.Dosage = txtMedDose.Value; oMedicationClass.PatientNo = PatientNo.Value; oMedicationClass.StartDate = DateTime.Now; oMedicationClass.Notes = ""; oMedicationDAL.InsertData(sUserName, oMedicationClass); PopulateMedication(RefNo.Value); }
private void PopulateMeds(string encounterNo) { lblMeds.Text = ""; PatientMedicationDAL medsDAL = new PatientMedicationDAL(); PatientMedicationModel medsModel = new PatientMedicationModel(); var oDs = new DataSet(); medsModel.EncounterNo = encounterNo; oDs = medsDAL.SelectByEncounterNo(medsModel); if (oDs != null) { if (oDs.Tables[0].Rows.Count > 0) { for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++) { lblMeds.Text = lblMeds.Text + "<br>" + oDs.Tables[0].Rows[i]["description"].ToString() + " - " + oDs.Tables[0].Rows[i]["dosage"].ToString() + "<br>"; } } } }
public IActionResult PatientMedicationGet(int Id) { APIJsonResult result = new APIJsonResult(); result.Access = true; result.success = true; var currentUserToken = User.Claims.SingleOrDefault(x => x.Type == "UserRole") != null?User.Claims.SingleOrDefault(x => x.Type == "UserRole").Value : null; if (currentUserToken == null) { result.Msg.Add("Session Time Out"); result.success = false; return(Ok(result)); } if (Id == 0) { result.Msg.Add("Not found"); result.success = false; return(Ok(result)); } var medication = _medication.Where(x => x.Id == Id).FirstOrDefault(); PatientMedicationModel model = new PatientMedicationModel() { Id = medication.Id, Afternoon = medication.AfternoonCount, DoctorName = medication.Doctors, Morning = medication.MorningCount, SelectedIds = medication.Days.Split(',').Select(Int32.Parse).ToList(), PharmacyName = medication.PharmacyName, Sideeffect = medication.Sideeffect, Medication = (medication.MedicationId) }; result.data = model; return(Ok(result)); }