本文整理汇总了C#中Hl7.Fhir.Model.Query类的典型用法代码示例。如果您正苦于以下问题:C# Query类的具体用法?C# Query怎么用?C# Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于Hl7.Fhir.Model命名空间,在下文中一共展示了Query类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChainWithModifierToStringExact_FindsResourceOnExactValue
public void ChainWithModifierToStringExact_FindsResourceOnExactValue()
{
var q = new Query().For("Patient").Where("given=nancy").Where("provider:Organization.name:exact=Health Level Seven International");
var results = index.Search(q);
//results = index.Search("Patient", "given=\"ned\"&provider:Organization.name:exact=\"Health Level Seven International\"");
Assert.IsTrue(results.Count == 1);
}
示例2: ChainWithModifierToString_FindsResourceOnFirstPartOfValue
public void ChainWithModifierToString_FindsResourceOnFirstPartOfValue()
{
var q = new Query().For("Patient").Where("given=nancy").Where("provider:Organization.name=health");
var results = index.Search(q);
//results = index.Search("Patient", "given=\"nancy\"&provider:Organization.name:partial=\"health\"");
Assert.IsTrue(results.Count == 1);
}
示例3: ChainWithModifierToString_DoesNotFindResourceOnWronglySpelledValue
public void ChainWithModifierToString_DoesNotFindResourceOnWronglySpelledValue()
{
var q = new Query().For("Patient").Where("given=nancy").Where("provider:Organization.name=healthy");
var results = index.Search(q);
//results = index.Search("Patient", "given=\"ned\"&provider:Organization.name:partial=\"healthy\"");
Assert.IsTrue(results.Count == 0);
}
示例4: String_FindsResourceOnExactValue
public void String_FindsResourceOnExactValue()
{
// Default search = partial from the start
var q = new Query().For("Patient").Where("family=Mckinney");
var r = index.Search(q);
Assert.IsTrue(r.Has("Patient/76"));
}
示例5: String_IgnoresAndReportsInvalidOperator
public void String_IgnoresAndReportsInvalidOperator()
{
var q = new Query().For("Patient").Where("family=>Mckinney");
var r = index.Search(q);
Assert.IsTrue(r.HasIssues);
Assert.AreEqual(String.Empty, r.UsedCriteria);
Assert.IsTrue(r.Count > 0); //All Patient resources should be found.
}
示例6: RetrieveCriteria
public void RetrieveCriteria()
{
var q = new Query()
.For("Patient").Where("name:exact=ewout").OrderBy("birthDate", SortOrder.Descending)
.SummaryOnly().Include("Patient.managingOrganization")
.LimitTo(20);
Assert.AreEqual(1, q.Criteria.Count());
Assert.AreEqual("ewout", Query.ExtractParamValue(q.Criteria.First()));
}
示例7: Load
internal static Query Load (String resource, IEnumerable<Tuple<String, String>> parameters)
{
Query result = new Query();
result.ResourceType = resource;
foreach (var p in parameters)
{
result.AddParameter(p.Item1, p.Item2);
};
return result;
}
示例8: ReapplySingleParam
public void ReapplySingleParam()
{
var q = new Query()
.Custom("mySearch").OrderBy("adsfadf").OrderBy("q", SortOrder.Descending)
.LimitTo(10).LimitTo(20).Custom("miSearch").SummaryOnly().SummaryOnly(false);
Assert.AreEqual("miSearch", q.QueryName);
Assert.IsFalse(q.Summary);
var o = q.Sort;
Assert.AreEqual("q", o.Item1);
Assert.AreEqual(SortOrder.Descending, o.Item2);
Assert.AreEqual(20, q.Count);
Assert.IsFalse(q.Summary);
}
示例9: ManipulateParameters
public void ManipulateParameters()
{
var q = new Query();
q.AddParameter("testX", "someVal");
q.AddParameter("testX", "someVal2");
q.AddParameter("testXY", "someVal3");
var vals = q.GetValues("testX");
Assert.AreEqual(2, vals.Count());
Assert.AreEqual("someVal", vals.First());
Assert.AreEqual("someVal2", vals.Skip(1).First());
Assert.AreEqual("someVal3", q.GetSingleValue("testXY"));
q.RemoveParameter("testXY");
Assert.IsNull(q.GetSingleValue("testXY"));
Assert.AreEqual(2, q.GetValues("testX").Count());
}
示例10: Search
public static RestUrl Search(this RestUrl url, Query q)
{
// The ResourceType is the only parameter that needs special handling,
// since the others are all "normal" parameters. Just make sure we don't
// include the special _type parameter on the REST url
var result = url.Search(q.ResourceType);
foreach (var par in q.Parameter)
{
var paramKey = Query.ExtractParamKey(par);
if (paramKey != Query.SEARCH_PARAM_TYPE)
{
result.AddParam(Query.ExtractParamKey(par),
Query.ExtractParamValue(par));
}
}
return result;
}
示例11: TestProperties
public void TestProperties()
{
var q = new Query();
q.QueryName = "special";
q.ResourceType = "Patient";
q.Count = 31;
q.Summary = true;
q.Sort = Tuple.Create("sorted", SortOrder.Descending);
q.Includes.Add("Patient.name");
q.Includes.Add("Observation.subject");
Assert.AreEqual("special", q.QueryName);
Assert.AreEqual("Patient", q.ResourceType);
Assert.AreEqual(31, q.Count);
Assert.AreEqual(true, q.Summary);
Assert.AreEqual(Tuple.Create("sorted", SortOrder.Descending), q.Sort);
Assert.AreEqual(2, q.Includes.Count);
Assert.AreEqual("Patient.name", q.Includes.First());
Assert.AreEqual("Observation.subject", q.Includes.Skip(1).First());
q.QueryName = "special2";
q.ResourceType = "Observation";
q.Count = 32;
q.Summary = false;
q.Sort = Tuple.Create("sorted2", SortOrder.Ascending);
q.Includes.Add("Patient.name2");
q.Includes.Remove("Patient.name");
q.Includes.Add("Observation.subject2");
Assert.AreEqual("special2", q.QueryName);
Assert.AreEqual("Observation", q.ResourceType);
Assert.AreEqual(32, q.Count);
Assert.AreEqual(false, q.Summary);
Assert.AreEqual(Tuple.Create("sorted2", SortOrder.Ascending), q.Sort);
Assert.AreEqual(3, q.Includes.Count);
Assert.IsTrue(q.Includes.Contains("Patient.name2"));
Assert.IsFalse(q.Includes.Contains("Patient.name"));
Assert.IsTrue(q.Includes.Contains("Observation.subject"));
Assert.IsTrue(q.Includes.Contains("Observation.subject2"));
}
示例12: ManageSearchResult
public void ManageSearchResult()
{
var q = new Query()
.For("Patient").Where("name:exact=ewout").OrderBy("birthDate", SortOrder.Descending)
.SummaryOnly().Include("Patient.managingOrganization")
.LimitTo(20);
var x = FhirSerializer.SerializeResourceToXml(q);
Console.WriteLine(x);
Assert.AreEqual("Patient", q.ResourceType);
var p = q.Parameter.SingleWithName("name");
Assert.AreEqual("name:exact", Query.ExtractParamKey(p));
Assert.AreEqual("ewout", Query.ExtractParamValue(p));
var o = q.Sort;
Assert.AreEqual("birthDate", o.Item1);
Assert.AreEqual(SortOrder.Descending, o.Item2);
Assert.IsTrue(q.Summary);
Assert.IsTrue(q.Includes.Contains("Patient.managingOrganization"));
Assert.AreEqual(20,q.Count);
}
示例13: ChainWithModifierToToken_FindsResourceOnTokenCode
public void ChainWithModifierToToken_FindsResourceOnTokenCode()
{
// THE WORKS
var q = new Query().For("Condition").Where("subject.identifier=12345");
var results = index.Search(q);
//results = index.Search("Condition", "subject.identifier=12345");
Assert.IsTrue(results.Count >= 2);
Assert.IsTrue(results.Has("Condition/example"));
Assert.IsTrue(results.Has("Condition/example2"));
}
示例14: StringExact_DoesNotFindResourceOnValueWithDifferentCapitalization
public void StringExact_DoesNotFindResourceOnValueWithDifferentCapitalization()
{
var q = new Query().For("Patient").Where("family:exact=McKinney");
var r = index.Search(q);
Assert.IsFalse(r.Has("Patient/76"));
}
示例15: StringExact_FindsResourceOnExactValue
public void StringExact_FindsResourceOnExactValue()
{
var q = new Query().For("Patient").Where("family:exact=Mckinney");
var r = index.Search(q);
Assert.IsTrue(r.Has("Patient/76"));
}