Пример #1
0
 public ItemListViewModel(MammaModel mammaModel)
 {
     VisitDate  = mammaModel.VisitDate;
     FIO        = mammaModel.FIO;
     BirthYear  = mammaModel.BirthYear;
     Conclusion = ConclusionMaker.MakeConclusion(mammaModel);
     Id         = mammaModel.Id;
     _model     = mammaModel;
 }
Пример #2
0
        public static void Export(MammaModel model)
        {
            var directoryFullPath = ExportDirectoryCreator.EnsureDirectory();

            var fileFullPath =
                $"{directoryFullPath}\\{model.VisitDate:dd.MM.yyyy} {model.FIO} {model.BirthYear}.docx";

            try
            {
                using (var document = DocX.Load(@"Templates\MammaTemplate.docx"))
                {
                    document.ReplaceText("%VisitDate%", model.VisitDate.ToShortDateString());

                    document.ReplaceText("%FIO%", model.FIO ?? string.Empty);

                    document.ReplaceText("%BirthYear%", model.BirthYear ?? string.Empty);

                    document.ReplaceText("%Status%", MakeStatus(model));

                    document.ReplaceText("%Skin%", MakeSkin(model));

                    document.ReplaceText("%Tissue%", MakeTissue(model));

                    document.ReplaceText("%Grandular%", MakeGrandular(model));

                    document.ReplaceText("%ActualToPhase%", MakeActualToPhase(model));

                    document.ReplaceText("%Canals%", MakeCanals(model));

                    document.ReplaceText("%DiffuseChanges%", MakeDiffuseCahnges(model));

                    document.ReplaceText("%NippleArea%", MakeNippleArea(model));

                    document.ReplaceText("%Cyst%", MakeCysts(model));

                    document.ReplaceText("%FocalFormation%", MakeFocalFormations(model));

                    document.ReplaceText("%LymphNodes%", MakeLymphNodes(model));

                    document.ReplaceText("%AdditionalInfo%",
                                         MakeAdditionalInfo(model));

                    document.ReplaceText("%Conclusion%", ConclusionMaker.MakeConclusion(model));

                    document.ReplaceText("%Recomendation%",
                                         model.Recomendation == MammaSpecialists.None
                            ? string.Empty
                            : $"\r\nРекомендована консультация {model.Recomendation.EnumDescription()}, маммография");

                    document.SaveAs(fileFullPath);
                }
            }
            catch (IOException)
            {
                MessageBox.Show("Не удается сохранить заключение. Возможно оно откртыто в Word.", "УЗД молочных желез",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Process.Start(fileFullPath);
        }