public async Task ShouldUpdateBloodPressure() { var existingBloodPressure = new BloodPressure() { CreatedDate = new DateTime(2017, 1, 1), Systolic = 1, Diastolic = 3 }; _fakeLocalContext.BloodPressures.Add(existingBloodPressure); _fakeLocalContext.SaveChanges(); var newBloodPressures = new List <BloodPressure> { new BloodPressure() { CreatedDate = new DateTime(2017, 1, 1), Systolic = 2, Diastolic = 4 } }; await _healthRepository.UpsertAsync(newBloodPressures); Assert.Equal(2, existingBloodPressure.Systolic); Assert.Equal(4, existingBloodPressure.Diastolic); }
private void SaveBloodPressure(object sender, RoutedEventArgs e) { try { var bloodPressureDataRepository = new BloodPressureDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); var bloodPressure = new BloodPressure { PatientId = EHealthCareDesktopApp.Properties.Settings.Default.PatientID, When = dtPicker.SelectedDate.Value, Systolic = int.Parse(txtSystolic.Text.Trim()), Diastolic = int.Parse(txtDiastolic.Text.Trim()), Pulse = int.Parse(txtPulse.Text.Trim()), }; if (chkIrregularHeartBeat.IsChecked != null && (bool)chkIrregularHeartBeat.IsChecked) { bloodPressure.IrregularHeartbeat = true; } else { bloodPressure.IrregularHeartbeat = false; } bloodPressureDataRepository.SaveBloodPressure(bloodPressure); if (BloodPressureAddedEvent != null) { BloodPressureAddedEvent("Success"); } } catch (Exception ex) { if (BloodPressureAddedEvent != null) { BloodPressureAddedEvent(string.Format("Problem in adding BloodPressure Readings: {0}", ex.ToString())); } } }
/******************************************** * 函数名称:run() * 功能:患者组件执行函数 * 参数:无 * 返回值:无 * *****************************************/ public void run() { while (true) { if (Form1.stop) { this.EmptyingQueue(); return; } BloodPressure bp = (BloodPressure)(this.bloodPressureComponent); ////启动血压组件执行线程 //Thread bp_thread = new Thread(new ParameterizedThreadStart(bp.run)); //带1个参数传递的线程创建 //bp_thread.Start(1); bp.GeneratingBloodPressureData(); //生成血压数据 //bp.Component_send_queue.Enqueue(bp.BloodPressureData); bp.ComponentDataTransfer(bp); //传输血压数据 PortDataTransfer(this.output_ports[0]); //患者组件output端口继续将数据传输至另一组件input端口 Temperature temp = (Temperature)(this.temperatureComponent); ////启动体温组件执行线程 //Thread temp_thread = new Thread(new ParameterizedThreadStart(temp.run)); //带1个参数传递的线程创建 //temp_thread.Start(1); temp.GeneratingTemperatureData(); //生成体温数据 //temp.Component_send_queue.Enqueue(temp.TemperatureData); temp.ComponentDataTransfer(temp); //传输体温数据 PortDataTransfer(this.output_ports[1]); //患者组件output端口继续将数据传输至另一组件input端口 HeartRate hr = (HeartRate)(this.heartRateComponent); ////启动心率组件执行线程 //Thread hr_thread = new Thread(new ParameterizedThreadStart(hr.run)); //带1个参数传递的线程创建 //hr_thread.Start(1); hr.GeneratingHartRateData(); //生成心率数据 //hr.Component_send_queue.Enqueue(hr.HeartRateData); hr.ComponentDataTransfer(hr); //传输心率数据 PortDataTransfer(this.output_ports[2]); //患者组件output端口继续将数据传输至另一组件input端口 } }// public void run()
public void WhenHealthVaultBloodPressureTransformedToFhir_ThenCodeAndValuesEqual() { // ToDo, once deserialization is fixed on SDK, use Deserialize var bloodPressure = new BloodPressure(new HealthServiceDateTime(), 120, 60); var observation = bloodPressure.ToFhir() as Observation; Assert.IsNotNull(observation); Assert.IsNotNull(observation.Code); Assert.IsNotNull(observation.Code.Coding); Assert.AreEqual(2, observation.Code.Coding.Count); Assert.AreEqual(HealthVaultVocabularies.BloodPressure.Coding[0], observation.Code.Coding[0]); Assert.AreEqual(HealthVaultVocabularies.BloodPressure.Coding[1], observation.Code.Coding[1]); var components = observation.Component; Assert.AreEqual(2, components.Count); var systolic = components.FirstOrDefault(c => c.Code.Coding[0].Code == HealthVaultVitalStatisticsCodes.BloodPressureSystolic.Code); Assert.IsNotNull(systolic); var systolicValue = systolic.Value as Quantity; Assert.IsNotNull(systolicValue); Assert.AreEqual(120, systolicValue.Value); Assert.AreEqual(UnitAbbreviations.MillimeterOfMecury, systolicValue.Unit); var diastolic = components.FirstOrDefault(c => c.Code.Coding[0].Code == HealthVaultVitalStatisticsCodes.BloodPressureDiastolic.Code); Assert.IsNotNull(diastolic); var diastolicValue = diastolic.Value as Quantity; Assert.IsNotNull(diastolicValue); Assert.AreEqual(60, diastolicValue.Value); Assert.AreEqual(UnitAbbreviations.MillimeterOfMecury, diastolicValue.Unit); }
private void BuildMainLogs() { MainLogs = new ObservableCollection <MainLog>(); SQLiteConnection conn = new SQLiteConnection(Settings.DBPATH, SQLiteOpenFlags.ReadWrite, false); IEnumerable <DailyLog> logs = conn.Table <DailyLog>().Reverse(); foreach (DailyLog log in logs) { MainLog mainlog = new MainLog(); mainlog.DailyLogId = log.DailyLogID; mainlog.LogDateTime = log.LogDateTime; BloodPressure bp = GetLastBpReading(log.DailyLogID); if (bp != null) { mainlog.Bp = $"{bp.BPSystolic} / {bp.BPDiastolic}"; mainlog.Pulse = bp.BPPulseRate.ToString(); } Weight wt = GetLastWeightReading(log.DailyLogID); mainlog.WeightAmt = wt.WeightAmount.ToString(); MainLogs.Add(mainlog); } }
private void CreateObsMethod() { if (Prescriptions == null || Prescriptions.Equals("") || BloodPressure.Equals("0") || Weight.Equals("0")) { MaterialMessageBox.ShowError("Remplir les champs obligatoire de l'observation (poids, pression sanguine, prescription"); return; } Model.Observation obs = new Model.Observation() { bloodPressure = _bloodPressure, comment = Comment, date = Date, pictures = Pictures.ToArray(), prescription = Prescriptions.Split('\n'), weight = _weight }; int patientId = lastWindow.SelectedPatient.id; Observations.CreateObservation(patientId, obs); lastWindow.SelectedPatient.observations.Add(obs); lastWindow.SelectedObservation = obs; CloseWindow(); }
internal static Observation ToFhirInternal(BloodPressure bp, Observation observation) { if (bp.IrregularHeartbeatDetected.HasValue) { observation.AddExtension(HealthVaultVocabularies.IrregularHeartBeatExtensionName, new FhirBoolean(bp.IrregularHeartbeatDetected.Value)); } var diastolicComponent = new Observation.ComponentComponent { Code = HealthVaultVocabularies.GenerateCodeableConcept(HealthVaultVitalStatisticsCodes.BloodPressureDiastolic), Value = new Quantity((decimal)bp.Diastolic, UnitAbbreviations.MillimeterOfMecury) }; var systolicComponent = new Observation.ComponentComponent { Code = HealthVaultVocabularies.GenerateCodeableConcept(HealthVaultVitalStatisticsCodes.BloodPressureSystolic), Value = new Quantity((decimal)bp.Systolic, UnitAbbreviations.MillimeterOfMecury) }; observation.Component = new List <Observation.ComponentComponent> { diastolicComponent, systolicComponent }; if (bp.Pulse != null) { observation.Component.Add(new Observation.ComponentComponent { Code = HealthVaultVocabularies.GenerateCodeableConcept(HealthVaultVitalStatisticsCodes.HeartRate), Value = new Quantity((decimal)bp.Pulse, UnitAbbreviations.PerMinute) }); } observation.Effective = new FhirDateTime(bp.When.ToLocalDateTime().ToDateTimeUnspecified()); observation.Code = HealthVaultVocabularies.BloodPressure; return(observation); }
protected void SaveButton_Click(Object sender, EventArgs e) { try { DateTime selectedDate = DateTime.Parse(this.DateTextBox.Text); selectedDate = selectedDate.AddHours(this.HourList.SelectedValue.ToInt32()); selectedDate = selectedDate.AddMinutes(this.MinuteList.SelectedValue.ToInt32()); BloodPressure newEntry = new BloodPressure(); newEntry.Guid = Guid.NewGuid(); newEntry.UserGuid = this.Session.GetCurrentUser().Guid; newEntry.Date = selectedDate; newEntry.HeartRate = this.HeartRateTextBox.Text.ToInt32(); newEntry.Systolic = this.SystolicTextBox.Text.ToInt32(); newEntry.Diastolic = this.DiastolicTextBox.Text.ToInt32(); MyDataContext.Default.BloodPressures.AddObject(newEntry); MyDataContext.Default.SaveChanges(); } catch (Exception ex) { this.Master.ShowError(ex); } }
public static void Main(string[] args) { var patient = PatientBuilder .Initialize() .SetDateOfBirth(1952, 3, 31) .SetGender(GenderIdentity.NonBinaryXy) .SetMedicalRecordNumber("1234") .SetName("Joe", "Bob") .SetRace(Race.BlackOrAfricanAmerican) .Build(); Console.WriteLine($"Meet our patient: {patient}{NewLine}"); var vitals = VitalSignsBuilder.Initialize() .SetBloodPressure(168, 99, false) .SetOxygenSaturation(96) .SetPulseRate(105) .SetTemperature(101.2) .Build(); Console.WriteLine($"{patient.Name.First}'s vitals: {vitals}{NewLine}"); var bp = BloodPressure.Build(100, 66); Console.WriteLine($"If {patient.Name.First} used to have good blood pressure, it was {bp}.{NewLine}"); var bodyComposition = BodyCompositionBuilder .Initialize() .SetHeight(70.9) .SetHips(40) .SetWaist(34) .SetWeight(193) .Build(); Console.WriteLine($"Simple body composition measures: {bodyComposition}{NewLine}"); var bodyCompositionExpanded = BodyCompositionExpandedBuilder .Initialize() .SetBodyFatPercentage(16.5) .SetHeight(bodyComposition.Height.Inches) .SetHips(bodyComposition.Hips.Inches) .SetVisceralFat(70) .SetWaist(bodyComposition.Waist.Inches) .SetWeight(bodyComposition.Weight.Pounds) .Build(); Console.WriteLine($"Expanded body composition measures: {bodyCompositionExpanded}{NewLine}"); var quantitativeLabChoesterol = Quantitative.Serum.CholesterolTotal(300); Console.WriteLine($"Quantitative Lab: {quantitativeLabChoesterol}.{NewLine}"); var quantitativeLabHdlC = Quantitative.Serum.HighDensityLipoprotein(35); Console.WriteLine($"Quantitative Lab: {quantitativeLabHdlC}.{NewLine}"); var quantitativeLabLdlC = Quantitative.Serum.LowDensityLipoprotein(173); Console.WriteLine($"Quantitative Lab: {quantitativeLabLdlC}.{NewLine}"); var qualitativeLab = Qualitative.HepatitisCAntibody(QualitativeLabResult.Negative); Console.WriteLine($"Qualitative Lab: {qualitativeLab.Type}, Result: {qualitativeLab.Result}{NewLine}"); var cardioRegimen = CardiovascularRegimen.Build(3, 98.5, ExerciseIntensity.Moderate); Console.WriteLine($"Cardio regimen: {cardioRegimen}{NewLine}"); var stretchRegimen = StretchingRegimen.Build(1, 10, ExerciseIntensity.Low); Console.WriteLine($"Stretching regimen: {stretchRegimen}{NewLine}"); var resistanceRegimen = ResistanceRegimenBuilder .Initialize() .SetAverageSessionDuration(120) .SetIntensity(ExerciseIntensity.Moderate) .SetSecondsRestDurationPerSet(90) .SetSessionsPerWeek(6) .ConfirmUpperBodyTrained() .ConfirmPullingMovementsPerformed() .ConfirmPushingMovementsPerformed() .ConfirmRepetitionsToNearFailure() .Build(); Console.WriteLine($"Resistance regimen: {resistanceRegimen}{NewLine}"); var audiogramDataLeft = AudiogramDatasetBuilder .Initialize() .Set125HertzDataPoint(10) .Set250HertzDataPoint(20) .Set500HertzDataPoint(30) .Set1000HertzDataPoint(10) .Set2000HertzDataPoint(25) .Set3000HertzDataPoint(45) .Set4000HertzDataPoint(40) .Set6000HertzDataPoint(50) .Set8000HertzDataPoint(70) .Build(); var audiogramDataRight = AudiogramDatasetBuilder .Initialize() .Set125HertzDataPoint(10) .Set250HertzDataPoint(20) .Set500HertzDataPoint(30) .Set1000HertzDataPoint(10) .Set2000HertzDataPoint(25) .Set3000HertzDataPoint(45) .Set4000HertzDataPoint(40) .Set6000HertzDataPoint(50) .Set8000HertzDataPoint(90) .Build(); var audiogram = Audiogram.Build(audiogramDataLeft, audiogramDataRight); Console.WriteLine($"Audiogram{NewLine}{audiogram}{NewLine}"); var carotidLeft = CarotidUltrasoundResultBuilder .Initialize() .SetIntimaMediaThickeness(0.693) .Build(); var carotidRight = CarotidUltrasoundResultBuilder .Initialize() .SetIntimaMediaThickeness(0.732) .SetImtGrade(CarotidIntimaMediaThicknessGrade.Mild) .SetPercentStenosisGrade(CarotidPercentStenosisGrade.Nominal) .SetPlaqueCharacter(CarotidPlaqueCharacter.EarlyBuildup) .Build(); var carotidUs = CarotidUltrasound.Build(carotidLeft, carotidRight); Console.WriteLine($"Carotid US{NewLine}{carotidUs}{NewLine}"); var centralBp = CentralBloodPressureBuilder .Initialize() .SetAugmentedIndex(25) .SetAugmentedPressure(4) .SetCentralSystolicPressure(113) .SetPulsePressure(16) .SetPulseWaveVelocity(7.9) .SetReferenceAge(43) .Build(); Console.WriteLine($"Central BP: {centralBp}{NewLine}"); var functionalMovementScreen = FunctionalMovementScreenBuilder .Initialize() .SetActiveStraightLegRaise(2, 3) .SetDeepSquat(3) .SetHurdleStep(2, 2) .SetInlineLunge(3, 3) .SetRotaryStability(2, 2, true) .SetShoulderMobility(2, false, 2, false) .SetTrunkStabilityPuhsup(2, false) .Build(); Console.WriteLine($"Functional Movement Screen{NewLine}{functionalMovementScreen}{NewLine}"); var gripStrength = GripStrength.Build(123, 135); Console.WriteLine($"Grip strength {gripStrength}{NewLine}"); var ishiharaSix = IshiharaSixPlateScreenBuilder .Initialize() .SetPlate1(IshiharaAnswerResult.NormalVision) .SetPlate2(IshiharaAnswerResult.ColorVisionDefict) .SetPlate3(IshiharaAnswerResult.NormalVision) .SetPlate4(IshiharaAnswerResult.NormalVision) .SetPlate5(IshiharaAnswerResult.NormalVision) .SetPlate6(IshiharaAnswerResult.ColorVisionDefict) .Build(); Console.WriteLine("Ishihara Six Plate Screener"); Console.WriteLine($"{ishiharaSix}{NewLine}"); var ocularPressure = OccularPressure.Build(15, 13); Console.WriteLine($"Ocular pressure: {ocularPressure}{NewLine}"); var peripheralVision = PeripheralVision.Build(85, 85); Console.WriteLine($"Peripheral vision: {peripheralVision}{NewLine}"); var pushups = Pushups.Build(35); Console.WriteLine($"Pushups: {pushups}{NewLine}"); var sitAndReach = SitAndReach.Build(13); Console.WriteLine($"Sit & Reach: {sitAndReach}{NewLine}"); var situps = Situps.Build(55); Console.WriteLine($"Situps: {situps}{NewLine}"); var spirometry = SpirometryBuilder .Initialize() .SetForcedVitalCapacity(6.3) .SetForcedExpiratoryVolume1Second(5.5) .SetForcedExpiratoryFlow25To75(6.3) .SetForcedExpiratoryTime(7.5) .SetPeakExpiratoryFlow(9.3) .Build(); Console.WriteLine($"Spirometry: {spirometry}{NewLine}"); var treadmillStressTest = TreadmillExerciseStressTestBuilder .Initialize() .SetMaximumBloodPressure(205, 95) .SetMaximumHeartRate(183) .SetProtocol() .SetResult(TmstResult.Normal) .SetSupineBloodPressure(133, 82) .SetSupineHeartRate(66) .SetTime(11, 33) .Build(); Console.WriteLine($"Treadmill: {treadmillStressTest}{NewLine}"); var visualAcuity = VisualAcuity.Build(20, 20, 20); Console.WriteLine($"Visual acuity: {visualAcuity}{NewLine}"); var predictedMaxHrStd = PredictMaximumHeartRate.Standard(patient.Age); Console.WriteLine($"Joes predicted max HR (standard formula): {predictedMaxHrStd} bpm{NewLine}"); var predictedMaxHrRevisited = PredictMaximumHeartRate.Revisited(patient.Age); Console.WriteLine($"Joes predicted max HR (revisted formula): {predictedMaxHrRevisited} bpm{NewLine}"); var vo2Max = CalculateVo2Max.FromTreadmillStressTest(treadmillStressTest, patient); Console.WriteLine($"Joes VO2Max as calculated from his treadmill stress test: {vo2Max}{NewLine}"); var metsTreadmill = CalculateMetabolicEquivalents.FromTreadmillStressTest(treadmillStressTest, patient); Console.WriteLine($"Joes METS as calculated from his treadmill stress test: {metsTreadmill}{NewLine}"); var metsVo2Max = CalculateMetabolicEquivalents.FromVo2Max(vo2Max); Console.WriteLine($"Joes METS as calcualted from his VO2Max: {metsVo2Max}{NewLine}"); var cardioIniterp = new CardiovascularRegimenClassification(cardioRegimen); Console.WriteLine($"Cardio Regimen: {cardioIniterp}{NewLine}"); var resistanceInterp = new ResistanceRegimenClassification(resistanceRegimen); Console.WriteLine($"Resistance Regimen: {resistanceInterp}{NewLine}"); var stretchingInterp = new StretchingRegimenClassification(stretchRegimen); Console.WriteLine($"Stretching Regimen: {stretchingInterp}{NewLine}"); var audiogramInterpretation = new AudiogramClassification(audiogram); Console.WriteLine($"Audiogram Classification: {audiogramInterpretation}{NewLine}"); var bpInterpretation = new BloodPressureClassification(vitals.BloodPressure); Console.WriteLine($"BP Classification: {bpInterpretation}{NewLine}"); var bodyCompInterp = new BodyCompositionClassification( new BodyCompositionClassificationParameters(bodyCompositionExpanded, patient)); Console.WriteLine($"Body comp: {bodyCompInterp}{NewLine}"); var bodyCompExpandedInterp = new BodyCompositionExpandedClassification( new BodyCompositionExpandedClassificationParameters(bodyCompositionExpanded, patient)); Console.WriteLine($"Body comp expanded: {bodyCompExpandedInterp}{NewLine}"); var bmiInterp = new BodyMassIndexClassification(new BodyCompositionClassificationParameters(bodyComposition, patient)); Console.WriteLine($"BMI: {bmiInterp}{NewLine}"); var carotidUsInterp = new CarotidUltrasoundClassification(carotidUs); Console.WriteLine($"Carotid US: {carotidUsInterp}{NewLine}"); var centralBpInterp = new CentralBloodPressureClassification(new CentralBloodPressureParameters(centralBp, patient)); Console.WriteLine($"Central BP: {centralBpInterp}{NewLine}"); var fitScoreInterp = new FitTreadmillScoreClassification( new TreadmillExerciseStressTestClassificationParameters(treadmillStressTest, patient)); Console.WriteLine($"FIT Score: {fitScoreInterp}{NewLine}"); var fmsInterpretation = new FunctionalMovementScreenClassification(functionalMovementScreen); Console.WriteLine($"FMS{NewLine}{fmsInterpretation}{NewLine}"); var gripInterp = new GripStrengthClassification(new GripStrengthClassificationParameters(gripStrength, patient)); Console.WriteLine($"Grip strength: {gripInterp}{NewLine}"); var hipToWaistInterp = new HipToWaistClassification( new BodyCompositionClassificationParameters(bodyCompositionExpanded, patient)); Console.WriteLine($"Hip to Waist: {hipToWaistInterp}{NewLine}"); var ishiharaSixInterp = new IshiharaSixPlateClassification(ishiharaSix); Console.WriteLine($"Ishihara 6 Plate: {ishiharaSixInterp}{NewLine}"); var ocularPressureInterp = new OccularPressureClassification(ocularPressure); Console.WriteLine($"Ocular Pressure: {ocularPressureInterp}{NewLine}"); var percentBodyFatInterp = new PercentBodyFatClassification( new BodyCompositionExpandedClassificationParameters(bodyCompositionExpanded, patient)); Console.WriteLine($"Percent BF: {percentBodyFatInterp}{NewLine}"); var peripheralVisionInterp = new PeripheralVisionClassification(peripheralVision); Console.WriteLine($"Peripheral Vision: {peripheralVisionInterp}{NewLine}"); var pushupsInterp = new PushupsClassification(new PushupsClassificationParameters(pushups, patient)); Console.WriteLine($"Pushups: {pushupsInterp}{NewLine}"); var qualitativeLabInterp = new QualitativeLabClassification(qualitativeLab); Console.WriteLine($"Qualitative Lab: {qualitativeLabInterp}{NewLine}"); var quantLabInterpTotalChol = new QuantitativeLabClassification( new QuantitativeLabClassificationParameters(quantitativeLabChoesterol, patient)); Console.WriteLine($"Quantitative Lab: {quantLabInterpTotalChol}{NewLine}"); var quantLabInterpHdlC = new QuantitativeLabClassification( new QuantitativeLabClassificationParameters(quantitativeLabHdlC, patient)); Console.WriteLine($"Quantitative Lab: {quantLabInterpHdlC}{NewLine}"); var quantLabInterpLdlC = new QuantitativeLabClassification( new QuantitativeLabClassificationParameters(quantitativeLabLdlC, patient)); Console.WriteLine($"Quantitative Lab: {quantLabInterpLdlC}{NewLine}"); var sitAndReachInterp = new SitAndReachClassification(new SitAndReachClassificationParameters(sitAndReach, patient)); Console.WriteLine($"Sit & Reach: {sitAndReachInterp}{NewLine}"); var situpsInterp = new SitupsClassification(new SitupsClassificationParameters(situps, patient)); Console.WriteLine($"Situps: {situpsInterp}{NewLine}"); var spirometryInterp = new SpirometryClassification( new SpirometryClassificationParameters(spirometry, patient, bodyComposition)); Console.WriteLine($"Spirometry: {spirometryInterp}{NewLine}"); var visceralFatInterp = new VisceralFatClassification(bodyCompositionExpanded); Console.WriteLine($"Visceral fat: {visceralFatInterp}{NewLine}"); var visualAcuityInterp = new VisualAcuityClassification(visualAcuity); Console.WriteLine($"Visual Acuity: {visualAcuityInterp}{NewLine}"); var vo2MaxInterp = new Vo2MaxClassification(new Vo2MaxClassificationParameters(treadmillStressTest, patient)); Console.WriteLine($"VO2 Max: {vo2MaxInterp}{NewLine}"); var waistToHeightInterp = new WaistToHeightRatioClassification( new BodyCompositionClassificationParameters(bodyComposition, patient)); Console.WriteLine($"Waist to Height: {waistToHeightInterp}{NewLine}"); var pooledCohortParams = PooledCohortEquationParametersBuilder.Initialize() .SetBloodPressure(vitals.BloodPressure) .SetHdlCholesterol(quantitativeLabHdlC.Result) .SetTotalCholesterol(quantitativeLabChoesterol.Result) .SetPatient(patient) .ConfirmDiabetic() .ConfirmOnAntiHypertensiveMedication() .ConfirmSmoker() .Build(); var pooledCohortsEquation = new PooledCohortsEquation(pooledCohortParams); Console.WriteLine($"ASCVD 10yr-Risk%: {pooledCohortsEquation.Ascvd10YearRiskPercentage}{NewLine}"); Console.WriteLine($"ASCVD Lifetime Risk%: {pooledCohortsEquation.AscvdLifetimeRiskPercentage}{NewLine}"); var ascvd10YrInterp = new AscvdClassification(AscvdParameters.Build(patient, vitals.BloodPressure, quantitativeLabChoesterol, quantitativeLabLdlC, quantitativeLabHdlC)); Console.WriteLine($"ASCVD 10-Year Risk Classification{NewLine}{ascvd10YrInterp.Classification}{NewLine}"); }
/// <summary> /// 新增血压 /// </summary> /// <param name="entity"></param> public void Add(BloodPressure entity) { entity.Id = _idGenerator.CreateId(); entity.AddTime = DateTime.Now; _context.BloodPressures.Add(entity); }
public FakeBloodPressureInterpretation(BloodPressure bp) { _bp = bp; }
private static void RemoveBloodPressure(BloodPressureDto bloodPressureDto, VitalSign vitalSign, BloodPressure bloodPressure) { vitalSign.RemoveBloodPressure(bloodPressure); }
private static void ChangeBloodPressure(BloodPressureDto bloodPressureDto, VitalSign vitalSign, BloodPressure bloodPressure) { RemoveBloodPressure(bloodPressureDto, vitalSign, bloodPressure); AddBloodPressure(bloodPressureDto, vitalSign); }
public TreadmillExerciseStressTestBuilder SetMaximumBloodPressure(int systolic, int diastolic) { _maximumBloodPressure = BloodPressure.Build(systolic, diastolic); return(this); }
public VitalSignsBuilder SetBloodPressure(int systolic, int diastolic, bool endOrganDamage) { _bloodPressure = BloodPressure.Build(systolic, diastolic, endOrganDamage); return(this); }
public void GivenProperBloodPressure_ReturnsCorrectType() { var bpInterp = new BloodPressureInterpretation(BloodPressure.Build(175, 95)); Assert.IsType <BloodPressureInterpretation>(bpInterp); }
private async void readBloodPressureData() { kayChart dataChart = new kayChart(bloodPressureLineGraph, 60); dataChart.serieName = "Blood Pressure"; string path = "../../../Patient-Monitoring-System/data files/bloodPressureCSV.csv"; string line; try { StreamReader sr = new StreamReader(path); line = sr.ReadLine(); while (line != null) { string[] columns = line.Split(','); foreach (string column in columns) { if (run) { ReadingHandler readingHandler = new ReadingHandler(); double value = double.Parse(column); //add each value to database *DONT Delete* DateTime currentDate = DateTime.Now; DateTime currentTime = DateTime.Now; DBConnector dBConn = new DBConnector(); dBConn.connect(); BloodPressure bloodPressureData = new BloodPressure(); bloodPressureData.BloodPressureValue = value; bloodPressureData.BloodPressureDate = currentDate; bloodPressureData.BloodPressureTime = currentTime; BloodPressureHandler bloodPressureHandler = new BloodPressureHandler(); int result = bloodPressureHandler.addNewBloodPressure(dBConn.getConn(), bloodPressureData, BedsideLoginScreen.bedside_patient_id); if (result != 1) { MessageBox.Show("Insert Data failed"); } await Task.Delay(1500); await Task.Factory.StartNew(() => { dataChart.TriggeredUpdate(value); }); if (value == 0) { if (smsTrigger == 1) { if (!backgroundWorkerSendSMS.IsBusy) { backgroundWorkerSendSMS.RunWorkerAsync(); } } bloodPressureLineGraph.Series["Blood Pressure"].Color = Color.Red; bloodPressureCurrentValue.ForeColor = Color.Red; BedsideHandler bedsideHandler = new BedsideHandler(); int alarmResult = bedsideHandler.updateAlarmZeroStatus(dBConn.getConn(), BedsideLoginScreen.bedsideIDPass, 1); alarmZeroStatus = true; AlarmHandler alarmHandler = new AlarmHandler(); int specificId = alarmHandler.getSpecificId(dBConn.getConn(), value, "bloodpressure"); if (specificId > 0) { bool triggerStatus = alarmHandler.triggerAlarm(dBConn.getConn(), value, BedsideLoginScreen.bedside_patient_id, 0, specificId, "Blood Pressure"); if (triggerStatus) { listbloodPressure.Add(bloodPressureData); } } } else if (value >= double.Parse(maxBloodPressureLabel.Text) || value <= double.Parse(minBloodPressureLabel.Text)) { if (smsTrigger == 1) { if (!backgroundWorkerSendSMS.IsBusy) { backgroundWorkerSendSMS.RunWorkerAsync(); } } bloodPressureLineGraph.Series["Blood Pressure"].Color = Color.Yellow; bloodPressureCurrentValue.ForeColor = Color.Yellow; BedsideHandler bedsideHandler = new BedsideHandler(); int alarmResult = bedsideHandler.updateAlarmStatus(dBConn.getConn(), BedsideLoginScreen.bedsideIDPass, 1); alarmReadingStatus = true; int id = readingHandler.getIdAlarmTrigger(dBConn.getConn(), value); if (id > 0) { AlarmHandler alarmHandler = new AlarmHandler(); bool triggerStatus = alarmHandler.triggerAlarm(dBConn.getConn(), value, BedsideLoginScreen.bedside_patient_id, id, 0, "Blood Pressure"); if (triggerStatus) { listbloodPressure.Add(bloodPressureData); } } } else { bloodPressureLineGraph.Series["Blood Pressure"].Color = Color.Green; bloodPressureCurrentValue.ForeColor = Color.Green; } bloodPressureCurrentValue.Text = value.ToString() + "/80"; } else { break; } } line = sr.ReadLine(); } } catch (FileNotFoundException e) { MessageBox.Show(e.ToString()); Console.WriteLine(e.ToString()); } }
protected internal TreadmillExerciseStressTest() { Time = new TimeDuration(); SupineBloodPressure = new BloodPressure(); MaximumBloodPressure = new BloodPressure(); }
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); }
public ActionResult Calculate(BloodPressure b1) { b1.UserBloodPressure = b1.CalculateBloodPressurecategory(); return(View(b1)); }
/*************************************************************************** * 函数名称:treeView1_NodeMouseDoubleClick() * 功能:组件库列表表项鼠标双击事件,在graphControl绘图控制区创建相应组件 * 参数:sender;e * 返回值:无 * *************************************************************************/ private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); if (treeView1.SelectedNode.Level > 1) { string name; //int tabIndex = 0; //第一个选项卡 name = e.Node.Name.ToString(); switch (name) { //================================================================// //======================创建基本组件==============================// //================================================================// //B01 人体血压 case "BloodPressure": bloodPressure = new BloodPressure(this.graphControl, null, null, null); graphControl.AddShape(bloodPressure, bloodPressure.Location); break; //B02 人体体温 case "Temperature": temperature = new Temperature(this.graphControl, null, null, null); graphControl.AddShape(temperature, new PointF(temperature.Location.X, temperature.Location.Y + 80)); break; //B03 人体心率 case "HeartRate": heartRate = new HeartRate(this.graphControl, null, null, null); graphControl.AddShape(heartRate, new PointF(heartRate.Location.X, heartRate.Location.Y + 160)); break; //B04 血压传感器 case "BloodPressureSensor": bloodPressureSensor = new BloodPressureSensor(this.graphControl, null, null, null); graphControl.AddShape(bloodPressureSensor, new PointF(bloodPressureSensor.Location.X + 110, bloodPressureSensor.Location.Y)); break; //B05 体温传感器 case "TemperatureSensor": temperatureSensor = new TemperatureSensor(this.graphControl, null, null, null); graphControl.AddShape(temperatureSensor, new PointF(temperatureSensor.Location.X + 110, temperatureSensor.Location.Y + 80)); break; //B06 心率传感器 case "HeartRateSensor": heartRateSensor = new HeartRateSensor(this.graphControl, null, null, null); graphControl.AddShape(heartRateSensor, new PointF(heartRateSensor.Location.X + 110, heartRateSensor.Location.Y + 160)); break; //B07 显示控制器 case "DisplayController": displayController = new DisplayController(this.graphControl, null, null, null); graphControl.AddShape(displayController, new PointF(displayController.Location.X + 220, displayController.Location.Y)); break; //B08 音频控制器 case "AudioController": audioController = new AudioController(this.graphControl, null, null, null); graphControl.AddShape(audioController, new PointF(audioController.Location.X + 220, audioController.Location.Y + 80)); break; //B09 电机控制器 case "ElectricMachineryController": electricMachineryController = new ElectricMachineryController(this.graphControl, null, null, null); graphControl.AddShape(electricMachineryController, new PointF(electricMachineryController.Location.X + 220, electricMachineryController.Location.Y + 160)); break; //B10 运算器 微处理器 case "MicroProcessor": microProcessor = new MicroProcessor(this.graphControl, null, null, null); graphControl.AddShape(microProcessor, new PointF(microProcessor.Location.X + 330, microProcessor.Location.Y)); break; //B11 协议转换器 case "ProtocolConverter": protocolConverter = new ProtocolConverter(this.graphControl, null, null, null); graphControl.AddShape(protocolConverter, new PointF(protocolConverter.Location.X + 330, protocolConverter.Location.Y + 70)); break; //B12 数据处理器 case "DataProcessor": dataProcessor = new DataProcessor(this.graphControl, null, null, null); graphControl.AddShape(dataProcessor, new PointF(dataProcessor.Location.X + 330, dataProcessor.Location.Y + 160)); break; //B13 数据分析器 case "DataAnalyzer": dataAnalyzer = new DataAnalyzer(this.graphControl, null, null, null); graphControl.AddShape(dataAnalyzer, new PointF(dataAnalyzer.Location.X + 330, dataAnalyzer.Location.Y + 240)); break; //B14 有线通信模块 case "WiredModule": wiredModule = new WiredModule(this.graphControl, null, null, null); graphControl.AddShape(wiredModule, new PointF(wiredModule.Location.X + 440, wiredModule.Location.Y)); break; //B15 无线通信模块 case "WirelessModule": wirelessModule = new WirelessModule(this.graphControl, null, null, null); graphControl.AddShape(wirelessModule, new PointF(wirelessModule.Location.X + 440, wirelessModule.Location.Y + 80)); break; //B16 有线媒介 case "WiredMedia": wiredMedia = new WiredMedia(this.graphControl, null, null, null); graphControl.AddShape(wiredMedia, new PointF(wiredMedia.Location.X + 440, wiredMedia.Location.Y + 160)); break; //B17 无线媒介 case "WirelessMedia": wirelessMedia = new WirelessMedia(this.graphControl, null, null, null); graphControl.AddShape(wirelessMedia, new PointF(wirelessMedia.Location.X + 440, wirelessMedia.Location.Y + 240)); break; //18 寄存器 case "Register": register = new Register(this.graphControl, null, null, null); graphControl.AddShape(register, new PointF(register.Location.X + 550, register.Location.Y)); break; //B19 存储器RAM case "RAM": ram = new RAM(this.graphControl, null, null, null); graphControl.AddShape(ram, new PointF(ram.Location.X + 550, ram.Location.Y + 80)); break; //B20 存储器ROM case "ROM": rom = new ROM(this.graphControl, null, null, null); graphControl.AddShape(rom, new PointF(rom.Location.X + 550, rom.Location.Y + 160)); break; //B21 数据存储器 case "DataMemory": dataMemory = new DataMemory(this.graphControl, null, null, null); graphControl.AddShape(dataMemory, new PointF(dataMemory.Location.X + 550, dataMemory.Location.Y + 240)); break; //B22 缓冲区 case "Buffer": buffer = new MyBuffer(this.graphControl, null, null, null); graphControl.AddShape(buffer, new PointF(buffer.Location.X + 550, buffer.Location.Y + 320)); break; //B23 路由模块 case "RouteModule": routeModule = new RouteModule(this.graphControl, null, null, null); graphControl.AddShape(routeModule, new PointF(routeModule.Location.X + 330, routeModule.Location.Y + 320)); break; //B24 监控器 case "Monitor": monitor = new MyMonitor(this.graphControl, null, null, null); graphControl.AddShape(monitor, new PointF(monitor.Location.X + 220, monitor.Location.Y + 240)); break; //B25 血压监控器 case "BloodPressureMonitor": bpMonitor = new BloodPressureMonitor(this.graphControl, null, null, null); graphControl.AddShape(bpMonitor, new PointF(bpMonitor.Location.X + 220, bpMonitor.Location.Y + 280)); break; //B26 体温监控器 case "TemperatureMonitor": tempMonitor = new TemperatureMonitor(this.graphControl, null, null, null); graphControl.AddShape(tempMonitor, new PointF(tempMonitor.Location.X + 220, tempMonitor.Location.Y + 320)); break; //B27 心率监控器 case "HeartRateMonitor": hrMonitor = new HeartRateMonitor(this.graphControl, null, null, null); graphControl.AddShape(hrMonitor, new PointF(hrMonitor.Location.X + 220, hrMonitor.Location.Y + 360)); break; //====================================================================// //======================CMIoT组件库中组件=============================// //====================================================================// //C01 患者组件 case "Patient": patient = new Patient(this.graphControl); graphControl.AddShape(patient, patient.Location); break; //C02 血压传感节点 case "BloodPressureSensorNode": BPSN = new BloodPressureSensorNode(this.graphControl); //BPSN_InsideForm = new InsideForm(BPSN); //构建内部结构 graphControl.AddShape(BPSN, BPSN.Location); break; //C03 体温传感节点 case "TemperatureSensorNode": TSN = new TemperatureSensorNode(this.graphControl); graphControl.AddShape(TSN, TSN.Location); break; //C04 心率传感节点 case "HeartRateSensorNode": HRSN = new HeartRateSensorNode(this.graphControl); graphControl.AddShape(HRSN, HRSN.Location); break; //C05 物联网网关 case "IoTGateway": IoTG = new IoTGateway(this.graphControl); graphControl.AddShape(IoTG, IoTG.Location); break; //C06 802.11信道组件 case "802.11Channel": channel_802_11 = new Channel802_11(this.graphControl, null, null, null); graphControl.AddShape(channel_802_11, channel_802_11.Location); break; //C07 802.15.1信道组件 case "802.15.1Channel": channel802_15_1 = new Channel802_15_1(this.graphControl, null, null, null); graphControl.AddShape(channel802_15_1, channel802_15_1.Location); break; //C08 802.15.4信道组件 case "802.15.4Channel": channel802_15_4 = new Channel802_15_4(this.graphControl, null, null, null); graphControl.AddShape(channel802_15_4, channel802_15_4.Location); break; //C09 Ethernet信道组件 case "EthernetChannel": channel_ethernet = new ChannelEthernet(this.graphControl, null, null, null); graphControl.AddShape(channel_ethernet, channel_ethernet.Location); break; //C10 IPv6路由器组件 case "IPv6Router": ipv6Router = new IPv6Router(this.graphControl); graphControl.AddShape(ipv6Router, ipv6Router.Location); break; //C11 医疗服务器组件 case "MedicalServer": MS = new MedicalServer(this.graphControl); graphControl.AddShape(MS, MS.Location); break; } } // if (treeView1.SelectedNode.Level > 1) } //treeView1_NodeMouseDoubleClick
} //private void Run_Click(object sender, EventArgs e) /*********************************************** * 函数名称:ComponentsStartRun() * 功能:依据组件类型启动执行相应的组件 * 参数:component 相应启动执行的组件 * 返回值:无 * **********************************************/ private void ComponentsStartRun(Component component) { // 若组件为B01:血压组件 if (component.GetType().Name == "BloodPressure") { bloodPressure = (BloodPressure)component; int x = 1; //设定血压数据获取方式 //创建生成血压数据的线程 //Thread GeneratingBPData_thread = new Thread(bloodPressure.GeneratingBloodPressureData); //不带参数创建Thread //GeneratingBPData_thread.Start(); //启动线程 Thread bp_thread = new Thread(new ParameterizedThreadStart(bloodPressure.run)); //带1个参数传递的线程创建 bp_thread.Start(x); } // 若组件为B02:体温组件 else if (component.GetType().Name == "Temperature") { temperature = (Temperature)component; int x = 1; //设定体温数据获取方式 //创建生成体温数据的线程 Thread temp_thread = new Thread(new ParameterizedThreadStart(temperature.run)); //带1个参数传递的线程创建 temp_thread.Start(x); } // 若组件为B03:心率组件 else if (component.GetType().Name == "HeartRate") { heartRate = (HeartRate)component; int x = 1; //设定心率数据获取方式 //创建生成心率数据的线程 Thread hr_thread = new Thread(new ParameterizedThreadStart(heartRate.run)); //带1个参数传递的线程创建 hr_thread.Start(x); } // 若组件为B04:血压传感器组件 else if (component.GetType().Name == "BloodPressureSensor") { bloodPressureSensor = (BloodPressureSensor)component; //创建血压传感器执行的线程 Thread bps_thread = new Thread(bloodPressureSensor.run); bps_thread.Start(); } // 若组件为B07:显示控制器组件 else if (component.GetType().Name == "DisplayController") { displayController = (DisplayController)component; displayController.run(); } //若组件为B10:微处理器组件 else if (component.GetType().Name == "MicroProcessor") { microProcessor = (MicroProcessor)component; //int x = 1; //设定封装为6LoWPAN报文格式 string x = "6LoWPAN"; //设定封装为6LoWPAN报文格式 //创建微处理器执行的线程 Thread mp_thread = new Thread(new ParameterizedThreadStart(microProcessor.run)); mp_thread.Start(x); } // 若组件为B24:监控器器组件 else if (component.GetType().Name == "MyMonitor") { MyMonitor myMonitor = (MyMonitor)component; myMonitor.run(); } //若组件为B25:血压监控器 else if (component.GetType().Name == "BloodPressureMonitor") { BloodPressureMonitor bpMonitor = (BloodPressureMonitor)component; bpMonitor.run(); } //若组件为B26:体温监控器 else if (component.GetType().Name == "TemperatureMonitor") { TemperatureMonitor tempMonitor = (TemperatureMonitor)component; tempMonitor.run(); } //B27 心率监控器 else if (component.GetType().Name == "HeartRateMonitor") { HeartRateMonitor hrMonitor = (HeartRateMonitor)component; hrMonitor.run(); } // 若组件为C01:患者组件 else if (component.GetType().Name == "Patient") { patient = (Patient)component; //创建患者组件执行的线程 Thread patient_thread = new Thread(patient.run); //不带参数创建Thread patient_thread.Start(); //启动线程 //+++++++++++++++++++ Debug +++++++++++++++++++++++++++++++++// //foreach (int[] arr in patient.output_ports[0].Port_queue1) //{ // Console.WriteLine("血压数据:" + arr[0] + " " + arr[1]); //} //foreach (double arr in patient.output_ports[1].Port_queue1) //{ // Console.WriteLine("体温数据:" + arr); //} //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// } //若组件为C02:血压传感节点组件 else if (component.GetType().Name == "BloodPressureSensorNode") { BPSN = (BloodPressureSensorNode)component; //创建血压传感节点组件的线程 Thread bpsn_thread = new Thread(BPSN.run); //不带参数创建Thread bpsn_thread.Start(); //启动线程 } //若组件为C03:体温传感节点组件 else if (component.GetType().Name == "TemperatureSensorNode") { TSN = (TemperatureSensorNode)component; //创建体温传感节点组件的线程 Thread tsn_thread = new Thread(TSN.run); //不带参数创建Thread tsn_thread.Start(); //启动线程 } //若组件为C04:心率传感节点组件 else if (component.GetType().Name == "HeartRateSensorNode") { HRSN = (HeartRateSensorNode)component; //创建心率传感节点组件的线程 Thread hrsn_thread = new Thread(HRSN.run); //不带参数创建Thread hrsn_thread.Start(); //启动线程 } //若为C05:物联网网关组件 else if (component.GetType().Name == "IoTGateway") { IoTG = (IoTGateway)component; //创建物联网网关组件执行的线程 Thread gateway_thread = new Thread(IoTG.run); gateway_thread.Start(); } //若为C07:802.15.1Channel组件 else if (component.GetType().Name == "Channel802_15_1") { channel802_15_1 = (Channel802_15_1)component; //创建802.15.1Channel组件执行的线程 Thread channel_802151_thread = new Thread(channel802_15_1.run); channel_802151_thread.Start(); } //若为C08:802.15.4Channel组件 else if (component.GetType().Name == "Channel802_15_4") { channel802_15_4 = (Channel802_15_4)component; //创建802.15.4Channel组件执行的线程 Thread channel_802154_thread = new Thread(channel802_15_4.run); channel_802154_thread.Start(); } //若为C09:Ethernet信道组件 else if (component.GetType().Name == "ChannelEthernet") { channel_ethernet = (ChannelEthernet)component; //创建EthernetChannel组件执行的线程 Thread channel_ethernet_thread = new Thread(channel_ethernet.run); channel_ethernet_thread.Start(); } //若为C10:IPv6路由器组件 else if (component.GetType().Name == "IPv6Router") { ipv6Router = (IPv6Router)component; //创建IPv6Router组件执行的线程 Thread ipv6_router_thread = new Thread(ipv6Router.run); ipv6_router_thread.Start(); } //若为C11:医疗服务器组件 else if (component.GetType().Name == "MedicalServer") { MS = (MedicalServer)component; //创建MedicalServer组件执行线程 Thread ms_thread = new Thread(MS.run); ms_thread.Start(); } }
public BloodPressureInterpretation(BloodPressure parameters) { _parameters = parameters ?? throw new ArgumentNullException(nameof(parameters)); _stage = new BloodPressureClassification(_parameters).Classification.Stage; }
public IHttpActionResult Post(BloodPressure value) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (value.source == null || value.humanId == null) { return(BadRequest()); } using (var dbContextTransaction = db.Database.BeginTransaction()) { try { tSourceService sourceServiceObj = db.tSourceServices .SingleOrDefault(x => x.ServiceName == value.source && x.SourceID == 5); if (sourceServiceObj == null) { sourceServiceObj = new tSourceService(); sourceServiceObj.ServiceName = value.source; sourceServiceObj.TypeID = 2; //Wellness sourceServiceObj.SourceID = 5; //HumanAPI db.tSourceServices.Add(sourceServiceObj); } tUserSourceService userSourceServiceObj = null; //Get credentials tCredential credentialObj = db.tCredentials.SingleOrDefault(x => x.SourceID == 5 && x.SourceUserID == value.humanId && x.SystemStatusID == 1); if (credentialObj == null) { throw new NoUserCredentialsException("Unable to find any matching HAPI user credentials"); } else { userSourceServiceObj = db.tUserSourceServices.SingleOrDefault( x => x.SourceServiceID == sourceServiceObj.ID && x.CredentialID == credentialObj.ID && x.SystemStatusID == 1); if (userSourceServiceObj == null) { userSourceServiceObj = new tUserSourceService(); userSourceServiceObj.SourceServiceID = sourceServiceObj.ID; userSourceServiceObj.UserID = credentialObj.UserID; userSourceServiceObj.CredentialID = credentialObj.ID; userSourceServiceObj.ConnectedOnDateTime = DateTime.Now; userSourceServiceObj.LastSyncDateTime = DateTime.Now; userSourceServiceObj.LatestDateTime = value.updatedAt; userSourceServiceObj.StatusID = 3; //connected userSourceServiceObj.SystemStatusID = 1; //valid userSourceServiceObj.tCredential = credentialObj; db.tUserSourceServices.Add(userSourceServiceObj); } else { //update LatestDateTime to the most recent datetime if (userSourceServiceObj.LatestDateTime == null || userSourceServiceObj.LatestDateTime < value.updatedAt) { userSourceServiceObj.LatestDateTime = value.updatedAt; } } } string[] vitalNameArray = { "Systolic Blood Pressure", "Diastolic Blood Pressure", "Heart Rate" }; List <tUserVital> userVitalsArray = new List <tUserVital>(); foreach (string vitalNameItem in vitalNameArray) { tUserVital userVital = null; userVital = db.tUserVitals .SingleOrDefault(x => x.SourceObjectID == value.id && x.Name == vitalNameItem); if (userVital == null) { userVital = new tUserVital(); userVital.tUserSourceService = userSourceServiceObj; userVital.UserID = credentialObj.UserID; userVital.SourceObjectID = value.id; userVital.UserSourceServiceID = sourceServiceObj.ID; userVital.Name = vitalNameItem; switch (vitalNameItem) { case "Systolic Blood Pressure": userVital.Value = decimal.Parse(value.systolic); userVital.UOMID = 470; //mmHg break; case "Diastolic Blood Pressure": userVital.Value = decimal.Parse(value.diastolic); userVital.UOMID = 470; //mmHg break; case "Heart Rate": userVital.Value = decimal.Parse(value.heartRate); userVital.UOMID = 30; //bpm break; } //Dates DateTimeOffset dtoStart; if (RESTfulBAL.Models.DynamoDB.Utilities.ConvertToDateTimeOffset(value.timestamp, value.tzOffset, out dtoStart)) { userVital.ResultDateTime = dtoStart; } else { userVital.ResultDateTime = value.timestamp; } userVital.SystemStatusID = 1; db.tUserVitals.Add(userVital); } else { userVital.Name = vitalNameItem; switch (vitalNameItem) { case "Systolic Blood Pressure": userVital.Value = decimal.Parse(value.systolic); userVital.UOMID = 470; //mm[Hg] break; case "Diastolic Blood Pressure": userVital.Value = decimal.Parse(value.diastolic); userVital.UOMID = 470; //mm[Hg] break; case "Heart Rate": userVital.Value = decimal.Parse(value.heartRate); userVital.UOMID = 30; //bpm break; } //Dates DateTimeOffset dtoStart; if (RESTfulBAL.Models.DynamoDB.Utilities.ConvertToDateTimeOffset(value.timestamp, value.tzOffset, out dtoStart)) { userVital.ResultDateTime = dtoStart; } else { userVital.ResultDateTime = value.timestamp; } userVital.LastUpdatedDateTime = DateTime.Now; userVital.tUserSourceService = userSourceServiceObj; } userVitalsArray.Add(userVital); } db.SaveChanges(); dbContextTransaction.Commit(); return(Ok(userVitalsArray)); } catch (Exception ex) { dbContextTransaction.Rollback(); //Insert Error Log tUserDataErrLog userErrorLog = new tUserDataErrLog(); userErrorLog.ErrTypeID = (int)ErrorLogging.enumErrorType.Application; userErrorLog.ErrSourceID = (int)AuditLogging.enumApplication.SFCBAL; userErrorLog.Code = ex.HResult.ToString(); userErrorLog.Description = ex.Message; userErrorLog.Trace = ex.StackTrace; dbErr.tUserDataErrLogs.Add(userErrorLog); dbErr.SaveChanges(); string ErrMsg = "An error occured and we have logged the error. Please try again later."; Exception Err = new Exception(ErrMsg, ex); return(InternalServerError(Err)); } } }
public BloodPressureClassification(BloodPressure parameters) { _parameters = parameters ?? throw new ArgumentNullException(nameof(parameters)); }
// Register the type on the generic ThingToFhir partial class public static Observation ToFhir(this BloodPressure bp) { return(BloodPressureToFhir.ToFhirInternal(bp, ToFhirInternal <Observation>(bp))); }
/// <summary> /// 新增血压 /// </summary> /// <param name="bloodPressure"></param> public void Add(BloodPressure bloodPressure) { bloodPressure.Id = _idGenerator.CreateId(); _context.BloodPressure.Add(bloodPressure); }
public void GivenProperBloodPressure_ReturnsNonEmptyString() { var bpInterp = new BloodPressureInterpretation(BloodPressure.Build(175, 95)); Assert.NotEmpty(bpInterp.ToString()); }
public void PostBloodPressure(BloodPressure measurement) { _context.bloodPressures.Add(measurement); _context.SaveChanges(); }
public void TestMethod1() { BloodPressure test = new BloodPressure(); }