private ServiceRequest createPreorder(FhirDateTime date, Patient patient, Practitioner doctor, string[] serviceCodes, bool webstorePreorder, string contractID = null)
        {
            var order = new ServiceRequest
            {
                AuthoredOn = date.ToString(),
                Status     = RequestStatus.Active,
                Intent     = RequestIntent.Order,
                Code       = Constants.ORDER_PROCEDURE_REQUEST_CODE,
                Category   =
                    webstorePreorder ?
                    new List <CodeableConcept> {
                    new CodeableConcept("https://dia.medicover.com/dictionaries/requestcategory", "FFS"),
                    new CodeableConcept("https://dia.medicover.com/dictionaries/requestcategory/ffs", "UA.WebOnline")
                } :
                new List <CodeableConcept> {
                    new CodeableConcept("https://dia.medicover.com/dictionaries/requestcategory", "Contract"),
                    new CodeableConcept("https://dia.medicover.com/contract", contractID)
                },
                Subject     = patient.GlobalURLReference(client.UseFullResourcePath),
                Requester   = doctor.GlobalURLReference(client.UseFullResourcePath),
                OrderDetail = serviceCodes.Select(sc => new CodeableConcept("https://dia.medicover.com/serviceknowledgebase/service", sc)).ToList(),
                Note        = new List <Annotation> {
                    new Annotation {
                        Text = "Very important comment 1"
                    },
                    new Annotation {
                        Text = "Very important comment 2"
                    }
                }
            };

            var fhirOrder = client.Create(order);

            return(fhirOrder);
        }
        private ServiceRequest createOrder(FhirDateTime date, Patient patient, Practitioner doctor, string[] serviceCodes)
        {
            var order = new ServiceRequest
            {
                Identifier = new List <Identifier> {
                    new Identifier {
                        System = "https://dia.medicover.com/sampleID", Value = "999999999900"
                    }
                },
                AuthoredOn  = date.ToString(),
                Status      = RequestStatus.Draft,
                Intent      = RequestIntent.Order,
                Code        = Constants.ORDER_PROCEDURE_REQUEST_CODE,
                Subject     = patient.GlobalURLReference(client.UseFullResourcePath),
                Requester   = doctor.GlobalURLReference(client.UseFullResourcePath),
                OrderDetail = serviceCodes.Select(sc => new CodeableConcept("https://dia.medicover.com/serviceknowledgebase/service", sc)).ToList(),
                Performer   = new List <ResourceReference> {
                    Constants.CURRENT_LAB_REFERENCE
                },
                Note = new List <Annotation> {
                    new Annotation {
                        Text = "Very important comment 1"
                    },
                    new Annotation {
                        Text = "Very important comment 2"
                    }
                }
            };

            var fhirOrder = client.Create(order);

            return(fhirOrder);
        }
        public void GivenADateTimeWithoutDayOrAgeOver89_WhenDateShift_ThenDateTimeShouldBeRedacted(FhirDateTime dateTime, FhirDateTime expectedDateTime)
        {
            var node          = ElementNode.FromElement(dateTime.ToTypedElement());
            var processResult = DateTimeUtility.ShiftDateTimeAndInstantNode(node, string.Empty, string.Empty, true);

            Assert.Equal(expectedDateTime?.ToString() ?? null, node.Value);
            Assert.True(processResult.IsRedacted);
        }
Example #4
0
        public void GivenADateTime_WhenRedact_ThenDateTimeShouldBeRedacted(FhirDateTime dateTime, FhirDateTime expectedDateTime)
        {
            var node = ElementNode.FromElement(dateTime.ToTypedElement());

            DateTimeUtility.RedactDateTimeAndInstantNode(node, true);

            Assert.Equal(expectedDateTime.ToString(), node.Value);
        }
Example #5
0
        public void DateTimeHandling()
        {
            FhirDateTime dt = FhirDateTime.Parse("2010-01-01");

            Assert.AreEqual("2010-01-01", dt.ToString());

            FhirDateTime dt2 = new FhirDateTime(1972, 11, 30, 15, 10);

            Assert.IsTrue(dt2.ToString().StartsWith("1972-11-30T15:10"));
        }
        private QuestionnaireResponse createPatientQuestionReponses(FhirDateTime date, Patient patient, ServiceRequest order)
        {
            var patientQuestions = new QuestionnaireResponse
            {
                Authored = date.ToString(),
                Subject  = order.GlobalURLReference(client.UseFullResourcePath),
                Source   = patient.GlobalURLReference(client.UseFullResourcePath),
                Status   = QuestionnaireResponse.QuestionnaireResponseStatus.Completed,
                Item     = new List <QuestionnaireResponse.ItemComponent>()
                {
                    new QuestionnaireResponse.ItemComponent()
                    {
                        LinkId     = $"https://dia.medicover.com/serviceknowledgebase/question/LastMeal",
                        Definition = $"https://dia.medicover.com/serviceknowledgebase/question/LastMeal",
                        Text       = "Time from last meal",
                        Answer     = new List <QuestionnaireResponse.AnswerComponent> {
                            new QuestionnaireResponse.AnswerComponent {
                                Value = new Quantity(2, "h")
                            }
                        }
                    },
                    new QuestionnaireResponse.ItemComponent {
                        LinkId     = $"https://dia.medicover.com/serviceknowledgebase/question/Nice",
                        Definition = $"https://dia.medicover.com/serviceknowledgebase/question/Nice",
                        Text       = "Nice enviroment?",
                        Answer     = new List <QuestionnaireResponse.AnswerComponent> {
                            new QuestionnaireResponse.AnswerComponent {
                                Value = new FhirBoolean(true)
                            }
                        }
                    }
                }
            };

            return(client.Create(patientQuestions));
        }