Ejemplo n.º 1
0
        /// <summary>
        /// Prints the next appointment.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="diagnoses">The diagnoses.</param>
        /// <param name="todo">The todo.</param>
        /// <param name="date">The date.</param>
        /// <param name="time">The time.</param>
        /// <param name="numberOfSheets">The number of sheets.</param>
        public void PrintNextAppointment(PatientData patient, string diagnoses, string todo, string date, string time, int numberOfSheets)
        {
            if (patient == null) {
                return;
            }

            float leftMargin = 100;
            float topMargin = 100;

            Font headlineFont = new Font("Arial", 18.0f, FontStyle.Bold);
            Font dateFont = new Font("Arial", 12f, FontStyle.Bold);
            Font pointFont = new Font("Arial", 15f, FontStyle.Bold);
            Font printFont = new Font("Arial", 11, FontStyle.Regular);
            Font barCodeFont = null;
            if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) {
                barCodeFont = new Font("Free 3 of 9 Extended", 35, FontStyle.Regular, GraphicsUnit.Point);
            }

            //HeadlineFont: 27,59766
            //dateFont: 18,39844
            //printFont: 16,86523

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Next Appointment";

            PrintablePage pp = new PrintablePage();
            OperationData od = patComp.GetLastOperationByPatientID(patient.Id);

            putLetterhead(pp);

            float yPos = (float)topMargin + (float)(4 * 16.86523);

            pp.AddPrintableObject(new PrintableTextObject("NEXT OUTPATIENT APPOINTMENT", headlineFont, Brushes.Red, leftMargin + 100, yPos));
            yPos += 16.86523F;
            yPos += 16.86523F;
            yPos += 16.86523F;
            if (barCodeFont != null) {
                pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, yPos));
            }
            pp.AddPrintableObject(new PrintableTextObject("Printed: " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), printFont, Brushes.Black, leftMargin, yPos));
            yPos += 16.86523F;
            yPos += 16.86523F;
            pp.AddPrintableObject(new PrintableTextObject("Patient ID: " + patient.Id.ToString(), pointFont, Brushes.Black, leftMargin, yPos));
            yPos += 25F;
            pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, pointFont, Brushes.Black, leftMargin, yPos));
            yPos += 25F;
            pp.AddPrintableObject(new PrintableTextObject("Date: " + date, pointFont, Brushes.Black, leftMargin, yPos));
            yPos += 25F;
            pp.AddPrintableObject(new PrintableTextObject("Time: " + time, pointFont, Brushes.Black, leftMargin, yPos));
            yPos += 25F;
            pp.AddPrintableObject(new PrintableTextObject("Place: " + SPD.GUI.Properties.Settings.Default.Location, pointFont, Brushes.Black, leftMargin, yPos));
            yPos += 25F;
            yPos += 16.86523F;
            pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, leftMargin, yPos));
            yPos += 16.86523F;
            yPos += 16.86523F;
            yPos += 16.86523F;
            pp.AddPrintableObject(new PrintableTextObject("Diagnoses:", dateFont, Brushes.Black, leftMargin, yPos));
            yPos += 16.86523F;

            List<string> diagnosesList = new List<string>();
            diagnosesList.Add(diagnoses);
            diagnosesList = SplitStringsForPrinting(80, diagnosesList);
            foreach (string diagnosesLine in diagnosesList) {
                pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                if (yPos > 1050) {
                    yPos = topMargin;
                    pd.AddPrintPage(pp);
                    pp = new PrintablePage();
                }
            }

            yPos += 16.86523F;
            pp.AddPrintableObject(new PrintableTextObject("TODO:", dateFont, Brushes.Black, leftMargin, yPos));
            yPos += 16.86523F;
            List<string> todoList = new List<string>();
            todoList.Add(todo);
            todoList = SplitStringsForPrinting(80, todoList);
            foreach (string todoLine in todoList) {
                pp.AddPrintableObject(new PrintableTextObject(todoLine, printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                if (yPos > 1050) {
                    yPos = topMargin;
                    pd.AddPrintPage(pp);
                    pp = new PrintablePage();
                }
            }

            pd.AddPrintPage(pp);

            pd.duplicate(numberOfSheets);

            pd.DoPrint();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prints the next action faxlist.
        /// </summary>
        /// <param name="patients">List of Patients</param>
        /// <param name="year">The year.</param>
        /// <param name="halfYear">The half year.</param>
        /// <param name="actionKind">Kind of the action.</param>
        public void PrintNextActionFaxlist(IList<PatientData> patients, long year, long halfYear, ActionKind actionKind)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Next Action Fax List";
            pd.Landscape = true;

            Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold);
            Font tableHeadFont = new Font("Arial", 10, FontStyle.Bold);
            Font printFont = new Font("Arial", 10, FontStyle.Regular);

            float leftMargin = 30;
            float topMargin = 30;
            int page = 1;

            int xId = (int)leftMargin;
            int xName = 70;
            int xAge = 350;
            int xSex = 400;
            int xPhone = 450;
            int xDiagnoses = 600;
            //    private int A4smallSite = 826;
            //private int A4LargeSite = 1169;

            PrintablePage pp = new PrintablePage();
            int yTable = (int)topMargin + 22;

            //Headline
            DrawNextActionFaxListHeadline(patients, pp, actionKind, halfYear, year, page, headlineFont, leftMargin, topMargin, tableHeadFont, xId, xName, xAge, xSex, xPhone, xDiagnoses);

            int patientCount = 0;
            foreach (PatientData patient in patients) {
                //pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, yTable, (int)leftMargin + 1109, yTable));
                pp.AddPrintableObject(new PrintableTextObject(patient.Id.ToString(), printFont, Brushes.Black, xId, yTable + 1 + 16 + (patientCount * 16)));
                pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xName, yTable + 1 + 16 + (patientCount * 16), 1000, 16));

                pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, xName, yTable + 1 + 16 + (patientCount * 16)));
                pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xAge, yTable + 1 + 16 + (patientCount * 16), 1000, 16));

                pp.AddPrintableObject(new PrintableTextObject(StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, xAge, yTable + 1 + 16 + (patientCount * 16)));
                pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xSex, yTable + 1 + 16 + (patientCount * 16), 1000, 16));

                pp.AddPrintableObject(new PrintableTextObject(patient.Sex.ToString() , printFont, Brushes.Black, xSex, yTable + 1 + 16 + (patientCount * 16)));
                pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xPhone, yTable + 1 + 16 + (patientCount * 16), 1000, 16));

                pp.AddPrintableObject(new PrintableTextObject(patient.Phone , printFont, Brushes.Black, xPhone, yTable + 1 + 16 + (patientCount * 16)));
                pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, xDiagnoses, yTable + 1 + 16 + (patientCount * 16), 1000, 16));

                string diagnoses = string.Empty;
                OperationData op = patComp.GetLastOperationByPatientID(patient.Id);
                if (op != null && !string.IsNullOrEmpty(op.Diagnoses)) {
                    diagnoses = "OP: " + op.Diagnoses;
                } else {
                    VisitData visit = patComp.GetLastVisitByPatientID(patient.Id);
                    if (visit != null && !string.IsNullOrEmpty(visit.ExtraDiagnosis)) {
                        diagnoses = "Visit: " + visit.ExtraDiagnosis;
                    }
                }
                pp.AddPrintableObject(new PrintableTextObject(diagnoses, printFont, Brushes.Black, xDiagnoses, yTable + 1 + 16 + (patientCount * 16)));
                pp.AddPrintableObject(new PrintableRectangleObject(Brushes.White, (int)leftMargin + 1109, yTable + 1 + 16 + (patientCount * 16), 1000, 16));

                patientCount++;

                if (patientCount > 45) {
                    drawNextActionFaxListTable(pp, leftMargin, yTable, xId, xName, xAge, xSex, xPhone, xDiagnoses);
                    page++;
                    pd.AddPrintPage(pp);
                    pp = new PrintablePage();
                    patientCount = 0;
                    DrawNextActionFaxListHeadline(patients, pp, actionKind, halfYear, year, page, headlineFont, leftMargin, topMargin, tableHeadFont, xId, xName, xAge, xSex, xPhone, xDiagnoses);
                }
            }
            drawNextActionFaxListTable(pp, leftMargin, yTable, xId, xName, xAge, xSex, xPhone, xDiagnoses);
            pd.AddPrintPage(pp);
            pd.DoPrint();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Prints the next action list.
        /// </summary>
        /// <param name="patients">The patients.</param>
        /// <param name="year">The year.</param>
        /// <param name="halfyear">The halfyear.</param>
        /// <param name="actionKind">Kind of the action.</param>
        public void PrintNextActionList(IList<PatientData> patients, long year, long halfyear, ActionKind actionKind)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Next Action List";
            pd.Landscape = false;

            Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold);
            Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold);
            Font printFont = new Font("Arial", 11, FontStyle.Regular);
            Font boldPrintFont = new Font("Arial", 11, FontStyle.Bold);
            Font barCodeFont = null;
            if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) {
                barCodeFont = new Font("Free 3 of 9 Extended", 30, FontStyle.Regular, GraphicsUnit.Point);
            }

            float leftMargin = 65;
            float topMargin = 30;
            int page = 1;
            int line = 2;

            PrintablePage pp = new PrintablePage();

            pp.AddPrintableObject(new PrintableTextObject("SPD  -  NextAction - " + actionKind.ToString(), headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56)));
            pp.AddPrintableObject(new PrintableTextObject(year + " - " + halfyear + "        " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56)));
            pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56)));
            pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20));

            foreach (PatientData patient in patients) {
                pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                pp.AddPrintableObject(new PrintableTextObject("Sex: " + patient.Sex, printFont, Brushes.Black, leftMargin + 100, topMargin + (float)(line * 17.56)));
                pp.AddPrintableObject(new PrintableTextObject("Phone: " + patient.Phone, printFont, Brushes.Black, leftMargin + 200, topMargin + (float)(line * 17.56)));
                pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - " + CommonUtilities.StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth) + " years", printFont, Brushes.Black, leftMargin + 450, topMargin + (float)(line * 17.56)));
                line++;
                if (barCodeFont != null) {
                    pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, topMargin + (float)(line * 17.56)));
                }
                pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                line++;
                List<string> extradiagnoses = new List<string>();
                OperationData operation = this.patComp.GetLastOperationByPatientID(patient.Id);
                VisitData visit = this.patComp.GetLastVisitByPatientID(patient.Id);
                if (operation != null && !String.IsNullOrEmpty(operation.Diagnoses)) {
                    extradiagnoses.Add(operation.Diagnoses);
                    extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses);
                    pp.AddPrintableObject(new PrintableTextObject("OP Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                    line++;
                    foreach (string diagnosesLine in extradiagnoses) {
                        pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                    }
                }
                if (visit != null && !String.IsNullOrEmpty(visit.ExtraDiagnosis)) {
                    extradiagnoses.Add(visit.ExtraDiagnosis);
                    extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses);
                    pp.AddPrintableObject(new PrintableTextObject("Visit Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                    line++;
                    foreach (string diagnosesLine in extradiagnoses) {
                        pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                    }
                }
                //Therapy
                if (visit != null && !String.IsNullOrEmpty(visit.ExtraTherapy)) {
                    List<string> therapy = new List<string>();
                    therapy.Add(visit.ExtraTherapy);
                    therapy = this.SplitStringsForPrinting(80, therapy);
                    pp.AddPrintableObject(new PrintableTextObject("Visit Therapy:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                    line++;
                    foreach (string therapyLine in therapy) {
                        pp.AddPrintableObject(new PrintableTextObject(therapyLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                    }
                }
                //TODO
                List<string> todo = new List<string>();
                foreach(NextActionData nextAction in patComp.GetNextActionsByPatientID(patient.Id)) {
                    if (nextAction.ActionYear == year &&
                        nextAction.ActionhalfYear == halfyear &&
                        nextAction.ActionKind == actionKind &&
                        !String.IsNullOrEmpty(nextAction.Todo)) {
                        todo.Add(nextAction.Todo);
                    }
                }
                if (todo.Count > 0) {
                    pp.AddPrintableObject(new PrintableTextObject("ToDo:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                    line++;
                    todo = this.SplitStringsForPrinting(80, todo);
                    foreach (string todoLine in todo) {
                        pp.AddPrintableObject(new PrintableTextObject(todoLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                    }
                }
                pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)((line + 2) * 17.56), (int)leftMargin + 680, (int)((line + 2) * 17.56)));
                line++;

                if (line > 50) {
                    page++;
                    pd.AddPrintPage(pp);
                    pp = new PrintablePage();
                    line = 2;
                    pp.AddPrintableObject(new PrintableTextObject("NextAction - " + actionKind.ToString() + " " + year + "\\" + halfyear + "     " + patients.Count + " Patients", headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56)));
                    pp.AddPrintableObject(new PrintableTextObject("SPD", headlineFont, Brushes.Black, leftMargin + 400, topMargin + (float)(0 * 17.56)));
                    pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, headlineFont, Brushes.Black, leftMargin + 500, topMargin + (float)(0 * 17.56)));
                    pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20));
                }
            }
            pd.AddPrintPage(pp);
            pd.DoPrint();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Prints the labels.
        /// </summary>
        /// <param name="topBordermm">The top bordermm.</param>
        /// <param name="leftBordermm">The left bordermm.</param>
        /// <param name="columns">The columns.</param>
        /// <param name="rows">The rows.</param>
        /// <param name="startline">The startline.</param>
        /// <param name="labelFontSize">Size of the label font.</param>
        /// <param name="patients">The patients.</param>
        public void PrintLabels(int topBordermm, int leftBordermm, int columns, int rows, int startline, int labelFontSize, IList<PatientData> patients)
        {
            // 827 Pixel Breit = 210mm => 1mm = 3,9380952380952380952380952380952 Pixel
            // 1169 Pixel Hoch = 297mm => 1mm = 3,9360269360269360269360269360269 Pixel

            if (patients == null || patients.Count == 0) {
                return;
            }
            const float pixelMMFactor = 3.937F;
            const float height = 1169;
            const float width = 827;

            float leftBorderpixel = leftBordermm * pixelMMFactor;
            float topBorderpixel = topBordermm * pixelMMFactor;
            float usedplacewidth = width - (2 * leftBorderpixel);
            float usedplaceheight = height - (2 * topBorderpixel);
            float boxheight = usedplaceheight / rows;
            float boxwidth = usedplacewidth / columns;

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Labels";
            pd.Landscape = false;

            PrintablePage pp = new PrintablePage();

            Font font = new Font("Arial", labelFontSize);

            int line = startline - 1;
            foreach (PatientData patient in patients) {

                if (line >= rows) {
                    pd.AddPrintPage(pp);
                    pp = new PrintablePage();
                    line = 0;
                }

                for (int i = 0; i < columns; i++) {
                    font.GetHeight();
                    float x = leftBorderpixel + 7 + (i * boxwidth);
                    float y1 = topBorderpixel + (line * boxheight) + ((boxheight - (2 * font.GetHeight())) / 3);
                    float y2 = y1 + font.GetHeight();
                    float y3 = y2 + font.GetHeight();
                    pp.AddPrintableObject(new PrintableFillRectangleObject(Brushes.White, (int)(leftBorderpixel + (i * boxwidth)), (int)(topBorderpixel + (line * boxheight)), (int)boxwidth - 1, (int)boxheight));
                    //pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id + "   Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), font, Brushes.Black, x, y1));
                    //pp.AddPrintableObject(new PrintableTextObject(patient.FirstName, font, Brushes.Black, x, y2));
                    //pp.AddPrintableObject(new PrintableTextObject(patient.SurName, font, Brushes.Black, x, y3));

                    pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, font, Brushes.Black, x, y1));
                    pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id + "   Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), font, Brushes.Black, x, y2));

                }

                line++;
            }

            pd.AddPrintPage(pp);

            pd.DoPrint();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Prints Id Cards   86 mm * 54 mm
        /// </summary>
        /// <param name="patients">List of Patients</param>
        public void PrintIdCard(IList<PatientData> patients)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            if (patients.Count > 1) {
                throw new NotImplementedException("More Id-Cards not supported until now!");
            }

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD ID Card";
            pd.Landscape = true;
            Font idFont = new Font("Arial", 22, FontStyle.Bold);
            Font nameFont = new Font("Arial", 14, FontStyle.Bold);

            PrintablePage pp = new PrintablePage();

            PatientData patient = patients[0];

            pp.AddPrintableObject(new PrintableTextObject("ID " + patient.Id, idFont, Brushes.Black, 15, 163));

            pp.AddPrintableObject(new PrintableTextObject(patient.FirstName, nameFont, Brushes.Black, 140, 161));
            pp.AddPrintableObject(new PrintableTextObject(patient.SurName, nameFont, Brushes.Black, 140, 181));

            pd.AddPrintPage(pp);

            PrintDialog oPrintDialog = new PrintDialog();
            string printername = null;
            foreach (string printernameloop in PrinterSettings.InstalledPrinters) {
                if (printernameloop.ToLower().Contains("zebra") ||
                    printernameloop.ToLower().Contains("p110"))
                {
                    printername = printernameloop;
                    break;
                }
            }

            if (printername != null) {
                pd.PrinterName = printername;
            }

            pd.DoPrint(null, printername == null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Prints the final report.
        /// </summary>
        /// <param name="patients">The patients.</param>
        public void PrintFinalReport(IList<PatientData> patients)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            float leftMargin = 100;
            float topMargin = 100;

            Font headlineFont = new Font("Arial", 18.0f, FontStyle.Underline | FontStyle.Bold);
            Font dateFont = new Font("Arial", 12f, FontStyle.Bold);
            Font finalReportFont = new Font("Arial", 14.0f, FontStyle.Underline | FontStyle.Bold);
            Font printFont = new Font("Arial", 11, FontStyle.Regular);
            Font barCodeFont = null;
            if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) {
                barCodeFont = new Font("Free 3 of 9 Extended", 35, FontStyle.Regular, GraphicsUnit.Point);
            }

            //HeadlineFont: 27,59766
            //dateFont: 18,39844
            //finalReportFont: 21,46484
            //printFont: 16,86523

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Final Report";

            foreach (PatientData patient in patients) {
                PrintablePage pp = new PrintablePage();
                OperationData od = patComp.GetLastOperationByPatientID(patient.Id);

                //pp.AddPrintableObject(new PrintableTextObject("Paediatric Urology Team Austria", headlineFont, new SolidBrush(Color.FromArgb(0, 61, 120)), leftMargin, (float)(topMargin + (0 * 16.86523))));
                pp.AddPrintableObject(new PrintableTextObject(od.Date.Month.ToString() + " " + od.Date.Year.ToString(), dateFont, Brushes.Red, leftMargin, (float)(topMargin + 40)));
                pp.AddPrintableObject(new PrintableFillRectangleObject(Brushes.Yellow, (int)(leftMargin - 5 + 3), 320, 600, (int)(16.86523 + 1)));

                //Bitmap img = SPD.GUI.Properties.Resources.KinderurologieLogo;
                //img.SetResolution(408, 408);
                //pp.AddPrintableObject(new PrintableImageObject(img, 550, (int)topMargin));

                //img = SPD.GUI.Properties.Resources.HFO;
                //img.SetResolution(550, 550);
                //pp.AddPrintableObject(new PrintableImageObject(img, 550, (int)topMargin + 40));

                putLetterhead(pp);

                float yPos = (float)topMargin + (float)(4 * 16.86523);
                if (barCodeFont != null) {
                    pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, yPos));
                }
                pp.AddPrintableObject(new PrintableTextObject("Patient ID: " + patient.Id.ToString(), printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                pp.AddPrintableObject(new PrintableTextObject("First name: " + patient.FirstName, printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                pp.AddPrintableObject(new PrintableTextObject("Surname: " + patient.SurName, printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth), printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                yPos += 16.86523F;
                yPos += 16.86523F;
                pp.AddPrintableObject(new PrintableTextObject("OP Date: " + od.Date.ToShortDateString(), printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                List<string> strs = new List<string>();
                strs.Add(od.Diagnoses.Replace('\n', ' ').Replace('\r', ' '));
                strs = SplitStringsForPrinting(75, strs);
                pp.AddPrintableObject(new PrintableTextObject("OP Diagnosis: " + strs[0], printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                if (strs.Count > 1) {
                    pp.AddPrintableObject(new PrintableTextObject("   " + strs[1], printFont, Brushes.Black, leftMargin, yPos));
                }
                yPos += 16.86523F;
                pp.AddPrintableObject(new PrintableTextObject("Performed OP: " + od.Performed.Replace('\n', ' ').Replace('\r', ' '), printFont, Brushes.Black, leftMargin, yPos));
                yPos += 16.86523F;
                pp.AddPrintableObject(new PrintableTextObject("OP Team: " + od.Team.Replace('\n', ' ').Replace('\r', ' '), printFont, Brushes.Black, leftMargin, yPos));

                pp.AddPrintableObject(new PrintableTextObject("Final Report:", finalReportFont, Brushes.Red, leftMargin, 380));

                List<string> finalReportList = new List<string>();
                finalReportList.Add(patComp.GetFinalReportByPatientId(patient.Id));
                finalReportList = SplitStringsForPrinting(80, finalReportList);
                yPos = 410;
                foreach (string finalReportLine in finalReportList) {
                    pp.AddPrintableObject(new PrintableTextObject(finalReportLine, printFont, Brushes.Black, leftMargin, yPos));
                    yPos += 16.86523F;
                    if (yPos > 1050) {
                        yPos = topMargin;
                        pd.AddPrintPage(pp);
                        pp = new PrintablePage();
                    }
                }

                pd.AddPrintPage(pp);
            }

            pd.DoPrint();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Prints the patients.
        /// </summary>
        /// <param name="patients">The patients.</param>
        /// <param name="patientPrintDetails">The patient print details.</param>
        public void PrintPatients(IList<PatientData> patients, PatientPrintDetails patientPrintDetails)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            float leftMargin = 100;
            float topMargin = 100;

            Font headlineFont = new Font("Arial", 18.0f, FontStyle.Underline | FontStyle.Bold);
            Font dateFont = new Font("Arial", 12f, FontStyle.Bold);
            Font finalReportFont = new Font("Arial", 14.0f, FontStyle.Underline | FontStyle.Bold);
            Font printFont = new Font("Arial", 12, FontStyle.Regular);
            Font boldFont = new Font("Arial", 12, FontStyle.Bold);
            Font barCodeFont = null;
            if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) {
                barCodeFont = new Font("Free 3 of 9 Extended", 35, FontStyle.Regular, GraphicsUnit.Point);
            }

            //HeadlineFont: 27,59766
            //dateFont: 18,39844
            //finalReportFont: 21,46484
            //printFont: 16,86523

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Patient Data";

            foreach (PatientData patient in patients) {
                PrintablePage pp = new PrintablePage();
                OperationData od = patComp.GetLastOperationByPatientID(patient.Id);

                if (barCodeFont != null) {
                    pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, 110));
                }

                List<string> printList = new List<string>();
                printList.Add("Patient ID: " + patient.Id.ToString());
                printList.Add("First name: " + patient.FirstName);
                printList.Add("Surname: " + patient.SurName);
                printList.Add("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - Age: " + StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth));
                printList.Add("Sex: " + patient.Sex.ToString());
                if (!string.IsNullOrEmpty(patient.Address))
                    printList.Add("Address: " + patient.Address);
                printList.Add("Weight: " + patient.Weight);
                printList.Add("Phone: " + patient.Phone.ToString());

                if ((patientPrintDetails & PatientPrintDetails.Fotolinks) == PatientPrintDetails.Fotolinks) {
                    if (this.patComp.GetImagesByPatientID(patient.Id).Count > 0) {
                        printList.Add("");
                        printList.Add("Image Links:");
                    }
                    foreach (ImageData image in this.patComp.GetImagesByPatientID(patient.Id)) {
                        printList.Add(image.Kommentar);
                        printList.Add(image.Link);
                    }
                }

                if ((patientPrintDetails & PatientPrintDetails.Visits) == PatientPrintDetails.Visits) {
                    foreach (VisitData visit in this.patComp.GetVisitsByPatientID(patient.Id)) {
                        printList.Add("");
                        printList.Add("Visit ID: " + visit.Id.ToString());
                        printList.Add("Visit date: " + visit.VisitDate.ToShortDateString());
                        if (!visit.Cause.Equals(""))
                            printList.Add("Cause: " + visit.Cause);
                        if (!visit.Localis.Equals(""))
                            printList.Add("STATUS localis: " + visit.Localis);
                        if (!visit.ExtraDiagnosis.Equals(""))
                            printList.Add("Diagnosis: " + visit.ExtraDiagnosis);
                        if (!visit.Procedure.Equals(""))
                            printList.Add("Procedure: " + visit.Procedure);
                        if (!visit.ExtraTherapy.Equals(""))
                            printList.Add("Therapy: " + visit.ExtraTherapy);
                        if (!visit.Anesthesiology.Equals(""))
                            printList.Add("Anaesthesia: " + visit.Anesthesiology);
                        if (!visit.Blooddiagnostic.Equals(""))
                            printList.Add("Blooddiagnostic: " + visit.Blooddiagnostic);
                        if (!visit.Radiodiagnostics.Equals(""))
                            printList.Add("Radiodiagnostics: " + visit.Radiodiagnostics);
                        if (!visit.Todo.Equals(""))
                            printList.Add("Todo: " + visit.Todo);
                        if (!visit.Ultrasound.Equals("")) {
                            string ultrasound = visit.Ultrasound;
                            ultrasound = "  " + ultrasound;
                            ultrasound = ultrasound.Replace(Environment.NewLine, Environment.NewLine + "  ");
                            printList.Add("Ultrasound:" + Environment.NewLine + ultrasound);
                        }
                    }
                }

                if ((patientPrintDetails & PatientPrintDetails.Operations) == PatientPrintDetails.Operations) {
                    foreach (OperationData operation in this.patComp.GetOperationsByPatientID(patient.Id)) {
                        printList.Add("");
                        printList.Add("Operation ID: " + operation.OperationId.ToString());
                        printList.Add("Date: " + operation.Date.ToShortDateString());
                        if (!operation.Team.Equals(""))
                            printList.Add("Team: " + operation.Team);
                        if (!operation.Process.Equals(""))
                            printList.Add("Process: " + operation.Process);
                        if (!operation.Diagnoses.Equals(""))
                            printList.Add("Diagnosis: " + operation.Diagnoses);
                        if (!operation.Performed.Equals(""))
                            printList.Add("Performed: " + operation.Performed);
                        if (!operation.Additionalinformation.Equals(""))
                            printList.Add("Additional Information: " + operation.Additionalinformation);
                        if (!operation.Medication.Equals(""))
                            printList.Add("Medication: " + operation.Medication);
                        printList.Add("Intdiagnosis: " + operation.IntDiagnoses.ToString());
                        printList.Add("PP PS: " + operation.Ppps.ToString());
                        printList.Add("Result: " + operation.Result.ToString());
                    }
                }

                if ((patientPrintDetails & PatientPrintDetails.FinalReport) == PatientPrintDetails.FinalReport) {
                    if (!this.patComp.GetFinalReportByPatientId(patient.Id).Equals("")) {
                        printList.Add("");
                        printList.Add("Final Report");
                        printList.Add(this.patComp.GetFinalReportByPatientId(patient.Id));
                    }
                }

                printList = SplitStringsForPrinting(80, printList);

                int lineNo = 0;
                int page = 1;
                float yPos = topMargin;// + (count * printFont.GetHeight(ev.Graphics));

                pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin - 20));
                pp.AddPrintableObject(new PrintableTextObject("SPD                                 " + DateTime.Now.ToShortDateString() + "  Page " + page, printFont, Brushes.Black, leftMargin + 300, topMargin - 20));
                pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin - 2, (int)leftMargin + 650, (int)topMargin - 2));

                foreach (string line in printList) {
                    if (lineNo >= 50) { // Neue Seite anfangen
                        pp.AddPrintableObject(new PrintableTextObject("Page " + page, printFont, Brushes.Black, leftMargin, 1069F));
                        lineNo = 0;
                        page++;
                        pd.AddPrintPage(pp);
                        pp = new PrintablePage();
                        yPos = topMargin;
                        pp.AddPrintableObject(new PrintableTextObject(patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin - 20));
                        pp.AddPrintableObject(new PrintableTextObject("SPD                                 " + DateTime.Now.ToShortDateString() + "  Page " + page, printFont, Brushes.Black, leftMargin + 300, topMargin - 20));
                        pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin - 2, (int)leftMargin + 650, (int)topMargin - 2));
                    }
                    yPos += 16.86523F;
                    if (line.StartsWith("Surname:") || line.StartsWith("Visit ID:") || line.StartsWith("Operation ID:") || line.StartsWith("Final Report") || line.StartsWith("Image Links:")) {
                        pp.AddPrintableObject(new PrintableTextObject(line, boldFont, Brushes.Black, leftMargin, yPos));
                    } else {
                        pp.AddPrintableObject(new PrintableTextObject(line, printFont, Brushes.Black, leftMargin, yPos));
                    }
                    lineNo++;
                }

                pd.AddPrintPage(pp);
            }

            pd.DoPrint();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Prints the next action list.
        /// </summary>
        /// <param name="patients">The patients.</param>
        /// <param name="headline">The headline.</param>
        public void PrintPatientList(IList<PatientData> patients, string headline, bool useOpData)
        {
            if (patients == null || patients.Count == 0) {
                return;
            }

            PrintableDocument pd = new PrintableDocument();
            pd.DocumentName = "SPD Next Action List";
            pd.Landscape = false;

            Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold);
            Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold);
            Font printFont = new Font("Arial", 11, FontStyle.Regular);
            Font boldPrintFont = new Font("Arial", 11, FontStyle.Bold);
            Font barCodeFont = null;
            if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) {
                barCodeFont = new Font("Free 3 of 9 Extended", 30, FontStyle.Regular, GraphicsUnit.Point);
            }

            float leftMargin = 65;
            float topMargin = 30;
            int page = 1;
            int line = 2;

            PrintablePage pp = new PrintablePage();

            pp.AddPrintableObject(new PrintableTextObject("SPD  -  " + headline, headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56)));
            pp.AddPrintableObject(new PrintableTextObject("        " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56)));
            pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56)));
            pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20));

            foreach (PatientData patient in patients) {
                pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                pp.AddPrintableObject(new PrintableTextObject("Sex: " + patient.Sex, printFont, Brushes.Black, leftMargin + 100, topMargin + (float)(line * 17.56)));
                pp.AddPrintableObject(new PrintableTextObject("Phone: " + patient.Phone, printFont, Brushes.Black, leftMargin + 200, topMargin + (float)(line * 17.56)));
                pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - " + CommonUtilities.StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth) + " years", printFont, Brushes.Black, leftMargin + 450, topMargin + (float)(line * 17.56)));
                line++;
                if (barCodeFont != null) {
                    pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, topMargin + (float)(line * 17.56)));
                }
                pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                line++;

                OperationData operation = this.patComp.GetLastOperationByPatientID(patient.Id);
                VisitData visit = this.patComp.GetLastVisitByPatientID(patient.Id);
                if (operation != null && useOpData) {
                    if (!String.IsNullOrEmpty(operation.Diagnoses)) {
                        List<string> extradiagnoses = new List<string>();
                        extradiagnoses.Add(operation.Diagnoses);
                        extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses);
                        pp.AddPrintableObject(new PrintableTextObject("OP Diagnoses:", boldPrintFont, Brushes.Black,
                                                                      leftMargin, topMargin + (float) (line*17.56)));
                        line++;
                        foreach (string diagnosesLine in extradiagnoses) {
                            pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black,
                                                                          leftMargin, topMargin + (float) (line*17.56)));
                            line++;
                        }
                    }
                    if (!String.IsNullOrEmpty(operation.Performed)) {
                        List<string> performed = new List<string>();
                        performed.Add(operation.Performed);
                        performed = this.SplitStringsForPrinting(80, performed);
                        pp.AddPrintableObject(new PrintableTextObject("OP Performed:", boldPrintFont, Brushes.Black,
                                                                      leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                        foreach (string performedLine in performed) {
                            pp.AddPrintableObject(new PrintableTextObject(performedLine, printFont, Brushes.Black,
                                                                          leftMargin, topMargin + (float)(line * 17.56)));
                            line++;
                        }
                    }
                    if (!String.IsNullOrEmpty(operation.Team)) {
                        List<string> team = new List<string>();
                        team.Add(operation.Diagnoses);
                        team = this.SplitStringsForPrinting(80, team);
                        pp.AddPrintableObject(new PrintableTextObject("OP Team:", boldPrintFont, Brushes.Black,
                                                                      leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                        foreach (string teamLine in team) {
                            pp.AddPrintableObject(new PrintableTextObject(teamLine, printFont, Brushes.Black,
                                                                          leftMargin, topMargin + (float)(line * 17.56)));
                            line++;
                        }
                    }
                } else {
                    if (visit != null && !String.IsNullOrEmpty(visit.ExtraDiagnosis)) {
                        List<string> extradiagnoses = new List<string>();
                        extradiagnoses.Add(visit.ExtraDiagnosis);
                        extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses);
                        pp.AddPrintableObject(new PrintableTextObject("Visit Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                        line++;
                        foreach (string diagnosesLine in extradiagnoses) {
                            pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56)));
                            line++;
                        }
                    }
                }

                pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)((line + 2) * 17.56), (int)leftMargin + 680, (int)((line + 2) * 17.56)));
                line++;

                if (line > 50) {
                    page++;
                    pd.AddPrintPage(pp);
                    pp = new PrintablePage();
                    line = 2;

                    pp.AddPrintableObject(new PrintableTextObject("SPD  -  " + headline, headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56)));
                    pp.AddPrintableObject(new PrintableTextObject("        " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56)));
                    pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56)));
                    pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20));
                }
            }
            pd.AddPrintPage(pp);
            pd.DoPrint();
        }