Пример #1
0
        public string CreateBookingPDF(MT_PatientInfomation ObjPatientInformation, string Path)
        {
            using (FileStream fs = new FileStream(Path, FileMode.Create, FileAccess.Write, FileShare.None))

                using (Document doc = new Document(PageSize.LETTER, 0f, 0f, 0f, 0f))

                    using (PdfWriter writer = PdfWriter.GetInstance(doc, fs))
                    {
                        doc.SetMargins(ObjConstant.PageLeftMargin, ObjConstant.PageRightMargin, ObjConstant.PageTopMargin, ObjConstant.PageBottomMargin);
                        doc.Open();

                        //Document : Header
                        DocumentHeader(doc, PDFHeader, ObjConstant.fontDocHeader, ObjConstant.fontDocSubHeader);

                        Demographics(doc, ObjPatientInformation, ObjConstant.fontH1, ObjConstant.fonttext);

                        doc.Close();
                        doc.Dispose();
                        GC.SuppressFinalize(doc);
                    }
            return("");
        }
Пример #2
0
        public void Demographics(Document doc, MT_PatientInfomation ObjPatientInfor, Font hd, Font txt)
        {
            try
            {
                PdfPTable tableout = new PdfPTable(1);
                //tableout.HorizontalAlignment = align.;
                tableout.SpacingAfter = 5f;
                PdfPCell cell = new PdfPCell(new Phrase("Demographics", FontFactory.GetFont("Arial", 11, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
                cell.Colspan             = 4;
                cell.HorizontalAlignment = Element.ALIGN_LEFT;
                cell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                cell.BorderColor         = BaseColor.LIGHT_GRAY;
                cell.Border = Rectangle.BOTTOM_BORDER | Rectangle.TOP_BORDER;
                tableout.AddCell(cell);
                doc.Add(tableout);

                PdfPTable tablein = new PdfPTable(4);
                //tablein.HorizontalAlignment = Left;
                tablein.SpacingAfter = 10f;
                int[] intTblWidth = { 20, 30, 20, 30 };
                tablein.SetWidths(intTblWidth);
                //First Row

                //First Columns
                AppendCell(tablein, "Name:", hd, 0, true, false, false, true);
                //Second Columns
                AppendCell(tablein, ObjPatientInfor.Patient_First_Name + ' ' + ObjPatientInfor.Patient_Middle_Name + ' ' + ObjPatientInfor.Patient_Last_Name, txt, 0, true, false, false, false);
                //Third Columns
                AppendCell(tablein, "Patient ID:", hd, 0, true, false, false, false);
                //Fourth Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Code, txt, 0, true, true, false, false);


                //Second Row
                //First Columns
                AppendCell(tablein, "Birth Date:", hd, 0, false, false, false, true);
                //Second Columns
                AppendCell(tablein, ObjPatientInfor.Patient_DOB.ToString(), txt, 0, false, false, false, false);
                //Third Columns
                AppendCell(tablein, "Gender:", hd, 0, false, false, false, false);
                //Fourth Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Sex, txt, 0, false, true, false, false);

                //Third Row
                //First Columns
                AppendCell(tablein, "Marital Status:", hd, 0, false, false, false, true);
                //Second Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Marital_Status, txt, 0, false, false, false, false);
                //Third Columns
                AppendCell(tablein, "Religious:", hd, 0, false, false, false, false);
                //Fourth Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Religion, txt, 0, false, true, false, false);


                //Fourth Row
                //First Columns
                AppendCell(tablein, "Race:", hd, 0, false, false, false, true);
                //Second Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Race, txt, 0, false, false, false, false);
                //Third Columns
                AppendCell(tablein, "Ethnic:", hd, 0, false, false, false, false);
                //Fourth Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Ethinicity, txt, 0, false, true, false, false);


                //Fifth Row
                //First Columns
                AppendCell(tablein, "Contact Information:", hd, 0, false, false, false, true);
                //Second Columns
                AppendCell(tablein, "Tel (Primary Home )" + ObjPatientInfor.Patient_Primary_No + "\n"
                           + "Tel (Emergency Contact )" + ObjPatientInfor.Patient_Emergency_No + "\n"
                           + "Tel (Mobile Contact)" + ObjPatientInfor.Patient_Secondary_No + "\n"
                           + "Tel (Office Contact)" + ObjPatientInfor.Patient_Work_No + "\n"
                           + "Tel (Spouse Contact)" + ObjPatientInfor.Patient_Spouse_No + "\n"
                           + "Email " + ObjPatientInfor.Patient_Email
                           , txt, 0, false, false, false, false);
                //Third Columns
                AppendCell(tablein, "Primary Home:", hd, 0, false, false, false, false);
                //Fourth Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Address1 + "\n"
                           + ObjPatientInfor.Patient_Address2
                           + ObjPatientInfor.Patient_City + "," + ObjPatientInfor.Patient_State + " " + ObjPatientInfor.Patient_Zipcode
                           //+ " " + ObjPatientInfor.c
                           , txt, 0, false, true, false, false);



                //Sixth Row
                //First Columns
                AppendCell(tablein, "Language:", hd, 0, false, false, true, true);
                //Second Columns
                AppendCell(tablein, ObjPatientInfor.Patient_Language, txt, 0, false, false, true, false);
                //Third Columns
                AppendCell(tablein, "", hd, 0, false, false, true, false);
                //Fourth Columns
                AppendCell(tablein, "", txt, 0, false, true, true, false);

                doc.Add(tablein);
                Console.WriteLine("tablein Width : " + tablein.TotalHeight.ToString());
            }
            catch (Exception ex)
            {
            }
        }
Пример #3
0
        public async Task <HttpResponseMessage> BookingSchedule(string Slug)
        {
            Db = con.SurgeryCenterDb(Slug);
            BookingResponse Response = new BookingResponse();

            try
            {
                MT_Patient_Booking   Booking = new MT_Patient_Booking();
                MT_PatientInfomation Patient = new MT_PatientInfomation();
                Query         ObjQuery       = Db.Collection("MT_Patient_Booking").WhereEqualTo("PB_Is_Deleted", false).WhereEqualTo("PB_Is_Active", true);
                QuerySnapshot ObjQuerySnap   = await ObjQuery.GetSnapshotAsync();

                if (ObjQuerySnap != null && ObjQuerySnap.Documents.Count > 0)
                {
                    foreach (DocumentSnapshot docsnap in ObjQuerySnap.Documents)
                    {
                        Booking = docsnap.ConvertTo <MT_Patient_Booking>();
                        if (Booking.PB_Notifications != null)
                        {
                            if (Booking.PB_Patient_ID != null && Booking.PB_Patient_ID != "")
                            {
                                Query         PatientQuery        = Db.Collection("MT_PatientInfomation").WhereEqualTo("Patient_Is_Active", true).WhereEqualTo("Patient_Is_Deleted", false).WhereEqualTo("Patient_Unique_ID", Booking.PB_Patient_ID);
                                QuerySnapshot ObjPatientQuerySnap = await PatientQuery.GetSnapshotAsync();

                                if (ObjPatientQuerySnap != null)
                                {
                                    List <string> Namelist  = new List <string>();
                                    List <string> Emaillist = new List <string>();
                                    Patient = ObjPatientQuerySnap.Documents[0].ConvertTo <MT_PatientInfomation>();
                                    Email   = Patient.Patient_Email;
                                    Phone   = Patient.Patient_Primary_No;
                                    Name    = Patient.Patient_First_Name + " " + Patient.Patient_Middle_Name + " " + Patient.Patient_Last_Name;
                                    Namelist.Add(Name);
                                    Emaillist.Add(Email);
                                    BookingDate = Booking.PB_Booking_Date;
                                    foreach (MT_Notifications noti in Booking.PB_Notifications)
                                    {
                                        if (noti.NFT_Actions != null)
                                        {
                                            foreach (Notification_Action action in noti.NFT_Actions)
                                            {
                                                if (action.NFA_Status == "Pending")
                                                {
                                                    if (action.NFA_DayOrWeek == 0)
                                                    {
                                                        if (action.NFA_Be_Af == 0)
                                                        {
                                                            Days = (-1) * action.NFA_Days;
                                                        }
                                                        else if (action.NFA_Be_Af == 1)
                                                        {
                                                            Days = action.NFA_Days;
                                                        }
                                                    }
                                                    else if (action.NFA_DayOrWeek == 1)
                                                    {
                                                        if (action.NFA_Be_Af == 0)
                                                        {
                                                            Days = (-7) * action.NFA_Days;
                                                        }
                                                        else if (action.NFA_Be_Af == 1)
                                                        {
                                                            Days = 7 * action.NFA_Days;
                                                        }
                                                    }
                                                    NoticationSendingDay = BookingDate.AddDays(Days);
                                                    if (DateTime.Now.Date.ToString("MM/dd/yyyy") == NoticationSendingDay.Date.ToString("MM/dd/yyyy"))
                                                    {
                                                        TimeSpan NotificationTiming = TimeSpan.Parse(action.NFA_Timing);
                                                        TimeSpan timeOfDay          = DateTime.Now.TimeOfDay;
                                                        if (TimeSpan.Compare(timeOfDay, NotificationTiming) >= 0)
                                                        {
                                                            switch (action.NFA_Action_Type)
                                                            {
                                                            case "SMS":
                                                                Sms sms = new Sms();
                                                                sms.Receiver_Contact_No = Phone;
                                                                sms.Message_Body        = action.NFA_Message;
                                                                sms.Message_Date        = con.ConvertTimeZone(action.NFA_TimeZone, Convert.ToDateTime(DateTime.Now));
                                                                sms.Message_Title       = action.NFA_Action_Title;
                                                                SMSObj.SendSMS(sms);
                                                                Response = await UpdateAction(Booking.PB_Unique_ID, action.NFA_Unique_ID, Slug);

                                                                break;

                                                            case "Email":
                                                                Email email = new Email();
                                                                email.To_Name          = Namelist;
                                                                email.To_Email         = Emaillist;
                                                                email.PlainTextContent = "";
                                                                email.HtmlContent      = action.NFA_Message;
                                                                await EmailObj.Send(email);

                                                                Response = await UpdateAction(Booking.PB_Unique_ID, action.NFA_Unique_ID, Slug);

                                                                break;

                                                            case "Whatsapp":
                                                                Whatsapp whatsapp = new Whatsapp();
                                                                whatsapp.Receiver_Contact_No = Phone;
                                                                whatsapp.Message_Title       = action.NFA_Action_Title;
                                                                whatsapp.Message_Date        = con.ConvertTimeZone(action.NFA_TimeZone, Convert.ToDateTime(DateTime.Now));
                                                                whatsapp.Message_Body        = action.NFA_Message;
                                                                WhatsappObj.SendMessageWithWhatsapp(whatsapp);
                                                                Response = await UpdateAction(Booking.PB_Unique_ID, action.NFA_Unique_ID, Slug);

                                                                break;

                                                            case "Voice":
                                                                Voice voice = new Voice();
                                                                voice.Voice_Call_Date           = con.ConvertTimeZone(action.NFA_TimeZone, Convert.ToDateTime(DateTime.Now));
                                                                voice.Voice_Receiver_Name       = Patient.Patient_First_Name;
                                                                voice.Voice_Call_Body           = action.NFA_Message;
                                                                voice.Voice_Receiver_Contact_No = Phone;
                                                                VoiceObj.SetVoiceCall(voice);
                                                                Response = await UpdateAction(Booking.PB_Unique_ID, action.NFA_Unique_ID, Slug);

                                                                break;

                                                            default:
                                                                break;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Response.Status  = con.StatusSuccess;
                    Response.Message = con.MessageSuccess;
                }
                else
                {
                    Response.Status  = con.StatusDNE;
                    Response.Message = con.MessageDNE;
                }
            }
            catch (Exception ex)
            {
                Response.Status  = con.StatusFailed;
                Response.Message = con.MessageFailed + ", Exception : " + ex.Message;
            }
            return(ConvertToJSON(Response));
        }