コード例 #1
0
        static void Main(string[] args)
        {
            var frame = new ReportFrame(
                new ReportFrameData()
            {
                Header1      = "Contacts list sample",
                Header2      = "Created by André Pena's SmartRecords",
                FooterLeft1  = "Created by SmartRecords",
                FooterLeft2  = "http://www.smartrecords.net",
                FooterRight1 = "",
                FooterRight2 = ""
            });

            // creates a new report
            var report = new Report(frame);

            foreach (var patient in ContactsDataSource.GetContacts())
            {
                // creates a data-context for each contact inside the report
                // inside the data-context, it's possible to add titles, cards and grids
                using (var patientContext = report.AddDataContext(patient))
                {
                    patientContext.AddTitle(ReportTitleSize.H1, m => "Contact: " + m.FirstName + " " + m.LastName);
                    var card = patientContext.AddCard();
                    card.AddField(m => m.FirstName);
                    card.AddField(m => m.LastName);
                    card.AddField(m => m.DateOfBirth);
                    card.AddField(m => m.Email, true);
                    card.AddField(m => m.Notes);

                    patientContext.AddTitle(ReportTitleSize.H2, m => "Address");
                    var addressCard = patientContext.AddCard(m => m.Address);
                    addressCard.AddField(m => m.AddressLine1, true);
                    addressCard.AddField(m => m.AddressLine2, true);
                    addressCard.AddField(m => m.City);
                    addressCard.AddField(m => m.State);
                    addressCard.AddField(m => m.Country);
                    addressCard.AddField(m => m.Zip);

                    patientContext.AddTitle(ReportTitleSize.H2, m => "Appointments");
                    var appointmentCard = patientContext.AddGrid(m => m.Appointments);
                    appointmentCard.AddColumn(m => m.With);
                    appointmentCard.AddColumn(m => m.Date);
                }
            }
            report.SaveToFile("document.pdf");
            Process.Start("document.pdf");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: vathuluri/SmartRecords
        static void Main(string[] args)
        {
            var frame = new ReportFrame(
                new ReportFrameData()
                {
                    Header1 = "Contacts list sample",
                    Header2 = "Created by André Pena's SmartRecords",
                    FooterLeft1 = "Created by SmartRecords",
                    FooterLeft2 = "http://www.smartrecords.net",
                    FooterRight1 = "",
                    FooterRight2 = ""
                });

            // creates a new report
            var report = new Report(frame);
            foreach (var patient in ContactsDataSource.GetContacts())
            {
                // creates a data-context for each contact inside the report
                // inside the data-context, it's possible to add titles, cards and grids
                using (var patientContext = report.AddDataContext(patient))
                {
                    patientContext.AddTitle(ReportTitleSize.H1, m => "Contact: " + m.FirstName + " " + m.LastName);
                    var card = patientContext.AddCard();
                    card.AddField(m => m.FirstName);
                    card.AddField(m => m.LastName);
                    card.AddField(m => m.DateOfBirth);
                    card.AddField(m => m.Email, true);
                    card.AddField(m => m.Notes);

                    patientContext.AddTitle(ReportTitleSize.H2, m => "Address");
                    var addressCard = patientContext.AddCard(m => m.Address);
                    addressCard.AddField(m => m.AddressLine1, true);
                    addressCard.AddField(m => m.AddressLine2, true);
                    addressCard.AddField(m => m.City);
                    addressCard.AddField(m => m.State);
                    addressCard.AddField(m => m.Country);
                    addressCard.AddField(m => m.Zip);

                    patientContext.AddTitle(ReportTitleSize.H2, m => "Appointments");
                    var appointmentCard = patientContext.AddGrid(m => m.Appointments);
                    appointmentCard.AddColumn(m => m.With);
                    appointmentCard.AddColumn(m => m.Date);
                }
            }
            report.SaveToFile("document.pdf");
            Process.Start("document.pdf");
        }
コード例 #3
0
        internal static byte[] ExportPatientsPdf(int?patientId, CerebelloEntitiesAccessFilterWrapper db, Practice practice, Doctor doctor)
        {
            var reportDataSource = new ReportData(db, practice).GetReportDataSourceForPdf(doctor, patientId);

            // the frame determines what is displayed in the header and in the
            // footer of your report pages
            var frame = new ReportFrame(
                new ReportFrameData()
            {
                Header1      = doctor.CFG_Documents.Header1,
                Header2      = doctor.CFG_Documents.Header2,
                FooterLeft1  = doctor.CFG_Documents.FooterLeft1,
                FooterLeft2  = doctor.CFG_Documents.FooterLeft2,
                FooterRight1 = doctor.CFG_Documents.FooterRight1,
                FooterRight2 = doctor.CFG_Documents.FooterRight2
            });

            // creates a new report
            var report = new Report(frame);

            foreach (var patient in reportDataSource.Patients)
            {
                // creates a data-context for each contact inside the report.
                // a data context is a section of your report that is bound to
                // a particular data object.
                using (var patientContext = report.AddDataContext(patient))
                {
                    // creates a title for the contact
                    patientContext.AddTitle(ReportTitleSize.H1, m => "Paciente: " + m.FullName);

                    // creates a Card to display the contacts details
                    var card = patientContext.AddCard();
                    card.AddField(m => m.FullName, true);
                    card.AddField(m => m.Gender);
                    card.AddField(m => m.DateOfBirth);
                    card.AddField(m => m.Profissao);
                    card.AddField(m => m.MaritalStatus);
                    card.AddField(m => m.PhoneLand);
                    card.AddField(m => m.PhoneCell);
                    card.AddField(m => m.Email, true);
                    card.AddField(m => m.Observations, true);

                    // creates another Card for displaying the contact's address details
                    patientContext.AddTitle(ReportTitleSize.H2, m => "Endereço");
                    var addressCard = patientContext.AddCard(m => m.Address);
                    addressCard.AddField(m => m.Street, true);
                    addressCard.AddField(m => m.Neighborhood, true);
                    addressCard.AddField(m => m.Complement);
                    addressCard.AddField(m => m.City);
                    addressCard.AddField(m => m.StateProvince);
                    addressCard.AddField(m => m.CEP);

                    for (var i = 0; i < patient.Sessions.Count; i++)
                    {
                        var closureI = i;
                        var session  = patient.Sessions[i];

                        patientContext.AddTitle(ReportTitleSize.H2, m => "Consulta do dia " + session.Date.ToShortDateString() + " às " + session.Date.ToShortTimeString());

                        for (var j = 0; j < session.Anamneses.Count; j++)
                        {
                            var closureJ = j;
                            patientContext.AddTitle(ReportTitleSize.H2, m => "Anamnese");
                            var anamneseCard = patientContext.AddCard(c => c.Sessions[closureI].Anamneses[closureJ]);
                            anamneseCard.AddField(m => m.ChiefComplaint, true);
                            anamneseCard.AddField(m => m.HistoryOfThePresentIllness, true);
                            anamneseCard.AddField(m => m.PastMedicalHistory, true);
                            anamneseCard.AddField(m => m.ReviewOfSystems, true);
                            anamneseCard.AddField(m => m.FamilyDeseases, true);
                            anamneseCard.AddField(m => m.SocialHistory, true);
                            anamneseCard.AddField(m => m.RegularAndAcuteMedications, true);
                            anamneseCard.AddField(m => m.Allergies, true);
                            anamneseCard.AddField(m => m.SexualHistory, true);
                            anamneseCard.AddField(m => m.Conclusion, true);
                        }

                        for (var j = 0; j < session.PhysicalExaminations.Count; j++)
                        {
                            var closureJ = j;
                            patientContext.AddTitle(ReportTitleSize.H2, m => "Exame físico");
                            var physicalExaminationCard = patientContext.AddCard(c => c.Sessions[closureI].PhysicalExaminations[closureJ]);
                            physicalExaminationCard.AddField(m => m.Notes);
                        }

                        for (var j = 0; j < session.DiagnosticHipotheses.Count; j++)
                        {
                            var closureJ = j;
                            patientContext.AddTitle(ReportTitleSize.H2, m => "Hipótese diagnóstica");
                            var physicalExaminationCard = patientContext.AddCard(c => c.Sessions[closureI].DiagnosticHipotheses[closureJ]);
                            physicalExaminationCard.AddField(m => m.Cid10Code);
                            physicalExaminationCard.AddField(m => m.Cid10Name);
                            physicalExaminationCard.AddField(m => m.Text);
                        }

                        for (var j = 0; j < session.Prescriptions.Count; j++)
                        {
                            var closureJ = j;
                            patientContext.AddTitle(ReportTitleSize.H2, m => "Receita");
                            var prescriptionGrid = patientContext.AddGrid(c => c.Sessions[closureI].Prescriptions[closureJ].PrescriptionMedicines);
                            prescriptionGrid.AddColumn(m => m.MedicineText);
                            prescriptionGrid.AddColumn(m => m.Quantity);
                            prescriptionGrid.AddColumn(m => m.Prescription);
                            prescriptionGrid.AddColumn(m => m.Observations);
                        }

                        if (session.ExaminationRequests.Any())
                        {
                            patientContext.AddTitle(ReportTitleSize.H2, m => "Pedidos de exame ou procedimento");
                            var examinationRequestsGrid = patientContext.AddGrid(c => c.Sessions[closureI].ExaminationRequests);
                            examinationRequestsGrid.AddColumn(m => m.MedicalProcedureName);
                            examinationRequestsGrid.AddColumn(m => m.MedicalProcedureCode);
                            examinationRequestsGrid.AddColumn(m => m.Notes);
                        }

                        if (session.ExaminationResults.Any())
                        {
                            patientContext.AddTitle(ReportTitleSize.H2, m => "Resultados de exame ou procedimento");
                            var examinationResultGrid = patientContext.AddGrid(c => c.Sessions[closureI].ExaminationResults);
                            examinationResultGrid.AddColumn(m => m.MedicalProcedureName);
                            examinationResultGrid.AddColumn(m => m.MedicalProcedureCode);
                            examinationResultGrid.AddColumn(m => m.Text);
                        }
                    }
                }
            }

            return(report.SaveToByteArray());
        }