public string ReceiveReport(GetReport gr)
        {
            MedicalReport mr = new MedicalReport();

            mr.person   = _context.people.Where(b => b.UID == gr.uid).FirstOrDefault();
            mr.Report   = gr.Report;
            mr.Approved = true;
            _context.Add(mr);
            _context.SaveChanges();

            return("");
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("MedicalreportName,ReportFile,MedicalreportId,PatientId")] MedicalReport medicalReports)
        {
            if (ModelState.IsValid)
            {
                _context.Add(medicalReports);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MedicalreportId"] = new SelectList(_context.MedicalreportType, "MedicalreportId", "ReportType", medicalReports.MedicalreportId);
            ViewData["PatientId"]       = new SelectList(_context.Patient, "PatientId", "Allergy", medicalReports.PatientId);
            return(View(medicalReports));
        }
예제 #3
0
        private EmailMessage CreateMedicalReportReminderMessage(MedicalReport medicalReport)
        {
            var applicationUser = medicalReport.Employee.UserCompany.ApplicationUser;

            EmailMessage message = new EmailMessage()
            {
                EmailType         = Enumerations.EmailType.OSHTrainingExpiredReminder,
                EmployeeId        = medicalReport.EmployeeId,
                ApplicationUserID = applicationUser.Id,
                Recipient         = EncryptionService.DecryptEmail(applicationUser.Email),
                Body    = WebResources.MedicalResultToExpireReminderEmailBody,
                Subject = WebResources.MedicalResultToExpireReminderEmailTitle
            };

            _emailMessageService.Create(message);

            return(message);
        }
예제 #4
0
 public ActionResult CreateDoctorShedule(MedicalReport MedicalReport)
 {
     _repo.CreateMedicalReports(MedicalReport);
     return(NoContent());
 }
예제 #5
0
        private void saveReportButton_Click(object sender, EventArgs e)
        {
            if (((Button)sender).Text == @"Редактировать отчет")
            {
                dateLabel.Enabled             = true;
                dateTimePicker1.Enabled       = true;
                reportItemGroupBox.Enabled    = true;
                commentReportTextBox.Enabled  = true;
                newReportDataGridView.Enabled = true;
                saveReportButton.Text         = @"Cохранить отредактированный отчет";
                reportItemGroupBox.Visible    = true;
            }
            else
            {
                if (((Button)sender).Text == @"Сохранить отчет")
                {
                    saveReportButton.Text = @"Cохранить отредактированный отчет";
                }
                var report = new MedicalReport
                {
                    PatientId = patient.Id,
                    Date      = dateTimePicker1.Value,
                    Diagnosis = commentReportTextBox.Text,
                    DoctorId  = doctorId
                };
                if (reportId != null)
                {
                    report.Id = reportId.Value;
                    SqlHelper.TryUpdate <MedicalReport>(new[] { report });
                    SqlHelper.Delete <MedicalReportItem>("ReportId", reportId.Value);
                }
                else
                {
                    reportId = SqlHelper.TryInsert <MedicalReport>(new[] { report })[0];
                }
                var reportItems = new MedicalReportItem[newReportDataGridView.RowCount - 1];
                var i           = 0;
                foreach (DataGridViewRow row in newReportDataGridView.Rows)
                {
                    if (row.Cells[0].Value == null)
                    {
                        continue;
                    }
                    DerangementState state;
                    switch (row.Cells[2].Value as string)
                    {
                    case "Нарушено":
                        state = DerangementState.Deranged;
                        break;

                    case "Норма":
                        state = DerangementState.Normal;
                        break;

                    default:
                        state = DerangementState.Unknown;
                        break;
                    }
                    reportItems[i] = new MedicalReportItem
                    {
                        DerangementCode  = row.Cells[0].Value as string,
                        ReportId         = (int)reportId,
                        DerangementState = state,
                        Commentary       = row.Cells[3].Value as string
                    };
                    i++;
                }

                newReportGroupBox.Text = $@"Отчет за {report.Date.ToShortDateString()}";

                SqlHelper.TryInsert <MedicalReportItem>(reportItems);

                RefreshReportsListView();
            }
        }
예제 #6
0
 public void DeleteMedicalReports(MedicalReport MedicalReport)
 {
     _context.Remove(MedicalReport);
     _context.SaveChanges();
 }
예제 #7
0
 public void CreateMedicalReports(MedicalReport MedicalReport)
 {
     _context.MedicalReports.Add(MedicalReport);
     _context.SaveChanges();
 }
예제 #8
0
 public void Update(MedicalReport entity)
 {
     _medicalReportsRepository.Update(entity);
 }
예제 #9
0
 public void Delete(MedicalReport entity)
 {
     entity.IsDeleted = true;
     _medicalReportsRepository.Update(entity);
 }
예제 #10
0
        public int Create(MedicalReport entity)
        {
            _medicalReportsRepository.Insert(entity);

            return(entity.Id);
        }