public IActionResult AddVitalSigns([FromBody] VitalSignsViewModel vitalSigns) { if (ModelState.IsValid) { var claim = HttpContext?.User.Claims.ToArray(); var username = claim[0].Value.ToString(); long userDetailsID = context.UserDetails.Where(u => u.Username == username).SingleOrDefault().UserDetailsID; var patientId = vitalSigns.PatientID; var visitId = context.Visits.Where(v => v.PatientID == patientId) .Where(v => v.Current == 1).FirstOrDefault().VisitId; var vitals = new VitalSigns { Temperature = vitalSigns.Temperature, Pulse = vitalSigns.Pulse, Respiration = vitalSigns.Respiration, BloodPressure = vitalSigns.BloodPressure, OxygenSaturation = vitalSigns.OxygenSaturation, Date = DateTime.Now, UserDetailsID = userDetailsID, VisitId = visitId }; context.VitalSigns.Add(vitals); context.SaveChanges(); return(Ok(vitals)); } return(BadRequest()); }
private static JArray CreateJsonResponse(HealthRecordItemCollection items) { JObject result = new JObject(); JObject resultObj = new JObject(); JArray itemArr = new JArray(); if (items != null) { foreach (HealthRecordItem item in items) { VitalSigns vitalSign = (VitalSigns)item; JObject itemV = new JObject(); itemV["unit"] = "°C"; itemV["temperature"] = vitalSign.VitalSignsResults[0].Value; itemV["time"] = vitalSign.EffectiveDate.ToUniversalTime(); itemArr.Add(itemV); } } result["count"] = items.Count(); result["result"] = itemArr; if (itemArr.Count > 0) { resultObj["status"] = "ok"; resultObj["getWeightResponse"] = result; return(itemArr); } else { resultObj["status"] = "no content"; resultObj["getWeightResponse"] = result; return(itemArr); } }
public void WhenHealthVaultVitalSignsTransformedToFhir_ThenCodeAndContainedResourceEqual() { var vitalSignsResult = new VitalSignsResultType(new CodableValue("pls")); vitalSignsResult.Value = 70; vitalSignsResult.Unit = new CodableValue("bpm"); vitalSignsResult.ReferenceMinimum = 0; vitalSignsResult.ReferenceMaximum = 150; var vitalSigns = new VitalSigns(new HealthServiceDateTime()); vitalSigns.VitalSignsResults.Add(vitalSignsResult); var observation = vitalSigns.ToFhir() as Observation; Assert.IsNotNull(observation); Assert.AreEqual(HealthVaultVocabularies.VitalSigns, observation.Code); Assert.IsTrue(observation.Category.Contains(FhirCategories.VitalSigns)); //Assert.AreEqual(vitalSigns.When.ToLocalDateTime().ToDateTimeUnspecified(), observation.Effective); Assert.IsNotNull(observation.Contained); Assert.AreEqual(observation.Contained.Count, vitalSigns.VitalSignsResults.Count); var observationResult = observation.Contained[0] as Observation; var resultValue = observationResult.Value as Quantity; Assert.AreEqual(vitalSignsResult.Value.Value, (double)resultValue.Value.Value); //Assert.AreEqual(vitalSignsResult.ReferenceMinimum, observationResult.ReferenceRange[0].Low); //Assert.AreEqual(vitalSignsResult.ReferenceMaximum, observationResult.ReferenceRange[0].High); }
public List <VitalSigns> FillVitalSigns(IEntryCollection entryCollection) { List <VitalSigns> vitalSigns = new List <VitalSigns>(); foreach (IEntry singleentry in entryCollection) { IOrganizer organizer = singleentry.AsOrganizer; IComponent4Collection component = organizer.Component; IIVL_TS effectivetime = organizer.EffectiveTime; if (effectivetime == null) { throw new InvalidOperationException(); } VitalSigns ptvitalSigns = new VitalSigns(); try { ptvitalSigns.VitalDate = effectivetime.AsDateTime; } catch (Exception) { ptvitalSigns.VitalDate = effectivetime != null ? effectivetime.Low != null ? effectivetime.Low.Value != null ? new DateTime?(effectivetime.Low.AsDateTime) : null : null : effectivetime.Value != null ? new DateTime?(effectivetime.AsDateTime) : new DateTime?(effectivetime.AsDateTime); } foreach (IComponent4 orgComponent in component) { IObservation orgObservation = orgComponent.AsObservation; ICD itemCode = orgObservation.Code; IANY vitalSignsObservationValue = orgObservation.Value[0]; IPQ itemVlues = (IPQ)vitalSignsObservationValue; if (itemCode.Code != null) { if (itemCode.Code.ToString() == "8302-2") { ptvitalSigns.Height = Convert.ToInt16(itemVlues.Value); ptvitalSigns.HeightUnit = Convert.ToString(itemVlues.Unit); } if (itemCode.Code.ToString() == "3141-9") { ptvitalSigns.WEIGHT = Convert.ToInt16(itemVlues.Value); ptvitalSigns.WeightUnit = Convert.ToString(itemVlues.Unit); } if (itemCode.Code.ToString() == "8480-6") { ptvitalSigns.BloodPressure = itemVlues.Value.ToString() + " " + itemVlues.Unit.ToString(); ptvitalSigns.BloodPressureSystolic = itemVlues.Value.ToString(); } if (itemCode.Code.ToString() == "8462-4") { ptvitalSigns.BloodPressureDiastolic = itemVlues.Value.ToString(); } } } vitalSigns.Add(ptvitalSigns); } return(vitalSigns); }
public void SetTemperatureOnHealthVault(double tempValue) { try { if (!_isProvisioned) { MessageBox.Show("Please provision application first"); return; } HealthClientAuthorizedConnection connection = HealthClientApplication.CreateAuthorizedConnection(PersonId); HealthRecordAccessor accessor = new HealthRecordAccessor(connection, RecordId); TemperatureMeasurement temperature = new TemperatureMeasurement(tempValue); VitalSigns vitalSign = new VitalSigns(); //generate random date DateTime startDate = new DateTime(2018, 1, 1); DateTime endDate = new DateTime(2018, 12, 30); TimeSpan timeSpan = endDate - startDate; var randomTest = new Random(); TimeSpan newSpan = new TimeSpan(0, randomTest.Next(0, (int)timeSpan.TotalMinutes), 0); DateTime newDate = startDate + newSpan; //set time now //vitalSign.When = new HealthServiceDateTime(DateTime.UtcNow); vitalSign.When = new HealthServiceDateTime(newDate); CodableValue codableValue = new CodableValue(); codableValue.Text = "celsius"; VitalSignsResultType vitalSignsResultType = new VitalSignsResultType(); vitalSignsResultType.Unit = codableValue; vitalSignsResultType.TextValue = "Temperature"; vitalSignsResultType.Title.Text = "Temperature"; vitalSignsResultType.Value = tempValue; vitalSign.VitalSignsResults.Add(vitalSignsResultType); accessor.NewItem(vitalSign); } catch (Exception ex) { throw; } }
//健康参数-获取某生理参数的单位等 public JsonResult GetUnit(string Itemcode) { var res = new JsonResult(); string[] s = Itemcode.Split(new char[] { '_' }); string ItemType = s[0]; VitalSigns VitalSign = new VitalSigns(); VitalSign = _ServicesSoapClient.GetDataByTC(ItemType, Itemcode); res.Data = VitalSign; res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(res); }
private async void Button_Clicked(object sender, EventArgs e) { try { MaterialControls control = new MaterialControls(); control.ShowLoading("Registrando..."); string date = DateTime.Today.ToString("yy/MM/dd"); string hour = DateTime.Now.ToString("hh:mm"); VitalSigns consultas = new VitalSigns { altura = float.Parse(alt.Text), peso = float.Parse(pes.Text), fecha = date, temperatura = float.Parse(temp.Text), frec_Cardiaca = float.Parse(frec.Text), presion = float.Parse(pres.Text), pulso = float.Parse(pul.Text), idpaciente = Convert.ToInt32(id_paciente.Text) }; HttpClient client = new HttpClient(); string controlador = "/Api/perfil_paciente/create.php"; client.BaseAddress = new Uri(baseurl); string json = JsonConvert.SerializeObject(consultas); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(controlador, content); if (response.IsSuccessStatusCode) { control.ShowAlert("Registrado", "Exito", "Ok"); } else { control.ShowAlert("Ocurrio un error al registrar", "Error", "Ok"); } } catch (Exception ex) { await DisplayAlert("Ocurrio un error" + ex, "Error", "Ok"); } }
private State <KoteState, IData> Hunger(VitalSigns signs, int hunger) { var newHunger = signs.Hunger + hunger; _log.Warning($"{_name} is now hungry on {newHunger}"); if (newHunger > 80 && newHunger < 100) { return(GoTo(KoteState.Hunger).Using(new VitalSigns(newHunger))); } if (newHunger >= 100) { throw new KoteDeadException(_name); } return(Stay().Using(new VitalSigns(newHunger))); }
/// <summary> /// Patient ENCOUNTERS Information /// </summary> /// <param name="dataArr"></param> /// <returns></returns> public List <VitalSigns> GetVitalSigns(Dictionary <string, ArrayList> dataArr) { List <VitalSigns> vitalSigns = new List <VitalSigns>(); if (dataArr.Count > 0) { for (int i = 0; i < dataArr.Count; i++) { VitalSigns ptvitalSigns = new VitalSigns(); ArrayList itemvitalSigns = dataArr[i.ToString()]; ptvitalSigns.Height = Convert.ToInt16(itemvitalSigns[1].ToString().Split(" ")[0]); ptvitalSigns.WEIGHT = Convert.ToInt16(itemvitalSigns[5].ToString().Split(" ")[0]); ptvitalSigns.BloodPressure = itemvitalSigns[9].ToString(); ptvitalSigns.Entrydate = itemvitalSigns[2].ToString() == "null" ? null : new DateTime?(Convert.ToDateTime(itemvitalSigns[2].ToString())); vitalSigns.Add(ptvitalSigns); } } return(vitalSigns); }
internal static Observation ToFhirInternal(VitalSigns vitalSigns, Observation observation) { observation.Category = new List <CodeableConcept> { FhirCategories.VitalSigns }; observation.Effective = new FhirDateTime(vitalSigns.When.ToLocalDateTime().ToDateTimeUnspecified()); observation.Code = HealthVaultVocabularies.VitalSigns; foreach (VitalSignsResultType vitalSignsResult in vitalSigns.VitalSignsResults) { var vitalSign = VitalSignsResultToFhir(vitalSignsResult); vitalSign.Id = $"vitalsign-{Guid.NewGuid()}"; observation.Contained.Add(vitalSign); var related = new Observation.RelatedComponent(); related.Type = Observation.ObservationRelationshipType.HasMember; related.Target = new ResourceReference(vitalSign.Id); } return(observation); }
public async Task <object> GetSinglePatientVitals(string Id) { var vit = await _redisService.HGet("patientvitals", Id); VitalSigns serializedVit = null; if (!vit.IsNullOrEmpty) { serializedVit = JsonConvert.DeserializeObject <VitalSigns>(vit.ToString()); } if (serializedVit == null) { return(new object()); } else { return(serializedVit); } }
// Register the type on the generic ThingToFhir partial class public static Observation ToFhir(this VitalSigns vitalSigns) { return(VitalSignsToFhir.ToFhirInternal(vitalSigns, ToFhirInternal <Observation>(vitalSigns))); }
//健康参数-获取某生理参数的单位等 public JsonResult GetUnit(string Itemcode) { var res = new JsonResult(); string[] s = Itemcode.Split(new char[] { '_' }); string ItemType = s[0]; VitalSigns VitalSign = new VitalSigns(); VitalSign = _ServicesSoapClient.GetDataByTC(ItemType, Itemcode); res.Data = VitalSign; res.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return res; }
public void GenerateVitalSignsEntry(VitalSigns vitalSign, III hl7III, Factory hl7Factory, ref int refId) { IEntry entry = functionalStatus.Section.Entry.Append(); entry.TypeCode = x_ActRelationshipEntry.DRIV; entry.AsOrganizer.ClassCode = x_ActClassDocumentEntryOrganizer.CLUSTER; entry.AsOrganizer.MoodCode = "EVN"; hl7III = entry.AsOrganizer.TemplateId.Append(); hl7III.Init("2.16.840.1.113883.10.20.22.4.26"); hl7III = entry.AsOrganizer.Id.Append(); hl7III.Init(Guid.NewGuid().ToString()); entry.AsOrganizer.Code.Code = "46680005"; entry.AsOrganizer.Code.CodeSystem = "2.16.840.1.113883.6.96"; entry.AsOrganizer.Code.CodeSystemName = "SNOMED CT"; entry.AsOrganizer.Code.DisplayName = "Vital signs"; entry.AsOrganizer.StatusCode.Init("completed"); IVXB_TS low = new IVXB_TS(); low.Init(Convert.ToDateTime(vitalSign.Entrydate)); entry.AsOrganizer.EffectiveTime = new IVL_TS().Init(low: low); //entry.AsOrganizer.EffectiveTime.Init(Convert.ToDateTime(vitalSign.Entrydate)); ///'''' Height Component ''''''' IComponent4 component = entry.AsOrganizer.Component.Append(); // Height Component component.AsObservation.ClassCode = "OBS"; component.AsObservation.MoodCode = x_ActMoodDocumentObservation.EVN; hl7III = component.AsObservation.TemplateId.Append(); hl7III.Init("2.16.840.1.113883.10.20.22.4.27"); hl7III = component.AsObservation.Id.Append(); hl7III.Init(Guid.NewGuid().ToString()); component.AsObservation.Code.Code = "8302-2"; component.AsObservation.Code.CodeSystem = "2.16.840.1.113883.6.1"; component.AsObservation.Code.CodeSystemName = "LOINC"; component.AsObservation.Code.DisplayName = "Height"; component.AsObservation.Text.Reference.Value = "#vit" + Convert.ToString(refId); component.AsObservation.StatusCode.Init("completed"); low.Init(Convert.ToDateTime(vitalSign.Entrydate)); component.AsObservation.EffectiveTime = new IVL_TS().Init(low: low); //component.AsObservation.EffectiveTime.Init(Convert.ToDateTime(vitalSign.Entrydate)); IPQ PQ = hl7Factory.CreatePQ(); if (!string.IsNullOrEmpty(Convert.ToString(vitalSign.Height))) { PQ.Value = Convert.ToDouble(vitalSign.Height); PQ.Unit = "inch"; } else { PQ.NullFlavor = "UNK"; } component.AsObservation.Value.Add(PQ); ICE CE = hl7Factory.CreateCE(); CE.Code = "N"; CE.CodeSystem = "2.16.840.1.113883.5.83"; component.AsObservation.InterpretationCode.Add(CE); ///'''' Weight Component ''''''''' component = entry.AsOrganizer.Component.Append(); // Weight Component component.AsObservation.ClassCode = "OBS"; component.AsObservation.MoodCode = x_ActMoodDocumentObservation.EVN; hl7III = component.AsObservation.TemplateId.Append(); hl7III.Init("2.16.840.1.113883.10.20.22.4.27"); hl7III = component.AsObservation.Id.Append(); hl7III.Init(Guid.NewGuid().ToString()); component.AsObservation.Code.Code = "3141-9"; component.AsObservation.Code.CodeSystem = "2.16.840.1.113883.6.1"; component.AsObservation.Code.CodeSystemName = "LOINC"; component.AsObservation.Code.DisplayName = "Patient Body Weight - Measured"; component.AsObservation.Text.Reference.Value = "#vit" + Convert.ToString(refId + 1); component.AsObservation.StatusCode.Init("completed"); low.Init(Convert.ToDateTime(vitalSign.Entrydate)); component.AsObservation.EffectiveTime = new IVL_TS().Init(low: low); //component.AsObservation.EffectiveTime.Init(Convert.ToDateTime(vitalSign.Entrydate)); if (!string.IsNullOrEmpty(Convert.ToString(vitalSign.WEIGHT))) { PQ = hl7Factory.CreatePQ(); PQ.Value = Convert.ToDouble(vitalSign.WEIGHT); PQ.Unit = "Kg"; } else { PQ.NullFlavor = "UNK"; } component.AsObservation.Value.Add(PQ); CE = hl7Factory.CreateCE(); CE.Code = "N"; CE.CodeSystem = "2.16.840.1.113883.5.83"; component.AsObservation.InterpretationCode.Add(CE); ///'''' BloodPressure Component ''''''''' component = entry.AsOrganizer.Component.Append(); // Blood Pressure component.AsObservation.ClassCode = "OBS"; component.AsObservation.MoodCode = x_ActMoodDocumentObservation.EVN; hl7III = component.AsObservation.TemplateId.Append(); hl7III.Init("2.16.840.1.113883.10.20.22.4.27"); hl7III = component.AsObservation.Id.Append(); hl7III.Init(Guid.NewGuid().ToString()); component.AsObservation.Code.Code = "3141-9"; component.AsObservation.Code.CodeSystem = "2.16.840.1.113883.6.1"; component.AsObservation.Code.CodeSystemName = "LOINC"; component.AsObservation.Code.DisplayName = "Intravascular Systolic"; component.AsObservation.Text.Reference.Value = "#vit" + Convert.ToString(refId + 2); component.AsObservation.StatusCode.Init("completed"); low.Init(Convert.ToDateTime(vitalSign.Entrydate)); component.AsObservation.EffectiveTime = new IVL_TS().Init(low: low); // component.AsObservation.EffectiveTime.Init(Convert.ToDateTime(vitalSign.Entrydate)); PQ = hl7Factory.CreatePQ(); if (string.IsNullOrEmpty(Convert.ToString(vitalSign.BloodPressure))) { PQ.NullFlavor = "UNK"; } else { PQ.Value = Convert.ToDouble(vitalSign.BloodPressure.Split('/')[0]); PQ.Unit = "mm[Hg]"; } component.AsObservation.Value.Add(PQ); CE = hl7Factory.CreateCE(); CE.Code = "N"; CE.CodeSystem = "2.16.840.1.113883.5.83"; component.AsObservation.InterpretationCode.Add(CE); refId = refId + 3; }
public short GetList(string patientID, string szVisitNO, string szVitalSigns, ref List <VitalSigns> lstVitalSigns) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("*"); string szCondition = string.Format("1=1"); szCondition = string.Format("{0} AND {1} = '{2}' and {3}='{4}' " , szCondition , SystemData.VitalSignsView.PATIENT_ID , patientID , SystemData.VitalSignsView.VISIT_NO , szVisitNO); if (!string.IsNullOrEmpty(szVitalSigns)) { szCondition = string.Format("{0} AND {1}='{2}'" , szCondition , SystemData.VitalSignsView.VITAL_SIGNS , szVitalSigns); } string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC , sbField.ToString(), SystemData.DataView.VITAL_SIGNS_V, szCondition, SystemData.VitalSignsView.RECORDING_DATE); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (lstVitalSigns == null) { lstVitalSigns = new List <VitalSigns>(); } lstVitalSigns.Clear(); do { VitalSigns item = new VitalSigns(); for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.VitalSignsView.MEMO: item.MEMO = dataReader.GetValue(i).ToString(); break; case SystemData.VitalSignsView.PATIENT_ID: item.PATIENT_ID = dataReader.GetValue(i).ToString(); break; case SystemData.VitalSignsView.RECORDING_DATE: item.RECORDING_DATE = dataReader.GetDateTime(i); break; case SystemData.VitalSignsView.TIME_POINT: item.TIME_POINT = dataReader.GetDateTime(i); break; case SystemData.VitalSignsView.UNITS: item.UNITS = dataReader.GetValue(i).ToString(); break; case SystemData.VitalSignsView.VISIT_ID: item.VISIT_ID = dataReader.GetValue(i).ToString(); break; case SystemData.VitalSignsView.VISIT_NO: item.VISIT_NO = dataReader.GetValue(i).ToString(); break; case SystemData.VitalSignsView.VITAL_SIGNS: item.VITAL_SIGNS = dataReader.GetValue(i).ToString(); break; case SystemData.VitalSignsView.VITAL_SIGNS_VALUES: item.VITAL_SIGNS_VALUES = decimal.Parse(dataReader.GetValue(i).ToString()); break; default: break; } } lstVitalSigns.Add(item); } while (dataReader.Read()); return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MedQCAccess.CloseConnnection(false); } }