Пример #1
0
        string GetColNameSub(string colName)
        {
            if (!string.IsNullOrEmpty(colName))
            {
                switch (colName)
                {
                case "morning":
                    return(Linguist.Phrase("mornSub"));

                case "noon":
                    return(Linguist.Phrase("noonSub"));

                case "evening":
                    return(Linguist.Phrase("eveSub"));

                case "night":
                    return(Linguist.Phrase("nightSub"));
                }
            }
            return("");
        }
Пример #2
0
        private string buildBedRoomInfo(PatientData patient, bool isMultiPatient)
        {
            var result = string.IsNullOrEmpty(patient.Room) ? "" : (isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : patient.Room);

            return(result);
        }
Пример #3
0
        private List <SureMedRdlcReportInsideInfo> buildPillInside()
        {
            var listPillGroup  = listPill.GroupBy(p => new { p.PillId }, (key, group) => new { pillId = key.PillId, pillInfo = group });
            var listPillInside = new List <SureMedRdlcReportInsideInfo>();

            listImagePill = new List <Image>();
            foreach (var item in listPillGroup.OrderBy(p => p.pillId))
            {
                if (item.pillId != null)
                {
                    var pillGroup = listPillGroup.FirstOrDefault(o => o.pillId == item.pillId);

                    var medicine   = Helper.GetMedicineData(tray, item.pillId);
                    var pillInside = new SureMedRdlcReportInsideInfo();
                    pillInside.NationalDrugCode = Linguist.Phrase("NDCPrefix") + item.pillId.ToUpper();
                    var listDispense = GetChargeAndExpireDate();
                    var dispenseInfo = listDispense.FirstOrDefault(x => x.PillId.Contains(item.pillId));
                    var LotTemp      = dispenseInfo != null ? dispenseInfo.ChargeNumberList : "";
                    var col1Name     = Helper.CalculateIntakeTime(tray, 1);
                    var col2Name     = Helper.CalculateIntakeTime(tray, 2);
                    var col3Name     = Helper.CalculateIntakeTime(tray, 3);
                    var col4Name     = Helper.CalculateIntakeTime(tray, 0);
                    pillInside.Col1Name = col1Name.Length > 5 ? col1Name.Substring(0, 5) : col1Name;
                    pillInside.Col2Name = col2Name.Length > 5 ? col2Name.Substring(0, 5) : col2Name;
                    pillInside.Col3Name = col3Name.Length > 5 ? col3Name.Substring(0, 5) : col3Name;
                    pillInside.Col4Name = col4Name.Length > 5 ? col4Name.Substring(0, 5) : col4Name;
                    if (medicine.PillInfo != null)
                    {
                        pillInside.Manufacturer  = (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Length > 30? (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Substring(0, 30): (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName);
                        pillInside.BrandName     = Linguist.Phrase("BrandWithColonTitle") + " " + medicine.PillInfo.BrandNameShort;
                        pillInside.DrugName      = medicine.PillInfo.ItemShortName;
                        pillInside.Description   = medicine.PillInfo.Description;
                        pillInside.Shape         = medicine.PillInfo.Shape;
                        pillInside.Color         = medicine.PillInfo.Color;
                        pillInside.Imprint       = medicine.PillInfo.Imprint;
                        pillInside.LotNumber     = Linguist.Phrase("LotWithColonTitle") + "" + LotTemp;
                        pillInside.RxNumber      = Linguist.Phrase("RxWithColonTitle") + " " + medicine.PrescriptionNumber;
                        pillInside.RxOrigBarCode = Utils.imageToByteArray(GenCode128.Code128Rendering.MakeBarcodeImage(medicine.PrescriptionNumberOriginal, 2, true));
                        pillInside.DrName        = Linguist.Phrase("DrNameWithColonTitle") + " " + medicine.PrescribingPhysician;
                        pillInside.Instructions  = medicine.MedicationsInstruction;
                        pillInside.Model1        = medicine.PillInfo.Model1 != null?Utils.imageToByteArray(medicine.PillInfo.Model1) : new byte[0];

                        pillInside.Model2 = (medicine.PillInfo.Model2 != null) ? Utils.imageToByteArray(medicine.PillInfo.Model2) : new byte[0];
                        //if (medicine.PillInfo.Model1 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model1);
                        //pillInside.ImgModel1 = medicine.PillInfo.Model1;
                        //}
                        //if (medicine.PillInfo.Model2 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model2);
                        //pillInside.ImgModel2 = medicine.PillInfo.Model2;
                        //}
                        //if (medicine.PillInfo.Model3 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model3);
                        //pillInside.ImgModel3 = medicine.PillInfo.Model3;
                        //}
                        //if (medicine.PillInfo.Model4 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model4);
                        //pillInside.ImgModel4 = medicine.PillInfo.Model4;
                        //}
                    }
                    if (pillGroup != null && pillGroup.pillInfo != null)
                    {
                        foreach (var pill in pillGroup.pillInfo)
                        {
                            if (pill != null)
                            {
                                switch ((pill.cupNumber + 3) % 4)
                                {
                                case 0:
                                    pillInside.NumMorn += pill.Amount;
                                    break;

                                case 1:
                                    pillInside.NumNoon += pill.Amount;
                                    break;

                                case 2:
                                    pillInside.NumEve += pill.Amount;
                                    break;

                                case 3:
                                    pillInside.NumNight += pill.Amount;
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }

                    listPillInside.Add(pillInside);
                }
            }
            //var size = ProcessImageModelPill.SetNewImageSize(listImagePill);

            //foreach (var item in listPillInside)
            //{
            //item.Model1 = ProcessImageModelPill.ResizePillModels(item.ImgModel1, size);
            //item.Model2 = ProcessImageModelPill.ResizePillModels(item.ImgModel2, size);
            //}
            return(listPillInside);
        }
Пример #4
0
        private void buildDataSubReport()
        {
            listCup4 = new List <SureMedRdlcReportOutsideCupInfo>();
            listCup3 = new List <SureMedRdlcReportOutsideCupInfo>();
            listCup2 = new List <SureMedRdlcReportOutsideCupInfo>();
            listCup1 = new List <SureMedRdlcReportOutsideCupInfo>();
            listPill = new List <SureMedRdlcReportOutsidePillInfo>();
            #region list cup
            var rowNum  = 0;
            var colNum1 = 0;
            var colNum2 = 0;
            var colNum3 = 0;
            var colNum4 = 0;

            var isMultiPatient           = tray.Patients.Count() > 1;
            var firstCupByIntakeDateTime = tray.Cups.OrderBy(o => o.IntakeDateTime).FirstOrDefault();
            for (int i = 1; i <= 28; i++)
            {
                var cupInfo = new SureMedRdlcReportOutsideCupInfo();
                var cup     = tray.Cups.FirstOrDefault(x => x.Number == i);
                if (cup != null)
                {
                    var listDoseDispense = new List <string> {
                        "a", "b", "c", "d"
                    };
                    var isDoesDispen = listDoseDispense.Contains(cup.TimeSlotCode);
                    if (cup.Number == firstCupByIntakeDateTime.Number)
                    {
                        cupInfo.FirstCup = true;
                    }

                    //defaultFormatDate = languageCode == "bg-BG" ? "dd.MM.yyyy" : "dd-MM-yy";
                    cupInfo.IntakeDateTimeStr = (isDoesDispen ? cup.TimeSlotDescription : cup.IntakeTimeDescription);
                    cupInfo.IntakeIcon        = isDoesDispen ? (cup.TimeSlotIcon != null ? Utils.imageToByteArray(cup.TimeSlotIcon) : new byte[0]) : (cup.IntakeTimeIcon != null ? Utils.imageToByteArray(cup.IntakeTimeIcon) : new byte[0]);
                    cupInfo.PatientName       = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : cup.Patient.FullName.ToUpper();
                    cupInfo.TimeSlotColor     = isDoesDispen ? cup.TimeSlotColor : cup.IntakeTimeColor;
                    cupInfo.PrintTime         = isDoesDispen ? cup.TimeSlotDescription : cup.IntakeTimeDescription;
                    cupInfo.IsMultiPatient    = isMultiPatient;
                    cupInfo.DayName           = cup.IntakeDateTime
                                                .ToString("dddd");
                    #region list pill info
                    var medicines = CalculateWholePillsInCup(cup, isDoesDispen);
                    listPill.AddRange(medicines);
                    #endregion
                }

                cupInfo.cupNumber = i;
                if (i % 4 == 0)
                {
                    cupInfo.row = rowNum + 1;
                    cupInfo.col = colNum4 + 1;
                    colNum4++;
                    listCup4.Add(cupInfo);
                }
                if (i % 4 == 3)
                {
                    cupInfo.row = rowNum + 2;
                    cupInfo.col = colNum3 + 1;
                    colNum3++;
                    listCup3.Add(cupInfo);
                }
                if (i % 4 == 2)
                {
                    cupInfo.row = rowNum + 3;
                    cupInfo.col = colNum2 + 1;
                    colNum2++;
                    listCup2.Add(cupInfo);
                }
                if (i % 4 == 1)
                {
                    cupInfo.row = rowNum + 4;
                    cupInfo.col = colNum1 + 1;
                    colNum1++;
                    listCup1.Add(cupInfo);
                }
            }
            foreach (var item in listCup1)
            {
                listCup4.FirstOrDefault(x => x.col == item.col).DayName1 = item.DayName;
            }

            foreach (var item in listCup2)
            {
                listCup4.FirstOrDefault(x => x.col == item.col).DayName2 = item.DayName;
            }

            foreach (var item in listCup3)
            {
                listCup4.FirstOrDefault(x => x.col == item.col).DayName3 = item.DayName;
            }

            foreach (var item in listCup4)
            {
                var listDayName = new List <string>();
                if (!string.IsNullOrEmpty(item.DayName))
                {
                    listDayName.Add(item.DayName);
                }
                if (!string.IsNullOrEmpty(item.DayName1))
                {
                    listDayName.Add(item.DayName1);
                }
                if (!string.IsNullOrEmpty(item.DayName2))
                {
                    listDayName.Add(item.DayName2);
                }
                if (!string.IsNullOrEmpty(item.DayName3))
                {
                    listDayName.Add(item.DayName3);
                }
                var count = listDayName.Distinct().Count();
                item.DayName = count > 1 ? "" : listDayName.Distinct().FirstOrDefault();
            }
            #endregion
        }
Пример #5
0
        void BindingDataToReport()
        {
            tray = _reportService.GetTrayNew();
            if (tray != null)
            {
                var cartonLabel = tray.Carton != null ? tray.Carton.Label : null;
                if (isPrint)
                {
                    labelId = Guid.NewGuid().ToString();
                }
                else
                {
                    labelId = cartonLabel != null ? cartonLabel.LabelId : Guid.Empty.ToString();
                }
                isMultiLocation = tray.Locations.Count > 1;
                var    models          = new List <SureMedRdlcReportOutsideInfo>();
                var    isMultiPatient  = tray.Patients.Count() > 1;
                var    patient         = tray.Patients.FirstOrDefault().Value;
                var    cupFirst        = tray.Cups.OrderBy(x => x.IntakeDateTime).FirstOrDefault();
                var    location        = tray.Locations.FirstOrDefault().Value;
                var    customerAdrress = location.Customer.Addresses.FirstOrDefault(o => ("Medication packing address").Equals(o.AddressType));
                Bitmap imagetemp       = null;
                if (patient.PhotoImage != null)
                {
                    imagetemp = (Bitmap)patient.PhotoImage.Clone();
                }
                var model = new SureMedRdlcReportOutsideInfo()
                {
                    PatientName  = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : patient.FullName.Length > 25 ? patient.FullName.Substring(0, 25): patient.FullName,
                    PatientPhoto = patient.PhotoImage != null && !isMultiPatient?Utils.imageToByteArray(imagetemp) : new byte[0],
                                       RoomBedInfo         = buildBedRoomInfo(patient, isMultiPatient),
                                       PatientId           = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : patient.PatientId,
                                       PatientIdWithPrefix = Linguist.Phrase("PatientIdWithColonTitle") + " " + patient.PatientId,
                                       StartDate           = cupFirst.IntakeDateTime.ToString(defaultFormatDate),
                                       PatientDob          = isMultiPatient
                        ? Linguist.Phrase("ErrorDataTitle")
                        : (patient.DateOfBirth != DateTime.MinValue ? Linguist.Phrase("DOBTitle") + patient.DateOfBirth.ToString(defaultFormatDate) : ""),
                                       Facility = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : cupFirst.Location.Institution.Name,
                                       DayOfWeekStartDatestr = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : cupFirst.IntakeDateTime.ToString("dddd") + " " + cupFirst.IntakeDateTime.ToString("MM/dd/yyyy"),
                                       DayOfWeek             = cupFirst.IntakeDateTime.ToString("dddd"),
                                       PackXofX        = Linguist.Phrase("PackTitle") + " " + (tray.SequenceTrayNumberByPatient <= 0 ? 1 : tray.SequenceTrayNumberByPatient) + " " + Linguist.Phrase("OfTitle") + " " + (tray.TotalTrayInBatchByPatient <= 0 ? 1 : tray.TotalTrayInBatchByPatient),
                                       PatientBigPhoto = patient.PhotoImage != null && !isMultiPatient?Utils.imageToByteArray(imagetemp) : new byte[0],
                                                             PharmacyInfo    = location.Customer.Name,
                                                             PharmacyAddress = customerAdrress != null?buildCustomerAddress(customerAdrress) : "",
                                                                                   BarcodeImage = Utils.CreateQRCode(labelId),
                                                                                   CompanyLogo  = tray.Batch.Order.CompanyLogo != null?Utils.imageToByteArray(tray.Batch.Order.CompanyLogo) : new byte[0],
                                                                                                      PromoLogo = tray.Batch.Order.Template1 != null?Utils.imageToByteArray(Utils.rotateInternalFunction(tray.Batch.Order.Template1, RotateFlipType.Rotate270FlipNone)) : new byte[0],
                                                                                                                      DateCreated    = Linguist.Phrase("DatePackedWithColonTitle") + " " + tray.DateCreated.ToString(defaultFormatDate),
                                                                                                                      IsMultiPatient = isMultiPatient,
                                                                                                                      Phone          = location.Customer.Phone1,
                                                                                                                      ExpireDate     = Linguist.Phrase("ExpireDateWithColonTitle") + " " + Helper.CalculateExpireDate(tray, cupFirst, Settings.Default.MinimumExpirePeriod).ToString(defaultFormatDate),
                                                                                                                      Unit           = patient.Unit,
                                                                                                                      Location       = isMultiLocation ? Linguist.Phrase("ErrorDataTitle") : tray.Locations.FirstOrDefault().Value.LocationId,
                                                                                                                      PhoneLabel     = Linguist.Phrase("PhoneWithColonTitle"),
                                                                                                                      Dea            = Linguist.Phrase("Dea#WithColonTitle"),
                                                                                                                      DeaValue       = location.Customer.DeaNumber,
                                                                                                                      CautionValue   = Linguist.Phrase("Warning") + Environment.NewLine + Linguist.Phrase("Caution"),
                                                                                                                      PatientStreet  = patient.Addresses.FirstOrDefault() != null?patient.Addresses.FirstOrDefault().Street                                                        : "",
                                                                                                                      PatientZipCode = patient.Addresses.FirstOrDefault() != null?patient.Addresses.FirstOrDefault().ZipPostalCode + " " + patient.Addresses.FirstOrDefault().City : ""
                };

                models.Add(model);
                ReportDataSource reportDataSource1 =
                    new Microsoft.Reporting.WinForms.ReportDataSource();
                reportDataSource1.Name  = "SureMedPlusCardOutsideInfoDataset";
                reportDataSource1.Value = models;
                this.reportViewer.LocalReport.DataSources.Add(reportDataSource1);
                buildDataSubReport();
            }
        }
Пример #6
0
        private List <SureMedRdlcReportInsideInfo> buildPillInside()
        {
            var listPillGroup  = listPill.GroupBy(p => new { p.PillId }, (key, group) => new { pillId = key.PillId, pillInfo = group });
            var listPillInside = new List <SureMedRdlcReportInsideInfo>();

            listImagePill = new List <Image>();
            foreach (var item in listPillGroup.OrderBy(p => p.pillId))
            {
                if (item.pillId != null)
                {
                    var pillGroup = listPillGroup.FirstOrDefault(o => o.pillId == item.pillId);

                    var medicine   = Helper.GetMedicineData(tray, item.pillId);
                    var pillInside = new SureMedRdlcReportInsideInfo();
                    pillInside.NationalDrugCode = Linguist.Phrase("NDCPrefix") + item.pillId.ToUpper();
                    var col1Name = Helper.CalculateIntakeTime(tray, 1);
                    var col2Name = Helper.CalculateIntakeTime(tray, 2);
                    var col3Name = Helper.CalculateIntakeTime(tray, 3);
                    var col4Name = Helper.CalculateIntakeTime(tray, 0);
                    pillInside.Col1Name = col1Name.Length > 5 ? col1Name.Substring(0, 5) : col1Name;
                    pillInside.Col2Name = col2Name.Length > 5 ? col2Name.Substring(0, 5) : col2Name;
                    pillInside.Col3Name = col3Name.Length > 5 ? col3Name.Substring(0, 5) : col3Name;
                    pillInside.Col4Name = col4Name.Length > 5 ? col4Name.Substring(0, 5) : col4Name;
                    if (medicine.PillInfo != null)
                    {
                        pillInside.Manufacturer = (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Length > 30? (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Substring(0, 30): (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName);
                        pillInside.BrandName    = Linguist.Phrase("BrandWithColonTitle") + " " + medicine.PillInfo.BrandNameShort;
                        pillInside.DrugName     = medicine.PillInfo.ItemShortName;
                        pillInside.Description  = medicine.PillInfo.Description;
                        pillInside.RxNumber     = Linguist.Phrase("RxWithColonTitle") + " " + medicine.PrescriptionNumber;
                        pillInside.DrName       = Linguist.Phrase("DrNameWithColonTitle") + " " + medicine.PrescribingPhysician;
                        if (medicine.MedicationsInstruction.Contains("*"))
                        {
                            pillInside.Instructions = medicine.MedicationsInstruction.Substring(0, medicine.MedicationsInstruction.IndexOf("*") - 1);
                            pillInside.Notes        = medicine.MedicationsInstruction.Substring(medicine.MedicationsInstruction.IndexOf("*") + 1);
                        }
                        else
                        {
                            pillInside.Instructions = medicine.MedicationsInstruction;
                            pillInside.Notes        = null;
                        }
                        //pillInside.Model1 = medicine.PillInfo.Model1 != null ? Utils.imageToByteArray(medicine.PillInfo.Model1) : new byte[0];
                        //pillInside.Model2 = (medicine.PillInfo.Model2 != null) ? Utils.imageToByteArray(medicine.PillInfo.Model2) : new byte[0];
                        pillInside.DrugName = medicine.PillInfo.Description;
                        if (medicine.PillInfo.Model1 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model1);
                            pillInside.ImgModel1 = medicine.PillInfo.Model1;
                        }
                        if (medicine.PillInfo.Model2 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model2);
                            pillInside.ImgModel2 = medicine.PillInfo.Model2;
                        }
                        if (medicine.PillInfo.Model3 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model3);
                            pillInside.ImgModel3 = medicine.PillInfo.Model3;
                        }
                        if (medicine.PillInfo.Model4 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model4);
                            pillInside.ImgModel4 = medicine.PillInfo.Model4;
                        }
                    }
                    if (pillGroup != null && pillGroup.pillInfo != null)
                    {
                        foreach (var pill in pillGroup.pillInfo)
                        {
                            if (pill != null)
                            {
                                switch ((pill.cupNumber + 3) % 4)
                                {
                                case 0:
                                    pillInside.NumMorn = pill.Amount;
                                    break;

                                case 1:
                                    pillInside.NumNoon = pill.Amount;
                                    break;

                                case 2:
                                    pillInside.NumEve = pill.Amount;
                                    break;

                                case 3:
                                    pillInside.NumNight = pill.Amount;
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }

                    listPillInside.Add(pillInside);
                }
            }
            var size = ProcessImageModelPill.SetNewImageSize(listImagePill);

            foreach (var item in listPillInside)
            {
                item.Model1 = ProcessImageModelPill.ResizePillModels(item.ImgModel1, size);
                item.Model2 = ProcessImageModelPill.ResizePillModels(item.ImgModel2, size);
            }
            return(listPillInside);
        }