Ejemplo n.º 1
0
        /// <summary>
        /// printLabels, insert the order to the database and then sendHL7
        /// </summary>
        /// <param name="orderData"></param>
        protected void printInsertAndSendHL7(ImmutableOrderData orderData)
        {
            printLabels(orderData, this.ComboboxPrinter.Text, setupTableData, orderedTests, TestPrintMode());

            var testsToSend = orderData.getDiTests().tests;

            var dict = testsToSend.GroupBy(x =>
                //group test DataRows by the SpecimenType
                new SpecimenType { extension = x.Key["Extension"].ToString(), diSpecimenType = x.Key["DiTranslation"].ToString() })
                .ToDictionary(gdc => gdc.Key,
                //convert to a Dictionary<SpecimenType,List<String>> where List<string> is the list of testIDs
                //, but those testIDs are all IndividualTests and not group Tests
                gdc => groupTestToIndividualTest.getUniqueUnsentIndividualTests(
                    //pass list of (string TestId,bool Sent) to getUniqueUnsentIndividualTests
                    gdc.Select(q => new Tuple2<string,bool>(q.Key["Id"].ToString(), q.Value ))
                    )
                );

            //send the HL7
            sendHL7(orderData.mrn, orderData.firstName,
              orderData.lastName, orderData.orderNumber, orderData.ward,
              dict);

            orderData.setTestsAsSentInDb(testsToSend.Select(dr=>dr.Key["Id"].ToString())).InsertOrder(getSqlServer); //update data about the order in the DB
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Print collection, comment, and (collection or aliquot) labels
        /// </summary>
        protected static void printLabels(ImmutableOrderData immutableOrderData, string printer, 
            SetupTableData setupTableData, IEnumerable<DataRow> orderedTests, LabelPrintMode testPrintMode)
        {
            Func<LabelData, LabelData> configureLabels = labelData =>
               {  //print collection label
                   //print collection label
                   labelData.LabelAppendDemographic(immutableOrderData.collectionTime, "", "");
                   labelData.LabelAppendDemographic(immutableOrderData.collectionTime, "", "");
                   //print comment label
                   labelData.LabelAppendComment(immutableOrderData.comment, "CMT", "");

                   var testBySpecimen = orderedTests.GroupBy(x =>
                       //group test DataRows by the SpecimenType
              new Tuple2<string,string> (x["Tube"].ToString(),  x["Extension"].ToString() ))
              .ToDictionary(
                grouped => grouped.Key,
                grouped => grouped.ToList().Select(dr => dr["Id"].ToString()).mkString(" ")
              );
                   testBySpecimen.forEach(specimenTest =>
                        labelData.AppendTestLabel(immutableOrderData.getPriority,
                        testPrintMode, specimenTest.Value,
                       specimenTest.Key._1, specimenTest.Key._2));

                   return labelData;
               };

               _printLabels(immutableOrderData, printer, setupTableData, configureLabels);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Print collection, comment, and (collection or aliquot) labels
        /// </summary>
        private static void _printLabels(ImmutableOrderData immutableOrderData, string printer,
            SetupTableData setupTableData, Func<LabelData,LabelData> configureLabels)
        {
            //PrintDowntimeLabels
            var labelData = new LabelData(immutableOrderData.orderNumber, immutableOrderData.priority,
                immutableOrderData.mrn, immutableOrderData.lastName, immutableOrderData.firstName, immutableOrderData.ward);

               configureLabels(labelData).doPrint(printer, setupTableData);
        }
Ejemplo n.º 4
0
        protected static void printDemographicLabelsOnly(ImmutableOrderData immutableOrderData, string printer,
            SetupTableData setupTableData)
        {
            Func<LabelData,LabelData> configureLabels = labelData =>
            {  //print collection label
                labelData.LabelAppendDemographic(immutableOrderData.collectionTime, "", "");
                labelData.LabelAppendDemographic(immutableOrderData.collectionTime, "", "");
                return labelData;
            };

            _printLabels(immutableOrderData, printer, setupTableData, configureLabels);
        }