Beispiel #1
0
        public void Create_Document_From_Scratch()
        {
            // Create agent with Vendor, UserProfile, and Agent
            var agent = CreateAgent();

            // Create Patient with Address, Medicare, and Private Insurance
            var patient = CreateAndPersistPatient(agent);

            IntakeForm intakeForm  = CreateIntakeFormLocal(patient.PatientId);
            IntakeForm intakeForm2 = CreateIntakeFormLocal(patient.PatientId);

            // Create Document Byte Array
            var intakeModel  = intakeForm.ToModel();
            var intakeModel2 = intakeForm2.ToModel();
            var exporter     = new DocumentGenerator();

            //todo if we are going to populate the questionare we need all intake forms to be passed to the DocumentGenerator
            //var intakeForms =  new List<IntakeFormModel> { intakeModel, intakeModel2 };
            var signatures = new List <SignatureModel> {
                CreateSignature().ToModel(), CreateSignature(false).ToModel()
            };
            var documentContent = exporter.GenerateIntakeDocuments(intakeModel, patient.ToModel(), intakeForm.Physician.ToModel(), signatures);

            // Create Document
            var document = new Document
            {
                IntakeFormId = intakeForm.IntakeFormId,
                Content      = documentContent
            };

            var doc = dbContext.Document.Add(document);
            var id  = dbContext.SaveChanges();

            Console.WriteLine($"Run project and open your browser to https://localhost:44327/document/{doc.Entity.DocumentId}/download to see the word doc generated from this test");
        }
Beispiel #2
0
        public IntakeFormModel Create(IntakeFormModel intakeFormModel)
        {
            var intakeForm = new IntakeForm();

            intakeForm.MapFromModel(intakeFormModel);
            intakeForm.Status = IntakeFormStatus.New;

            _context.IntakeForm.Add(intakeForm);
            _context.SaveChanges();

            return(intakeForm.ToModel());
        }
Beispiel #3
0
        public IntakeFormModel Update(IntakeFormModel intakeFormModel)
        {
            IntakeForm intakeForm = _context.IntakeForm
                                    .Include(i => i.Signatures)
                                    .Include("Questions.Answers")
                                    .First(u => u.IntakeFormId == intakeFormModel.IntakeFormId);

            intakeForm.MapFromModel(intakeFormModel);

            _context.SaveChanges();

            return(intakeForm.ToModel());
        }
Beispiel #4
0
        public int Create(DocumentModel documentModel)
        {
            IntakeForm intakeForm = _context.IntakeForm
                                    .Include("Questions.Answers")
                                    .Include(i => i.ICD10Codes)
                                    .Include(i => i.Physician.Address)
                                    .Include(i => i.Signatures)
                                    .First(i => i.IntakeFormId == documentModel.IntakeFormId);

            Patient patient = _context.Patient
                              .Include(p => p.Address)
                              .Include(p => p.PrivateInsurance)
                              .Include(p => p.Medicare)
                              .First(p => p.PatientId == intakeForm.PatientId);

            IntakeFormModel intakeFormModel = intakeForm.ToModel();
            PatientModel    patientModel    = patient.ToModel();
            PhysicianModel  physicianModel  = intakeForm.Physician.ToModel();
            ICollection <SignatureModel> signatureModels = intakeForm.Signatures.Select(s => s.ToModel()).ToList();

            var documentContent = _exporter.GenerateIntakeDocuments(
                intakeFormModel,
                patientModel,
                physicianModel,
                signatureModels);

            var document = new Document
            {
                IntakeFormId = documentModel.IntakeFormId,
                Content      = documentContent
            };

            intakeForm.Document = document;

            _context.SaveChanges();

            return(document.DocumentId);
        }