/// <summary> /// Order line item type /// </summary> public OrderLineItemType CreateOrderLineItem(ActParticipation participation) { var material = participation.LoadProperty <Material>("PlayerEntity"); var quantityCode = ApplicationContext.Current.GetService <IConceptRepositoryService>().GetConceptReferenceTerm(material.QuantityConceptKey.Value, "UCUM"); return(new OrderLineItemType() { requestedQuantity = new QuantityType() { Value = (decimal)participation.Quantity, measurementUnitCode = quantityCode?.Mnemonic ?? "dose", codeListVersion = "UCUM" }, additionalOrderLineInstruction = material.LoadProperty <Concept>("TypeConcept")?.Mnemonic.StartsWith("VaccineType") == true ? new Description200Type[] { new Description200Type() { languageCode = "en", Value = "FRAGILE" }, new Description200Type() { languageCode = "en", Value = "KEEP REFRIGERATED" } } : null, transactionalTradeItem = this.CreateTradeItem(material) }); }
public ActionResult JoinRealm() { var bundle = new Bundle(); var person = new Person { Key = Guid.NewGuid(), Names = new List <EntityName> { new EntityName(NameUseKeys.OfficialRecord, "smith", "mary") } }; var patient = new Patient { Relationships = new List <EntityRelationship> { new EntityRelationship(EntityRelationshipTypeKeys.Mother, Guid.NewGuid()) } }; var test = new ActParticipation(ActParticipationKey.RecordTarget, Guid.NewGuid()); var test1 = new ActParticipation(ActParticipationKey.Location, Guid.Parse("880d2a08-8e94-402b-84b6-cb3bc0a576a9")); var test2 = new ActParticipation(ActParticipationKey.Performer, Guid.Parse("6ba47c4c-ec52-46a9-b2d9-ad3104ef238f")); var test3 = new ActParticipation(ActParticipationKey.Authororiginator, Guid.Parse("6ba47c4c-ec52-46a9-b2d9-ad3104ef238f")); var test4 = new ActParticipation(ActParticipationKey.Consumable, Guid.Parse("a14dd78e-1f68-40e0-a59f-cd1e64f720b8")); var test5 = new ActParticipation(ActParticipationKey.Consumable, Guid.Parse("ecda818f-e7b7-466a-9a71-a79eb2241ac9")); var act = new SubstanceAdministration { CreationTime = DateTimeOffset.Now, Key = Guid.NewGuid(), MoodConceptKey = ActMoodKeys.Eventoccurrence, Participations = new List <ActParticipation> { test, test1, test2, test3, test4, test5 } }; bundle.Item.Add(person); bundle.Item.Add(patient); bundle.Item.Add(act); bundle.Item.Add(test); bundle.Item.Add(test1); bundle.Item.Add(test2); bundle.Item.Add(test3); bundle.Item.Add(test4); bundle.Item.Add(test5); var content = JsonConvert.SerializeObject(bundle); return(View()); }
/// <summary> /// Create receive line item /// </summary> public ReceivingAdviceLogisticUnitType CreateReceiveLineItem(ActParticipation orderReceivePtcpt, ActParticipation orderSentPtcpt) { if (orderSentPtcpt == null) { throw new ArgumentNullException(nameof(orderSentPtcpt), "Missing sending order participation"); } else if (orderReceivePtcpt == null) { throw new ArgumentNullException(nameof(orderReceivePtcpt), "Missing receiving order participation"); } // Quantity code var quantityCode = ApplicationContext.Current.GetService <IConceptRepositoryService>().GetConceptReferenceTerm(orderReceivePtcpt.LoadProperty <Material>("PlayerEntity").QuantityConceptKey.Value, "UCUM"); if (quantityCode == null) { throw new InvalidOperationException($"Missing quantity code for {orderReceivePtcpt.LoadProperty<Material>("PlayerEntity").QuantityConceptKey.Value}"); } // Receiving logistic unit type return(new ReceivingAdviceLogisticUnitType() { receivingAdviceLineItem = new ReceivingAdviceLineItemType[] { new ReceivingAdviceLineItemType() { quantityDespatched = new QuantityType() { Value = Math.Abs((decimal)orderSentPtcpt.Quantity), measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM" }, quantityAccepted = new QuantityType() { Value = (decimal)orderReceivePtcpt.Quantity, measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM" }, transactionalTradeItem = this.CreateTradeItem(orderReceivePtcpt.LoadProperty <Material>("PlayerEntity")), receivingConditionInformation = new ReceivingConditionInformationType[] { new ReceivingConditionInformationType() { receivingConditionCode = new ReceivingConditionCodeType() { Value = "DAMAGED_PRODUCT_OR_CONTAINER" }, receivingConditionQuantity = new QuantityType() { Value = (decimal)(Math.Abs(orderSentPtcpt.Quantity.Value) - orderReceivePtcpt.Quantity), measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM" } }, new ReceivingConditionInformationType() { receivingConditionCode = new ReceivingConditionCodeType() { Value = "GOOD_CONDITION" }, receivingConditionQuantity = new QuantityType() { Value = (decimal)orderReceivePtcpt.Quantity, measurementUnitCode = quantityCode.Mnemonic ?? "dose", codeListVersion = "UCUM" } } } } } }); }