public async Task <FullRecipeInfoDto> GetRecipe(int consultationId)
        {
            var recipe = await _context.Recipes.Where(c => c.ConsultationId == consultationId)
                         .ProjectTo <RecipeDto>(_mapper.ConfigurationProvider)
                         .SingleOrDefaultAsync();

            var pacient = await _context.Pacients.Where(c => c.Id == recipe.PacientId)
                          .ProjectTo <PacientRecipeDto>(_mapper.ConfigurationProvider)
                          .SingleOrDefaultAsync();

            var doctor = await _context.Consultations
                         .Include(c => c.Appoinment.Doctor)
                         .Where(c => c.Id == consultationId)
                         .Select(c => c.Appoinment.Doctor)
                         .ProjectTo <DoctorRecipeDto>(_mapper.ConfigurationProvider)
                         .SingleOrDefaultAsync();

            var result = new FullRecipeInfoDto {
                Doctor  = doctor,
                Pacient = pacient,
                Recipe  = recipe
            };

            return(result);
        }
예제 #2
0
        public static string GetRecipeHTMLString(FullRecipeInfoDto fullRecipeInfoDto)
        {
            var sb = new StringBuilder();

            sb.AppendFormat(@"
                        <html>
                            <head>
                            </head>
                            <body>
                                <div class='header'><h1>Reteta {0}</h1></div>
                                <div>
                                <div id='div1'>
                                    <li><strong>Eliberat pentru</strong></li>
                                    </br>
                                    <li>{1} {2}</li>
                                    <li>Email: {3}</li>
                                    <li>Serie: {4} Numar: {5}</li>
                                    <li>CNP: {6}</li>
                                </div>
                                <div id='div2'>
                                    <li><strong>Eliberat de catre:</strong></li>
                                    </br>
                                    <li>Dr {7} {8}</li>
                                    <li>Email: {9}</li>
                                    <li>La data de: {10}</li>
                                    <li>-</li>
                                </div>
                                </div>
                                </br>
                                <table align='center'>
                                    <tr>
                                        <th>Medicament</th>
                                        <th>Dozaj</th>
                                        <th>Frecventa</th>
                                        <th>Numar zile</th>
                                    </tr>",
                            fullRecipeInfoDto.Recipe.UniqueId,
                            fullRecipeInfoDto.Pacient.FirstName,
                            fullRecipeInfoDto.Pacient.SecondName,
                            fullRecipeInfoDto.Pacient.Email,
                            fullRecipeInfoDto.Pacient.Series,
                            fullRecipeInfoDto.Pacient.IdentityNumber,
                            fullRecipeInfoDto.Pacient.CNP,
                            fullRecipeInfoDto.Doctor.FirstName,
                            fullRecipeInfoDto.Doctor.SecondName,
                            fullRecipeInfoDto.Doctor.Email,
                            fullRecipeInfoDto.Recipe.DateAdded
                            );

            foreach (var med in fullRecipeInfoDto.Recipe.Prescriptions)
            {
                sb.AppendFormat(@"<tr>
                                    <td>{0}</td>
                                    <td>{1} {2}</td>
                                    <td>{3} pe zi</td>
                                    <td>{4}</td>
                                  </tr>", med.Medicine.CommercialName, med.DosageNumberPerDay, med.DosageType.ToLower(), med.Frequency, med.NumberOfDays);
            }
            sb.Append(@"
                                </table>
                                </br>
                                </br>
                                </br>
                                <div>
                                <div id='div3'>
                                    <h2>Semnatura medic</h2>
                                </div>
                                <div id='div4'>
                                    <h2>Stampila medic</h2>
                                </div>
                                </div>
                            </body>
                        </html>");

            return(sb.ToString());
        }