コード例 #1
0
        private void printBtn_Click(object sender, EventArgs e)
        {
            int           rowCount = patientHistoryGrid.Rows.Count;
            DdvPatient    patient  = service.GetDdvPatientService().GetById(hospitalitySession.Patient);
            List <string> paths    = new List <string>();

            if (printTitlePage.Checked)
            {
                List <string> prePaths = new List <string>();
                Dictionary <string, string> titleDict = new Dictionary <string, string>();
                titleDict.Add("{mednumber}", patient.MedCode);
                titleDict.Add("{admission_date}", hospitalitySession.AdmissionDate.ToShortDateString());
                titleDict.Add("{leaving_date}", DateTime.Now.ToShortDateString());
                titleDict.Add("{med_policy}", patient.Oms);
                titleDict.Add("{room}", hospitalitySession.RoomCell);
                titleDict.Add("{daysinhospital}", (DateTime.Now.Year - hospitalitySession.AdmissionDate.Year) + "");
                DdtSerology serology = service.GetDdtSerologyService().GetByHospitalSession(hospitalitySession.ObjectId);
                titleDict.Add("{blood_n}", serology?.BloodType);
                titleDict.Add("{rhesus}", serology?.RhesusFactor);
                titleDict.Add("{height}", patient.High + "");
                titleDict.Add("{weight}", patient.Weight + "");
                titleDict.Add("{patient_full_name}", patient.FullName);
                titleDict.Add("{sex}", patient.Sex ? "мужской" : "женский");
                titleDict.Add("{passport}", patient.PassportSerial + " " + patient.PassportNum + " " + patient.PassportIssuePlace + " " + patient.PassportDate.ToShortDateString());
                titleDict.Add("{age}", (DateTime.Now.Year - patient.Birthdate.Year) + "");
                titleDict.Add("{birthdate}", patient.Birthdate.ToShortDateString());
                titleDict.Add("{address}", patient.Address);
                DdtAnamnesis firstIspection = service.GetDdtAnamnesisService().GetByHospitalSessionId(hospitalitySession.ObjectId);
                titleDict.Add("{diagnosis_first}", firstIspection?.Diagnosis);
                titleDict.Add("{diagnosis_last}", hospitalitySession.Diagnosis);

                prePaths.Add(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + "title.docx", titleDict));
                paths.Add(TemplatesUtils.MergeFiles(prePaths.ToArray(), true, null));
            }
            foreach (DataGridViewRow row in patientHistoryGrid.Rows)
            {
                bool checkd = (bool)row.Cells[0].Value;
                if (checkd)
                {
                    ITemplateProcessor te = TemplateProcessorManager.getProcessorByObjectType((string)row.Cells[2].Value);
                    if (te != null)
                    {
                        string pathFile = te.processTemplate(service, hospitalitySession.ObjectId, (string)row.Cells[3].Value, null);
                        paths.Add(pathFile);
                    }
                }
            }
            string resultFileName = TemplatesUtils.getTempFileName("История болезни", patient.FullName);
            string resultPath     = TemplatesUtils.MergeFiles(paths.ToArray(), false, resultFileName);

            TemplatesUtils.ShowDocument(resultPath);
        }
コード例 #2
0
        private void printBtn_Click(object sender, EventArgs e)
        {
            if (validate())
            {
                Save();

                ITemplateProcessor processor  = TemplateProcessorManager.getProcessorByObjectType(DdtJournal.NAME);
                string             path       = processor.processTemplate(service, hospitalitySession.ObjectId, journalDayId, null);
                DdvPatient         patient    = service.GetDdvPatientService().GetById(hospitalitySession.Patient);
                string             resultName = TemplatesUtils.getTempFileName("Журнал", patient.FullName);
                string             result     = TemplatesUtils.MergeFiles(new string[] { path }, false, resultName);
                TemplatesUtils.ShowDocument(result);
            }
        }