Beispiel #1
0
        /**
         *  Required input: Patient.CaseID, Patient.Account.AccountID
         *  This method is used on patient desk to show notes added across specialties for a patient
         **/
        public List <gbmodel.patient.SpecialtyNote> SelectSpecialtyNote(gbmodel.patient.Patient p_oPatient)
        {
            DataSet       ds         = null;
            SqlConnection connection = new SqlConnection(DBUtil.ConnectionString);
            //ArrayList list = new ArrayList();
            List <gbmodel.patient.SpecialtyNote> oList = new List <gbmodel.patient.SpecialtyNote>();

            gbmodel.patient.SpecialtyNote sNote = new gbmodel.patient.SpecialtyNote();
            try
            {
                connection.Open();
                SqlCommand selectCommand = new SqlCommand("sp_select_pdesk_specialty_note", connection);
                selectCommand.Parameters.AddWithValue("@i_case_id", p_oPatient.CaseID);
                selectCommand.Parameters.AddWithValue("@sz_company_id", p_oPatient.Account.ID);
                selectCommand.CommandType    = CommandType.StoredProcedure;
                selectCommand.CommandTimeout = 0;
                ds = new DataSet();
                new SqlDataAdapter(selectCommand).Fill(ds);
                if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        sNote            = new gbmodel.patient.SpecialtyNote();
                        sNote.Speciality = new gbmodel.speciality.Speciality();
                        sNote.Patient    = new gbmodel.patient.Patient();
                        sNote.Account    = new gbmodel.account.Account();
                        sNote.CreatedBy  = new gbmodel.user.User();
                        sNote.UpdatedBy  = new gbmodel.user.User();

                        sNote.Text           = dr["Text"].ToString();
                        sNote.Speciality.ID  = dr["SpecialtyID"].ToString();
                        sNote.Patient.CaseID = Convert.ToInt32(dr["CaseID"]);
                        sNote.CreatedBy.ID   = dr["CreatedBy"].ToString();
                        sNote.Account.ID     = dr["CompanyID"].ToString();
                        sNote.UpdatedBy.ID   = dr["UpdatedBy"].ToString();
                        sNote.Created        = Convert.ToDateTime(dr["Created"]);
                        //sNote.Updated = Convert.ToDateTime(dr["Updated"]);
                        oList.Add(sNote);
                    }
                }
            }
            finally
            {
                if (connection != null)
                {
                    if (connection.State == ConnectionState.Open)
                    {
                        connection.Close();
                    }
                    connection = null;
                }
            }

            /*
             *  call procedure sp_select_pdesk_specialty_note and pass @i_case_id and @sz_company_id
             *  from the returned result set all fields of SpecialtyNote and return the list
             *  write code between try and finally block. dont catch error. we will do it after we implement logging
             */
            return(oList);
        }
Beispiel #2
0
        public ArrayList Search(gbmodel.user.User p_oUser, SearchParameters p_oSearchParameter)
        {
            List <SqlParameter> oParams = new List <SqlParameter>();
            ArrayList           oResult = null;

            oParams.Add(new SqlParameter("@sz_company_id", p_oUser.Account.ID));
            oParams.Add(new SqlParameter("@i_start_index", p_oSearchParameter.StartIndex));
            oParams.Add(new SqlParameter("@i_end_index", p_oSearchParameter.EndIndex));
            oParams.Add(new SqlParameter("@sz_order_by", p_oSearchParameter.OrderBy));
            oParams.Add(new SqlParameter("@sz_search_text", p_oSearchParameter.SearchText));

            DataSet ds = null;

            try
            {
                ds = DBUtil.DataSet(Procedures.PR_SEARCH_PATIENT, oParams);
            }
            catch (Exception io)
            {
            }

            oResult = new ArrayList(2);
            List <gbmodel.patient.Patient> oPatientList = new List <gbmodel.patient.Patient>();

            gbmodel.patient.Patient oPatient = null;
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                oPatient             = new gbmodel.patient.Patient();
                oPatient.RowID       = Convert.ToInt32(ds.Tables[0].Rows[i]["rowid"].ToString());
                oPatient.CaseID      = Convert.ToInt32(ds.Tables[0].Rows[i]["sz_case_id"].ToString());
                oPatient.CaseNo      = Convert.ToInt32(ds.Tables[0].Rows[i]["sz_case_no"].ToString());
                oPatient.ClaimNumber = ds.Tables[0].Rows[i]["sz_claim_number"].ToString();
                oPatient.Name        = ds.Tables[0].Rows[i]["sz_patient_name"].ToString();

                gbmodel.carrier.Carrier oCarrier = new gbmodel.carrier.Carrier();
                oCarrier.Name = ds.Tables[0].Rows[i]["sz_insurance_company"].ToString();

                oPatient.Carrier = oCarrier;
                oPatient.ID      = ds.Tables[0].Rows[i]["sz_patient_id"].ToString();
                oPatient.DOA     = ds.Tables[0].Rows[i]["dt_accident_date"].ToString();

                gbmodel.account.Account oAccount = new gbmodel.account.Account();
                oAccount.ID = ds.Tables[0].Rows[i]["sz_company_id"].ToString();

                oPatient.Account   = oAccount;
                oPatient.FirstName = ds.Tables[0].Rows[i]["sz_patient_first_name"].ToString();
                oPatient.LastName  = ds.Tables[0].Rows[i]["sz_patient_last_name"].ToString();

                oPatientList.Add(oPatient);
            }

            oResult.Add(oPatientList.ToArray());

            for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
            {
                oResult.Add(ds.Tables[1].Rows[i]["count"].ToString());
            }
            return(oResult);
        }
Beispiel #3
0
        public string PrintVisitNote(gbmodel.patient.Patient p_oPatient, gbmodel.user.User p_oUser)
        {
            specialtyNote.SrvPatient             oSrvPatient = new specialtyNote.SrvPatient();
            List <gbmodel.patient.SpecialtyNote> oList       = new List <gbmodel.patient.SpecialtyNote>();

            oList = oSrvPatient.SelectSpecialtyNote(p_oPatient);
            string  OpenPdfFilepath = "";
            DataSet ds = new DataSet();

            ds = GetVisitInfo(p_oPatient.CaseID, p_oPatient.Account.ID);
            string szfirstname = "";

            if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "")
                {
                    szfirstname = ds.Tables[0].Rows[0]["PatientName"].ToString();
                    szfirstname = szfirstname.Replace(" ", string.Empty);
                    szfirstname = szfirstname.Replace(".", string.Empty);
                    szfirstname = szfirstname.Replace(",", string.Empty);
                }
            }
            if (ds != null && ds.Tables[1] != null)
            {
                string path         = getApplicationSetting("PatientInfoSaveFilePath");
                string OpenFilepath = getApplicationSetting("PatientInfoOpenFilePath");
                path = path + "PatientDeskNotes/";
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string                   newPdfFilename = szfirstname.Trim() + "_Visit_Information_" + DateTime.Now.ToString("MM_dd_yyyyhhmm") + ".pdf";
                string                   pdfPath        = path + newPdfFilename;
                MemoryStream             m        = new MemoryStream();
                iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 36, 36, 20, 20);
                float[]                  wBase    = { 4f };
                PdfPTable                tblBase  = new PdfPTable(wBase);
                tblBase.DefaultCell.Border = Rectangle.NO_BORDER;
                tblBase.WidthPercentage    = 100;
                PdfWriter writer = PdfWriter.GetInstance(document, m);
                document.Open();
                #region "for printed by"
                float[]   width      = { 4f, 4f };
                PdfPTable tblprintby = new PdfPTable(width);
                tblprintby.TotalWidth         = document.PageSize.Width - document.LeftMargin - document.RightMargin;
                tblprintby.DefaultCell.Border = Rectangle.NO_BORDER;
                tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT;
                tblprintby.DefaultCell.VerticalAlignment   = iTextSharp.text.Element.ALIGN_TOP;
                tblprintby.AddCell(new Phrase("Printed By : " + p_oUser.UserName, iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK)));
                tblprintby.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT;
                tblprintby.AddCell(new Phrase("Printed on : " + DateTime.Now.ToString("MM/dd/yyyy"), iTextSharp.text.FontFactory.GetFont("Arial", 8, iTextSharp.text.Color.BLACK)));
                tblBase.AddCell(tblprintby);
                #endregion
                tblBase.AddCell(" ");

                #region "for patient information"
                float[]   wdh        = { 4f };
                PdfPTable tblheading = new PdfPTable(wdh);
                tblheading.TotalWidth         = document.PageSize.Width - document.LeftMargin - document.RightMargin;
                tblheading.DefaultCell.Border = Rectangle.NO_BORDER;
                tblheading.DefaultCell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
                tblheading.DefaultCell.VerticalAlignment   = iTextSharp.text.Element.ALIGN_MIDDLE;
                tblBase.AddCell(tblheading);
                #endregion

                #region for Personal Information
                float[]   w11   = { 3f, 3f, 3f, 3f };
                PdfPTable table = new PdfPTable(w11);
                table.WidthPercentage         = 100;
                table.DefaultCell.BorderColor = Color.BLACK;
                PdfPCell cell1 = new PdfPCell(new Phrase("Personal Information", iTextSharp.text.FontFactory.GetFont("Arial", 11, iTextSharp.text.Color.BLACK)));
                cell1.Colspan         = 4;
                cell1.BackgroundColor = Color.LIGHT_GRAY;
                cell1.BorderColor     = Color.BLACK;
                table.AddCell(cell1);
                table.AddCell(new Phrase("Patient Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK)));
                if (ds.Tables[0].Rows[0]["PatientName"].ToString() != "")
                {
                    table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["PatientName"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                }
                else
                {
                    table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                }
                table.AddCell(new Phrase("Case #", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK)));
                if (ds.Tables[0].Rows[0]["CaseNo"].ToString() != "")
                {
                    table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["CaseNo"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                }
                else
                {
                    table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                }
                table.AddCell(new Phrase("Insurance Name", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK)));
                if (ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"].ToString() != "")
                {
                    table.AddCell(new Phrase(Convert.ToString(ds.Tables[0].Rows[0]["SZ_INSURANCE_NAME"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                }
                else
                {
                    table.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                }

                PdfPCell cell2 = new PdfPCell(new Phrase(""));
                cell2.Colspan     = 2;
                cell2.BorderColor = Color.BLACK;
                table.AddCell(cell2);
                tblBase.AddCell(table);
                #endregion
                document.Add(tblBase);
                DataTable dt         = ds.Tables[1];
                string[]  columns    = { "SpecialtyID" };
                DataTable dataTable  = GetDistinctRecords(dt, columns);
                DataSet   dsFiltered = new DataSet();
                dsFiltered.Tables.Add(dataTable);

                #region for Visit Information
                float[]   wd1      = { 3f, 1.5f, 1.5f, 1.5f, 1.5f, 6f, 1.5f, 3f };
                PdfPTable tblVisit = new PdfPTable(wd1);
                tblVisit.WidthPercentage         = 100;
                tblVisit.DefaultCell.BorderColor = Color.BLACK;
                tblVisit = GetTableHeader(wd1);

                float[]   wdBlank  = { 4f };
                PdfPTable tblBlank = new PdfPTable(wdBlank);
                tblBlank.WidthPercentage    = 100;
                tblBlank.DefaultCell.Border = Rectangle.NO_BORDER;
                tblBlank.AddCell("");
                tblBlank.DefaultCell.Border = Rectangle.NO_BORDER;

                float[]   wdNotes  = { .5f, 3.5f };
                PdfPTable tblNotes = new PdfPTable(wdNotes);
                tblNotes.WidthPercentage = 100;
                string text = "";

                for (int i = 0; i < dsFiltered.Tables[0].Rows.Count; i++)
                {
                    DataRow[] result = ds.Tables[1].Select("SpecialtyID = '" + dsFiltered.Tables[0].Rows[i]["SpecialtyID"].ToString() + "'");
                    for (int j = 0; j < result.Length; j++)
                    {
                        float fPosition = writer.GetVerticalPosition(true);
                        if (result[j]["DctorName"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["DctorName"].ToString()), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        if (result[j]["DT_EVENT_DATE"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["DT_EVENT_DATE"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }

                        if (result[j]["Specialty"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["Specialty"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }

                        if (result[j]["STATUS"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["STATUS"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        if (result[j]["VisitType"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["VisitType"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        if (result[j]["ProcedureCode"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["ProcedureCode"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }

                        if (result[j]["BillStatus"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["BillStatus"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        if (result[j]["Provider"].ToString() != "")
                        {
                            tblVisit.AddCell(new Phrase(Convert.ToString(result[j]["Provider"]), iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                        else
                        {
                            tblVisit.AddCell(new Phrase("-", iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                        }
                    }

                    for (int k = 0; k < oList.Count; k++)
                    {
                        if (dsFiltered.Tables[0].Rows[i]["SpecialtyID"].ToString() == oList[k].Speciality.ID.ToString())
                        {
                            text = oList[k].Text.ToString();
                            tblNotes.FlushContent();
                            tblNotes.AddCell(new Phrase("NOTE:", iTextSharp.text.FontFactory.GetFont("Arial", 8, Font.BOLD, iTextSharp.text.Color.BLACK)));
                            tblNotes.AddCell(new Phrase(text, iTextSharp.text.FontFactory.GetFont("Arial", 7, iTextSharp.text.Color.BLACK)));
                            document.Add(tblBlank);

                            if (text != "")
                            {
                                document.Add(tblNotes);
                            }
                            break;
                        }
                    }

                    document.Add(tblVisit);
                    document.Add(tblBlank);
                    document.Add(tblBlank);
                    tblVisit.DeleteBodyRows();
                    tblVisit = GetTableHeader(wd1);
                }

                #endregion
                document.Close();
                System.IO.File.WriteAllBytes(pdfPath, m.GetBuffer());
                OpenPdfFilepath = OpenFilepath + "PatientDeskNotes/" + newPdfFilename;
            }

            return(OpenPdfFilepath);
        }