Ejemplo n.º 1
0
        public void ActionIndex(MContentModel model)
        {
            if (!string.IsNullOrEmpty(model.per))
            {
                int id   = Core.Global.Convert.ToInt(model.per.Replace("s", ""));
                var item = ModInfoMedicalService.Instance.GetByID(id);
                if (item != null)
                {
                    ViewBag.Data = item; RenderView("Barcode");
                }
                else
                {
                    ViewPage.Response.Redirect("/");
                }
            }

            //SEO
            ViewPage.CurrentPage.PageURL  = ViewPage.CurrentURL;
            ViewPage.CurrentPage.PageFile = Core.Web.HttpRequest.Domain + Global.Utils.GetResizeFile(ViewPage.CurrentPage.File, 4, 600, 315);
        }
Ejemplo n.º 2
0
        public void ActionAddPost(ModInfoMedicalEntity item, MContentModel model)
        {
            TryUpdateModel(item);

            item.Prognostic = GetState(model.Prognostic);
            item.NationPass = GetState(model.NationPass);

            if (ViewPage.Message.ListMessage.Count > 0)
            {
                string message = string.Empty;
                for (int i = 0; i < ViewPage.Message.ListMessage.Count; i++)
                {
                    message += ViewPage.Message.ListMessage[i] + "<br />";
                }

                ViewPage.Alert(message);
            }
            else
            {
                item.ID          = 0;
                item.Phone       = item.Phone.Replace(".", "");
                item.DateCreated = DateTime.Now;
                ModInfoMedicalService.Instance.Save(item);

                string color = "", pl = ""; var color3Code = Color.Green; var background = Color.White;

                if (item.Prognostic < 2 && !item.HumanHasCovid && !item.RegionHasCovid && !item.StreetHasCovid && string.IsNullOrEmpty(item.NationPassOther))
                {
                    color = "#9affa7"; pl = "Xanh"; color3Code = Color.Green; background = Color.White;
                }
                else if (item.Prognostic > 1 && (item.HumanHasCovid || item.RegionHasCovid || item.StreetHasCovid || !string.IsNullOrEmpty(item.NationPassOther)))
                {
                    color = "#ffd5c8"; pl = "Đỏ"; color3Code = Color.Red; background = Color.White;
                }
                else if (item.Prognostic < 2 && item.HumanHasCovid)
                {
                    color = "#ffd5c8"; pl = "Đỏ"; color3Code = Color.Red; background = Color.White;
                }
                else
                {
                    color = "#fff599"; pl = "Vàng"; color3Code = Color.Black; background = Color.Yellow;
                }


                // create the HTML to PDF converter
                HtmlToPdf htmlToPdfConverter = new HtmlToPdf();

                // set a demo serial number
                htmlToPdfConverter.SerialNumber = "YCgJMTAE-BiwJAhIB-EhlWTlBA-UEBRQFBA-U1FOUVJO-WVlZWQ==";

                // set browser width
                htmlToPdfConverter.BrowserWidth = 1200;

                // set HTML Load timeout
                htmlToPdfConverter.HtmlLoadedTimeout = 120;

                // set PDF page size and orientation
                htmlToPdfConverter.Document.PageSize        = PdfPageSize.A4;
                htmlToPdfConverter.Document.PageOrientation = PdfPageOrientation.Portrait;

                // set the PDF standard used by the document
                htmlToPdfConverter.Document.PdfStandard = PdfStandard.Pdf;

                // set PDF page margins
                htmlToPdfConverter.Document.Margins = new PdfMargins(15);

                // set whether to embed the true type font in PDF
                htmlToPdfConverter.Document.FontEmbedding = true;

                htmlToPdfConverter.TriggerMode = ConversionTriggerMode.Auto;

                try
                {
                    #region html Pdf
                    // convert HTML code
                    var    html       = @"<!DOCTYPE html>
                            <html lang=""en"">
                            <body style="" background:#fff;font-weight:bold;"">
                                <div style=""max-width: 1080px; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto;"">
                                    <table cellpadding=""0"" cellspacing=""0"" style=""width: 100%;margin-bottom: 20px;"">
                                        <tbody>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;width: 10%;""><span style=""margin:auto 7%;""><img src=""http://tokhaiyte.medlatec.vn/interface/img/logomed.png"" /></span></td>
                                                <td style=""padding:1%;text-align:left;width: 60%;"">
                                                    <p style="" text-align: center;margin:0;font-size:22px"">
                                                        SỞ Y TẾ HÀ NỘI
                                                    </p>
                                                    <p style="" text-align: center; font-weight: bold;margin:0;font-size:22px"">
                                                        BỆNH VIỆN ĐA KHOA MEDLATEC
                                                    </p>
                                                </td>
                                                <td style=""padding:1%;text-align:left;width: 30%; text-align:center; background:" + color + @"""><p style="" text-align: center; font-weight: bold;margin:0;font-size:18px"">
                                                        PL Khách hàng
                                                    </p> <p style="" text-align: center; font-weight: bold;margin:0;font-size:25px"">
                                                        " + pl + @"
                                                    </p></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;width: 10%;""><span style="" font-size: 1.3em; margin:auto 10%;""></span></td>
                                                <td style=""padding:1%;text-align:left;width:55%;"">
                                                    <p style="" text-align: center; font-weight: bold;margin:0;font-size:18px"">
                                                        PHIẾU KHAI BÁO THÔNG TIN Y TẾ
                                                    </p>
                                                    <p style="" text-align: center;font-style:italic; margin:0;font-size:13px"">
                                                        (Áp dụng từ ngày 15/04/2021)
                                                    </p>
                                                </td>
                                                <td style=""padding:1%;text-align:left;width: 30%; text-align:center""><p style="" text-align: center; font-weight: bold;margin:0;font-size:20px"">
                                                       " + Utils.FormatDate3(item.DateCreated) + @"
                                                    </p></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <p style=""font-weight: bold; "">I. THÔNG TIN CHUNG</p>
                                    <table cellpadding=""0"" cellspacing=""0"" style=""width: 100%;border-left: 1px solid #7a7676;border-top: 1px solid #7a7676;margin-bottom: 20px;"">
                                        <tbody>
                                            <tr>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 70%;""><span style="" font-size: 1.3em;"">Họ tên: " + item.Name + @"</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 30%;""><span style="" font-size: 1.3em;"">Giới tính: " + (item.Gender ? "Nam" : "Nữ") + @"</span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;""><span style="" font-size: 1.3em;font-style:italic;"">Năm sinh: " + Utils.FormatDate2(item.DateBirth) + @"</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;""><span style="" font-size: 1.3em;font-style:italic;"">Số điện thoại: " + Utils.FormatPhoneNumber(item.Phone) + @"</span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;""><span style="" font-size: 1.3em;"">CMT/CCCD: " + item.CitizenID + @"</span></td>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;""><span style="" font-size: 1.3em;"">Quốc tịch: " + item.Nationality + @"</span></td>

                                            </tr>

                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;"" colspan=""2""><span style="" font-size: 1.3em;"">Nơi ở hiện tại: " + item.Address + ", " + item.District + ", " + item.Province + @"</span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;"" colspan=""2""><span style="" font-size: 1.3em;"">Lý do khám: " + item.Purpose + @"</span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;"" colspan=""2""><span style="" font-size: 1.3em;"">Ngày khởi phát triệu chứng: " + Utils.FormatDate(item.DateOnset) + @"</span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;"" colspan=""2""><span style="" font-size: 1.3em;"">Các nơi (tên thành phố và quốc gia) bạn đã đi qua trong thời gian 21 ngày trở lại đây (nếu có): " + item.CityOrDistrict + @"</span></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <p style=""font-weight: bold; "">II.	KHAI BÁO Y TẾ: Hãy tích dấu “X” vào ô trống trước phần lựa chọn</p>
                                    <table cellpadding=""0"" cellspacing=""0"" style=""width: 100%;border-left: 1px solid #7a7676;border-top: 1px solid #7a7676;font-family: aria;"">
                                        <tbody>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; font-weight: bold; text-align:center""><span style="" font-size: 1.3em;"">Câu hỏi</span></td>
                                                <td style=""padding:1%;text-align:center;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;font-weight: bold;"" colspan=""2""><span style="" font-size: 1.3em;"">Trả lời</span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; font-weight: bold;""><span style="" font-size: 1.3em;"">Mục A: Triệu chứng</span></td>
                                                <td style=""padding:1%;text-align:center;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;font-weight: bold;"" colspan=""2""><span style="" font-size: 1.3em;""></span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Sốt</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 2) == 2 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 2) != 2 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Ho, đau họng</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 16) == 16 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 16) != 16 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Tức ngực, khó thở</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 4) == 4 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 4) != 4 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Các biểu hiện của hội chứng cúm: Đau mỏi người, đau đầu, gai rét, sổ mũi,…</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 8) == 8 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + ((item.Prognostic & 8) != 8 ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                        </tbody>
                                        <tbody>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; font-weight: bold;""><span style="" font-size: 1.3em;"">Mục B: Yếu tố dịch tễ</span></td>
                                                <td style=""padding:1%;text-align:center;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;font-weight: bold;"" colspan=""2""><span style="" font-size: 1.3em;""></span></td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Có đến, ở, đi qua tại các địa điểm dịch tễ có người mắc Covid 19 được Bộ Y tế khuyến cáo trong thời gian 21 ngày gần đây hay không?</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + (item.RegionHasCovid ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + (!item.RegionHasCovid ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Có tiếp xúc gần, chăm sóc với người mắc hoặc nghi nhiễm Covid 19 không?</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                        <span style="" font-size: 1.3em;"">
                                                            Có <label class=""checkbox-inline"">
                                                                <input type=""checkbox"" " + (item.HumanHasCovid ? "checked" : "") + @">
                                                            </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                        <span style="" font-size: 1.3em;"">
                                                            Không<label class=""checkbox-inline"">
                                                                <input type=""checkbox"" " + (!item.HumanHasCovid ? "checked" : "") + @">
                                                            </label>
                                                        </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có đến/ở/về từ nước ngoài trong thời gian 21 ngày gần đây không? Nếu có kể tên : " + item.NationPassOther + @"
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + (!string.IsNullOrEmpty(item.NationPassOther) ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + (string.IsNullOrEmpty(item.NationPassOther) ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 70%;text-align:center""><span style="" font-size: 1.3em;"">Di chuyển trên cùng phương tiện giao thông công cộng/ Phòng làm việc/ Nhóm làm việc, vui chơi, du lịch,… của anh/chị có người nghi ngờ hoặc đã xác định nhiễm Covid 19 không??</span></td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676; width: 15%;"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Có <label class=""checkbox-inline"">
                                                            <input type=""checkbox""" + (item.StreetHasCovid ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                                <td style=""padding:1%;text-align:left;border-bottom:1px solid #7a7676;border-right:1px solid #7a7676;width: 15%"">
                                                    <span style="" font-size: 1.3em;"">
                                                        Không<label class=""checkbox-inline"">
                                                            <input type=""checkbox"" " + (!item.StreetHasCovid ? "checked" : "") + @">
                                                        </label>
                                                    </span>
                                                </td>
                                            </tr>
                                        </tbody>

                                    </table>
                                    <p>Tôi xin cam đoan những lời khai trên hoàn toàn đúng sự thật, nếu vi phạm tôi xin chịu trách nhiệm trước pháp luật.</p>
                                    <table cellpadding=""0"" cellspacing=""0"" style=""width: 100%;font-family: aria;"">
                                        <tbody>
                                            <tr>
                                                <td style=""padding:1%;text-align: left;text-align:center; width:50%"">
                                                    <p style="" margin: 0; font-weight:bold""> Người khai báo</p>
                                                    <p style="" margin: 0;font-style:italic"">(Ký và ghi rõ họ tên)</p>
                                                </td>
                                                <td style=""padding:1%;text-align:center;width:50%"">

                                                    <p style="" margin: 0;"">Ngày……Tháng……Năm 2021</p>
                                                    <p style="" margin: 0; font-weight:bold"">Cán bộ khai thác thông tin</p>
                                                    <p style="" margin: 0;font-style:italic"">(Ký và ghi rõ họ tên)</p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </body>
                            </html>";
                    var    tick       = DateTime.Now.Ticks;
                    string exportFile = ViewPage.Server.MapPath("~/data/upload/files/Tokhaiyte_" + tick + item.ID + ".pdf");
                    var    targetPath = ("~/data/upload/files/Tokhaiyte_" + tick + item.ID + ".pdf").Replace("~/", "/").Replace("\\", "/").Replace("//", "/").Replace("//", "/").Replace("~/", "/");

                    htmlToPdfConverter.ConvertHtmlToFile(html, "", exportFile);
                    #endregion
                    item.UrlFile = targetPath;
                    string filename = Data.GetCode(item.Name) + "-" + DateTime.Now.Ticks;

                    string exportFilebarCode = ViewPage.Server.MapPath("~/data/upload/images/barcode/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + filename + ".png");
                    var    targetPath3Code   = ("~/data/upload/images/barcode/" + DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + filename + ".png").Replace("~/", "/").Replace("\\", "/").Replace("//", "/").Replace("//", "/").Replace("~/", "/");

                    var target = Path.GetDirectoryName(exportFilebarCode.ToLower().Replace("~/data/upload/images/barcode", "").Replace("/data/upload/images/barcode", ""));
                    System.IO.Directory.CreateDirectory(target);
                    Utils.GenerateBarcode(item.Phone, exportFilebarCode, color3Code, background);

                    item.UrlBarcode = targetPath3Code;

                    ModInfoMedicalService.Instance.Save(item, o => new { o.UrlFile, o.UrlBarcode });

                    // string id = AES.EncryptString(item.ID.ToString(), "");

                    ViewPage.Response.Redirect("/ma-vach-khai-bao/?per=s" + item.ID);
                    //("Cảm ơn Quý khách đã dành thời gian kê khai thông tin y tế.", "/ma-vach-khai-bao/?per=s" + item.ID);


                    item = new ModInfoMedicalEntity();
                }
                catch (Exception ex)
                {
                    Error.Write(ex.Message);
                    return;
                }
            }
            ViewBag.Data  = item;
            ViewBag.Model = model;
        }