예제 #1
0
        private void listViewTests_MouseUp(object sender, MouseEventArgs e)
        {
            if (this.order != null)
            {
                if (this.listViewTests.SelectedItems.Count > 0)
                {
                    int testCode = Convert.ToInt32(this.listViewTests.SelectedItems[0].Tag);
                    this.currentTestCode = testCode;
                    LabTestResults results = LabTestResultDAL.GetResults(this.order.OrderId, testCode);

                    if (results != null)
                    {
                        this.currentTestHasResults    = true;
                        this.textBoxResults.Text      = results.Results;
                        this.checkBoxAbnormal.Checked = results.IsAbnormal;
                        this.dateTimePickerTest.Value = results.TakenOn;
                    }
                    else
                    {
                        this.currentTestHasResults = false;
                        this.resetResults();
                    }
                }
            }
        }
        public async Task MultipleThingTypes()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            IThingClient thingClient = connection.CreateThingClient();
            PersonInfo   personInfo  = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            await DeletePreviousThings(thingClient, record);

            LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime;

            var bloodGlucose = new BloodGlucose(
                new HealthServiceDateTime(nowLocal),
                new BloodGlucoseMeasurement(
                    4.2,
                    new DisplayValue(4.2, "mmol/L", "mmol-per-l")),
                new CodableValue("Whole blood", "wb", new VocabularyKey("glucose-measurement-type", "wc", "1")));

            var weight = new Weight(
                new HealthServiceDateTime(nowLocal),
                new WeightValue(81, new DisplayValue(81, "KG", "kg")));

            var bloodPressure1 = new BloodPressure
            {
                EffectiveDate = nowLocal,
                Systolic      = 110,
                Diastolic     = 90,
            };

            var bloodPressure2 = new BloodPressure
            {
                EffectiveDate = nowLocal.PlusHours(-1),
                Systolic      = 111,
                Diastolic     = 91,
            };

            var cholesterolProfile = new CholesterolProfileV2
            {
                When         = new HealthServiceDateTime(nowLocal),
                LDL          = new ConcentrationMeasurement(110),
                HDL          = new ConcentrationMeasurement(65),
                Triglyceride = new ConcentrationMeasurement(140)
            };

            var labTestResult = new LabTestResults(new LabTestResultGroup[] { new LabTestResultGroup(new CodableValue("test")) });

            var immunization = new Immunization(new CodableValue("diphtheria, tetanus toxoids and acellular pertussis vaccine", "DTaP", new VocabularyKey("immunizations", "wc", "1")));

            var procedure = new Procedure(new CodableValue("A surgery"));

            var allergy = new Allergy(new CodableValue("Pollen"));

            var condition = new Condition(new CodableValue("Diseased"));

            await thingClient.CreateNewThingsAsync(
                record.Id,
                new List <IThing>
            {
                bloodGlucose,
                weight,
                bloodPressure1,
                bloodPressure2,
                cholesterolProfile,
                labTestResult,
                immunization,
                procedure,
                allergy,
                condition
            });

            var             query           = CreateMultiThingQuery();
            ThingCollection thingCollection = await thingClient.GetThingsAsync(record.Id, query);

            Assert.AreEqual(10, thingCollection.Count);

            var returnedBloodGlucose = (BloodGlucose)thingCollection.First(t => t.TypeId == BloodGlucose.TypeId);

            Assert.AreEqual(bloodGlucose.Value.Value, returnedBloodGlucose.Value.Value);

            var returnedWeight = (Weight)thingCollection.First(t => t.TypeId == Weight.TypeId);

            Assert.AreEqual(weight.Value.Kilograms, returnedWeight.Value.Kilograms);

            var returnedBloodPressures = thingCollection.Where(t => t.TypeId == BloodPressure.TypeId).Cast <BloodPressure>().ToList();

            Assert.AreEqual(2, returnedBloodPressures.Count);

            Assert.AreEqual(bloodPressure1.Systolic, returnedBloodPressures[0].Systolic);
        }