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);
        }
Example #2
0
        public async Task <string> CreatePractitioner(IDocumentSession session)
        {
            var values = new Dictionary <string, object>
            {
                { "FirstName", "John" },
                { "LastName", "Favreau" },
                {
                    "Phones",
                    new[]
                    {
                        new { Value = "5146072767", Use = "main", System = "phone" },
                        new { Value = "5555555555", Use = "main", System = "fax" }
                    }
                },
                { "Age", 50 }
            };

            var practitioner = new Practitioner("practitioner")
            {
                Values = values
            };

            session.Store(practitioner);
            await session.SaveChangesAsync();

            return(practitioner.Id);
        }
Example #3
0
        /// <summary>
        /// User login page. Validates user.
        /// </summary>
        /// <param name="email">The email given by the user</param>
        /// <param name="password">The password given by the user</param>
        /// <returns>Returns to Main/home page if user is valid, else returns login view with error message</returns>
        public async Task <ActionResult> UserLogin(string email, string password)
        {
            LoginCaller lc       = new LoginCaller();
            var         customer = await lc.GetByLogin(email, password);

            if (customer != null)
            {
                Session["UserId"]    = customer.Id.ToString();
                Session["LastName"]  = customer.LastName;
                Session["FirstName"] = customer.FirstName;

                PractitionerCaller pc = new PractitionerCaller();
                Practitioner       p  = await pc.GetPractitionerByURL(customer.Practitioner);

                Session["PractitionerId"]        = p.Id.ToString();
                Session["PractitionerFirstName"] = p.FirstName;
                Session["PractitionerLastName"]  = p.LastName;
                Session["PractitionerPhoneNo"]   = p.PhoneNo;
            }
            else
            {
                TempData["ErrorMessage"] = "Brugeren findes ikke, brugernavn eller password passer ikke";
                return(View("Index"));
            }
            TempData["SuccessMessage"] = "Du er nu logget ind, velkommen til " + customer.FirstName + "!";
            return(RedirectToAction("Index", "Home"));
        }
        public async Task <PractitionerResponse> UpdateAsync(int id, Practitioner practitioner)
        {
            var existingPractitioner = await _practitionerRepository.FindByIdAsync(id);

            if (existingPractitioner == null)
            {
                return(new PractitionerResponse("Practitioner not found."));
            }

            existingPractitioner.FirstName = practitioner.FirstName;
            existingPractitioner.LastName  = practitioner.LastName;
            existingPractitioner.Title     = practitioner.Title;

            try
            {
                _practitionerRepository.Update(existingPractitioner);
                await _unitOfWork.CompleteAsync();

                return(new PractitionerResponse(existingPractitioner));
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new PractitionerResponse($"An error occurred when updating the practitioner: {ex.Message}"));
            }
        }
Example #5
0
        private ServiceRequest createOrder(Patient patient, Practitioner doctor, Organization performer, List <ResourceReference> supportingInfo)
        {
            var mo = model.Result.Order;


            var fhirOrder = new ServiceRequest
            {
                Id             = Uuid.Generate().ToString(),
                AuthoredOn     = mo.PlacementDateTime.ToString(Constants.DATE_FORMAT),
                Status         = RequestStatus.Completed,
                Intent         = RequestIntent.Order,
                Code           = Constants.ORDER_PROCEDURE_REQUEST_CODE,
                Subject        = patient.BundleRef(),
                Requester      = doctor.BundleRef(),
                SupportingInfo = supportingInfo,
                Identifier     = mo.Identifier.Select(x => new Identifier(x.System, x.Value)).Append(new Identifier(Constants.BARCODE_CODING_SYSTEM, mo.BarCode)).ToList(),
                OrderDetail    = model.Result.ServiceResults.Select(sc => new CodeableConcept(Constants.SERVICES_CODING_SYSTEM, sc.Id)).ToList(),
                Performer      = new List <ResourceReference> {
                    performer.BundleRef()
                },
                Note = new List <Annotation> {
                    new Annotation {
                        Text = mo.Comment
                    }
                }
            };

            return(fhirOrder);
        }
Example #6
0
        /// <summary>
        /// Deserialize JSON into a FHIR Practitioner
        /// </summary>
        public static void DeserializeJson(this Practitioner current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"Practitioner >>> Practitioner.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"Practitioner: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
        private Practitioner createPractitioner()
        {
            var p = new Practitioner()
            {
                Gender = AdministrativeGender.Male,
                Name   = new List <HumanName> {
                    new HumanName {
                        Family = "Abacki", Given = new[] { "Henryk" }
                    }
                },
                Identifier = new List <Identifier> {
                    new Identifier {
                        System = "http://rejestr.nil.org.pl", Value = "1111"
                    }
                },
                Address = new List <Address>()
                {
                    new Address {
                        City       = "Pabianice",
                        Country    = "PL",
                        PostalCode = "90-001",
                        Line       = new[] { "Cacackiego 5" }
                    }
                }
            };

            return(client.Create(p));
        }
        public void Update(Practitioner obj)
        {
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();
                using (var transaction = conn.BeginTransaction())
                {
                    try
                    {
                        string sql = "UPDATE [dbo].[Person] SET [clinicId] = @ClinicId " +
                                     ",[firstName] = @FirstName " +
                                     ",[lastName] = @LastName" +
                                     ",[phoneNo] = @PhoneNo" +
                                     ",[email] = @Email ," +
                                     "[password] = @Password WHERE id = @Id AND personTypeId = (SELECT id FROM PersonType WHERE type = 'Practitioner')";

                        conn.Execute(sql, obj, transaction: transaction);
                        transaction.Commit();
                    }
                    catch (SqlException e)
                    {
                        transaction.Rollback();
                        throw new DataAccessException("Der gik noget galt prøv igen", e);
                    }
                }
            }
        }
        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);
        }
        internal AppointmentType GetTreatmentByTreatmentName(string typeName, string practitionerName)
        {
            Practitioner    tempPrac = _practitioners.Find(prac => prac.Name == practitionerName);
            AppointmentType appoType = tempPrac.GetAppointmentType(typeName);

            return(appoType);
        }
        internal static MedicationStatement ToFhirInternal(HVMedication hvMedication, MedicationStatement medicationStatement)
        {
            var embeddedMedication = new FhirMedication();

            embeddedMedication.Id = "med" + Guid.NewGuid();

            medicationStatement.Contained.Add(ToFhirInternal(hvMedication, embeddedMedication));
            medicationStatement.Medication = embeddedMedication.GetContainerReference();

            medicationStatement.SetStatusAsActive();
            medicationStatement.SetTakenAsNotApplicable();

            medicationStatement.Dosage = AddDosage(hvMedication.Dose, hvMedication.Frequency, hvMedication.Route);

            if (hvMedication.Prescription != null)
            {
                var embeddedMedicationRequest = new MedicationRequest();
                embeddedMedicationRequest.Id = "medReq" + Guid.NewGuid();

                Practitioner prescribedBy = hvMedication.Prescription.PrescribedBy.ToFhir();
                prescribedBy.Id = "prac" + Guid.NewGuid();
                medicationStatement.Contained.Add(prescribedBy);

                MedicationRequest request = ToFhirInternal(hvMedication.Prescription, embeddedMedicationRequest);
                request.Medication = embeddedMedication.GetContainerReference();
                request.Requester  = new MedicationRequest.RequesterComponent
                {
                    Agent = prescribedBy.GetContainerReference()
                };
                medicationStatement.Contained.Add(request);
                medicationStatement.BasedOn.Add(embeddedMedicationRequest.GetContainerReference());
            }

            return(medicationStatement);
        }
Example #12
0
        public void CheckSimplePatient()
        {
            var p = new Practitioner();

            p.Name.Add(new HumanName().WithGiven("Brian").AndFamily("Postlethwaite"));
            p.BirthDateElement = new Date(1970, 1, 1);
            var hpi_i = new Identifier("http://ns.electronichealth.net.au/id/hi/hpii/1.0", "8003610833334085");

            hpi_i.Type = new CodeableConcept("http://hl7.org/fhir/v2/0203", "NPI", "National provider identifier", "HPI-I");
            p.Identifier.Add(hpi_i);


            var ctx = new ValidationSettings()
            {
                ResourceResolver = _source, GenerateSnapshot = true, ResolveExteralReferences = true, Trace = false
            };

            _validator = new Validator(ctx);

            var report = _validator.Validate(p, new[] { "http://sqlonfhir-stu3.azurewebsites.net/fhir/StructureDefinition/0ac0bb0d1d864cee965f401f2654fbb0" });

            System.Diagnostics.Trace.WriteLine(report.ToString());
            Assert.IsTrue(report.Success);
            Assert.AreEqual(1, report.Warnings);            // 1 unresolvable reference
        }
Example #13
0
        private void LoadCase(string id)
        {
            try
            {
                //CustomerID = CustomerDictionary[customerCbx.Text];
                c = new Customer();                //.Select(ItemID);
                c = Customer.Select(CustomerID);
                subscriberInfoTxt.Text = "Name: " + c.Name + "\t DOB: " + c.Dob + " \r\n Address: " + c.Address + "\r\n City/state: " + c.City + " " + c.State + "\t Zip: " + c.Zip + " \r\n  Phone: " + c.Contact + "\t Soc.Sec.#: " + c.Ssn;

                System.Drawing.Image  img = Helper.Base64ToImage(c.Image);
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
                cusPbx.Image = bmp;
                GraphicsPath gp = new GraphicsPath();
                gp.AddEllipse(cusPbx.DisplayRectangle);
                cusPbx.Region   = new Region(gp);
                cusPbx.SizeMode = PictureBoxSizeMode.StretchImage;
            }
            catch { }
            //try
            //{
            string Q = "SELECT * FROM coverage WHERE customerID='" + CustomerID + "' ";

            foreach (Coverage c in Coverage.List(Q))
            {
                insuranceInfoTxt.Text = insuranceInfoTxt.Text + "\r\n " + c.Type + "\r\n" + "Name: " + c.Name + "\t ID# : " + c.No + " \r\n  " + " \r\n  Type: " + c.Type;
            }

            //}
            //catch { }

            try
            {
                Practitioner c = new Practitioner();                //.Select(ItemID);
                c            = Practitioner.Select(PractitionerID);
                userTxt.Text = "Name: " + c.Name + "\t Speciality" + c.Speciality + " \r\n Address: " + c.Address + "\r\n City/state: " + c.City + " " + c.State + "\t Zip: " + c.Zip + " \r\n  Phone: " + c.Contact + "\t";

                System.Drawing.Image  img = Helper.Base64ToImage(c.Image);
                System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img);
                userPbx.Image = bmp;
                GraphicsPath gp = new GraphicsPath();
                gp.AddEllipse(cusPbx.DisplayRectangle);
                userPbx.Region   = new Region(gp);
                userPbx.SizeMode = PictureBoxSizeMode.StretchImage;
            }
            catch { }
            GenericCollection.caseTransactions.Clear();
            string Qs = "SELECT * FROM casetransaction WHERE caseID = '" + noTxt.Text + "'";

            foreach (CaseTransaction j in CaseTransaction.List(Qs))
            {
                //try
                //{

                CaseTransaction t = new CaseTransaction(j.Id, j.Date, j.No, j.ItemID, j.CaseID, j.DeliveryID, j.Qty, j.Cost, j.Units, j.Total, j.Tax, j.Coverage, j.Self, j.Payable, j.Limits, j.Setting, j.Period, j.Height, j.Weight, j.Instruction, j.Created, "false", Helper.CompanyID);
                GenericCollection.caseTransactions.Add(t);
                //}
                //catch { }
            }
            LoadCaseTransactions();
        }
Example #14
0
        public static Practitioner GetPractitioner(ResourceReference orderOrganization)
        {
            var practitioner = new Practitioner
            {
                Identifier = new List <Identifier>
                {
                    new Identifier(Systems.ORGANIZATIONS, GetCodeBySystem(Systems.ORGANIZATIONS))
                },
                Id   = Guid.NewGuid().ToString(),
                Name = new HumanName
                {
                    Family = new List <string> {
                        "Петров"
                    },
                    Given = new List <string> {
                        "Петр"
                    }
                },
                PractitionerRole = new List <Practitioner.PractitionerPractitionerRoleComponent>
                {
                    new Practitioner.PractitionerPractitionerRoleComponent
                    {
                        ManagingOrganization = orderOrganization,
                        Role      = new CodeableConcept(Systems.PRACTITIONER_ROLE, GetCodeBySystem(Systems.PRACTITIONER_ROLE)),
                        Specialty = new List <CodeableConcept>
                        {
                            new CodeableConcept(Systems.PRACTITIONER_SPECIALITY, GetCodeBySystem(Systems.PRACTITIONER_SPECIALITY))
                        }
                    }
                }
            };

            return(practitioner);
        }
Example #15
0
        public static Order GetOrder(Patient patient, Practitioner orderPractitioner,
                                     Organization orderOrganization,
                                     Resource diagnosticOrder)
        {
            var order = new Order
            {
                Identifier = new List <Identifier>
                {
                    new Identifier(Systems.ORGANIZATIONS, GetCodeBySystem(Systems.ORGANIZATIONS))
                    {
                        Assigner = FhirHelper.CreateReference(orderOrganization)
                    },
                },
                Date = DateTime.Today.ToString(CultureInfo.CurrentCulture),
                When = new Order.OrderWhenComponent
                {
                    Code = new CodeableConcept
                    {
                        Coding = new List <Coding>
                        {
                            new Coding(Systems.PRIORIRY, GetCodeBySystem(Systems.PRIORIRY))
                        }
                    }
                },
                Subject = FhirHelper.CreateReference(patient),
                Source  = FhirHelper.CreateReference(orderPractitioner),
                Target  = FhirHelper.CreateReference(orderOrganization),
                Detail  = new List <ResourceReference> {
                    FhirHelper.CreateBundleReference(diagnosticOrder)
                },
            };

            return(order);
        }
        // insert practitioner
        public void InsertPractitioner(Practitioner practitioner)
        {
            // need to allow id to be inserted, so set identity_insert to be on
            SetIdentityInsert("Practitioners", true);
            string insertCommand = "INSERT INTO Practitioners(PractitionerID, UserID, TypeID) VALUES" +
                                   $"('{practitioner.PractitionerID}', '{practitioner.UserID}', '{practitioner.TypeID}')";

            Debug.WriteLine("InsertPractitioner: " + insertCommand);

            // execute using our connection
            using (SqlCommand sqlCommand = new SqlCommand(insertCommand, sqlConnection))
            {
                try
                {
                    sqlCommand.ExecuteNonQuery();
                }
                catch (SqlException ex)
                {
                    Exception error = new Exception("Failure: " + sqlCommand.CommandText, ex);
                    throw error;
                }
            }


            // now set identity_insert back to off

            SetIdentityInsert("Practitioners", false);
        }
Example #17
0
 /// <summary>
 /// Method to validate a practitioner object
 /// </summary>
 /// <param name="practitioner"> object to be validated</param>
 /// <returns> TRUE if VALID </returns>
 public static bool IsValidPractitioner(this Practitioner practitioner)
 {
     // make sure that userID and PractitionerTypeID exist
     using (MedicalCentreManagementEntities context = new MedicalCentreManagementEntities())
     {
         return(context.Users.Any(u => u.UserID == practitioner.UserID) && context.Practitioner_Types.Any(u => u.TypeID == practitioner.TypeID));
     };
 }
Example #18
0
 public AddNewMedicalRecordCommand(string longDescription, Patient patient, Practitioner practitioner,
                                   string shortDescription)
 {
     LongDescription  = longDescription;
     Patient          = patient;
     Practitioner     = practitioner;
     ShortDescription = shortDescription;
 }
Example #19
0
 public AddNewMedicalReportWithImageCommand(string longDescription, Patient patient, Practitioner practitioner,
                                            string shortDescription, byte[] image)
 {
     LongDescription  = longDescription;
     Patient          = patient;
     Practitioner     = practitioner;
     ShortDescription = shortDescription;
     Image            = image;
 }
        public void PractitionerUnitTestSetup()
        {
            DateTime starTime = new DateTime(1, 1, 1, 9, 0, 0);
            DateTime endTime  = new DateTime(1, 1, 1, 21, 0, 0);

            TimeSpan daySpan = endTime - starTime;

            _testPractitioner = new Practitioner(starTime, daySpan);
        }
 public void Make(int b, List <string> rx)
 {
     practitioner = new Practitioner();
     role         = new PractitionerRole();
     organisation = new Organization();
     DoPractitioner(b, rx);
     DoOrg(b, rx);
     DoRole(b, rx);
 }
Example #22
0
        /// <summary>
        /// Gets all the departments from the database and returns them as a list of depart object.
        /// </summary>
        /// <param name="practitioners"></param>
        /// <returns> List of Department objects </returns>
        public List <Department> GetDepartments(List <Practitioner> practitioners)
        {
            List <Department> listOfDepartments = new List <Department>();

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                connection.Open();
                SqlCommand commandDepartment = new SqlCommand("SPGetAllDepartments", connection);
                commandDepartment.CommandType = CommandType.StoredProcedure;

                SqlCommand commandRoom = new SqlCommand("SPGetRoomsFromDepartment", connection);
                commandRoom.CommandType = CommandType.StoredProcedure;

                SqlCommand commandPractitioners = new SqlCommand("SPGetPractitionersFromDepartment", connection);
                commandPractitioners.CommandType = CommandType.StoredProcedure;

                using (SqlDataReader reader = commandDepartment.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Department tempDepartment = new Department(reader.GetValue(1).ToString(), reader.GetValue(2).ToString(), reader.GetInt32(0));

                        List <Room> tempRooms = new List <Room>();
                        commandRoom.Parameters.AddWithValue("DepartmentId", reader.GetInt32(0));
                        commandPractitioners.Parameters.AddWithValue("DepartmentId", reader.GetValue(0));

                        using (SqlDataReader readRoom = commandRoom.ExecuteReader())
                        {
                            while (readRoom.Read())
                            {
                                Room tempRoom = new Room(readRoom.GetString(1), default(DateTime), 24, readRoom.GetInt32(0));
                                tempRooms.Add(tempRoom);
                            }
                        }

                        using (SqlDataReader readPractitioners = commandPractitioners.ExecuteReader())
                        {
                            while (readPractitioners.Read())
                            {
                                Practitioner tempPractitioner = practitioners.Find(x => x.Id == readPractitioners.GetInt32(0));
                                tempDepartment.AddPractitioner(tempPractitioner);
                            }

                            tempDepartment.Rooms = tempRooms;

                            listOfDepartments.Add(tempDepartment);
                        }

                        commandRoom.Parameters.Clear();
                        commandPractitioners.Parameters.Clear();
                    }
                }
            }

            return(listOfDepartments);
        }
Example #23
0
        private static Practitioner GetPractionerWithName(HumanName humanName)
        {
            var practitioner = new Practitioner();

            practitioner.Name = new System.Collections.Generic.List <HumanName>
            {
                humanName
            };
            return(practitioner);
        }
        /// <summary>
        /// Converts practioner class to string for CSV
        /// </summary>
        /// <param name="sb"></param>
        /// <param name="practitioner"></param>
        /// <returns></returns>
        private StringBuilder OutputPractitioner(StringBuilder sb, Practitioner practitioner)
        {
            sb.Append("Practitioner" + Environment.NewLine);
            sb.Append("Practitioner ID,");
            sb.Append(practitioner.ID + Environment.NewLine);
            sb.Append("Practitioner Name,");
            sb.Append(practitioner.Name + Environment.NewLine);

            return(sb);
        }
Example #25
0
        private static void ReadFile(string path)
        {
            if (File.Exists(path))
            {
                Console.WriteLine($"Reading file '{path}'");
                string         json   = File.ReadAllText(path);
                FhirJsonParser parser = new FhirJsonParser();
                Bundle         bundle = parser.Parse <Bundle>(json);
                // TODO: Need to gracefully handle edge conditins like no decedent present
                Patient decedent = (Patient)bundle.Entry.Find(e => e.Resource.ResourceType == ResourceType.Patient).Resource;
                Console.WriteLine($"  Decedent Name: {decedent.Name[0].ToString()}");
                var deceasedDateTime = DateTime.Parse(decedent.Deceased.ToString());
                Console.WriteLine($"  Time and Date of Death: {String.Format("{0:MMMM d, yyyy \\a\\t h:mmtt}", deceasedDateTime)}");
                Practitioner certifier = (Practitioner)bundle.Entry.Find(e => e.Resource.ResourceType.ToString() == "Practitioner").Resource;
                Console.WriteLine($"  Certifier Name: {certifier.Name[0].ToString()}");

                var   conditions = bundle.Entry.FindAll(e => e.Resource.ResourceType.ToString() == "Condition").Select(e => (Condition)e.Resource);
                Regex htmlRegex  = new Regex("<.*?>");
                foreach (var condition in conditions)
                {
                    if (condition.Onset != null)
                    {
                        Console.WriteLine($"  Cause of Death: {htmlRegex.Replace(condition.Text.Div, "")} ({condition.Onset})");
                    }
                    else
                    {
                        Console.WriteLine($"  Contributing Conditions: {htmlRegex.Replace(condition.Text.Div, "")}");
                    }
                }

                // TODO: The use of FHIR paths seems potentially valuable, but the paths below don't appear to work as expected
                // Marco: Try to use the is operator: "$this is Patient"  :
                var matches = navigator.Select("Bundle.entry.resource.where($this is Patient).name.family");

                // Marco: I tried it as well and for me it worked! So meta.profile='<some uri>'
                var matches = navigator.Select("Bundle.entry.resource.where(meta.profile='http://nightingaleproject.github.io/fhirDeathRecord/StructureDefinition/sdr-decedent-Decedent')");                //var matches = navigator.Select("Bundle.entry.resource");
                Console.WriteLine($"Found {matches.Count()} matches");
                //foreach (var match in matches)
                //{
                //    Console.WriteLine(match.Value);
                //    if (match.Type == "Patient")
                //    {
                //        var names = match.Select("name.family");
                //        foreach (var name in names)
                //        {
                //            Console.WriteLine($"Name: {name.Value}");
                //        }
                //    }
                //}
            }
            else
            {
                Console.WriteLine($"Error: File '{path}' does not exist");
            }
        }
        public async Task <IActionResult> Create([Bind("PractitionerID,Username,Password,Email,Type,ContactNo")] Practitioner practitioner)
        {
            if (ModelState.IsValid)
            {
                _context.Add(practitioner);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(practitioner));
        }
Example #27
0
        public void PractitionerRepoSetup()
        {
            _dbController = new TestDbController();
            testInstance  = PractitionerRepo.GetInstance(_dbController);


            testPractitionerOne = new Practitioner(DateTime.Today.AddHours(9), TimeSpan.FromHours(12), "pracNameOne");
            testPractitionerTwo = new Practitioner(DateTime.Today.AddHours(9), TimeSpan.FromHours(12), "pracNameTwo");

            testInstance.AddPractitioner(testPractitionerOne);
            testInstance.AddPractitioner(testPractitionerTwo);
        }
        internal static Practitioner ToFhirInternal(PersonItem person)
        {
            var practitioner = new Practitioner();

            HumanName fhirName = person.Name.ToFhir();

            practitioner.Name = new System.Collections.Generic.List <HumanName> {
                fhirName
            };

            if (!string.IsNullOrEmpty(person.Organization))
            {
                practitioner.SetStringExtension(HealthVaultExtensions.Organization, person.Organization);
            }

            if (!string.IsNullOrEmpty(person.ProfessionalTraining))
            {
                var qualificationComponent = new Practitioner.QualificationComponent
                {
                    Code = new CodeableConcept
                    {
                        Text = person.ProfessionalTraining
                    }
                };
                practitioner.Qualification = new System.Collections.Generic.List <Practitioner.QualificationComponent>
                {
                    qualificationComponent
                };
            }

            if (!string.IsNullOrEmpty(person.PersonId))
            {
                practitioner.Identifier = new System.Collections.Generic.List <Identifier>
                {
                    new Identifier
                    {
                        Value = person.PersonId
                    }
                };
            }

            if (person.ContactInformation != null)
            {
                practitioner.Address.AddRange(
                    person.ContactInformation.Address.Select(address => address.ToFhir()));
                practitioner.Telecom.AddRange(
                    person.ContactInformation.Phone.Select(phone => phone.ToFhir()));
                practitioner.Telecom.AddRange(
                    person.ContactInformation.Email.Select(email => email.ToFhir()));
            }

            return(practitioner);
        }
Example #29
0
 private static void AddAsserter(this AllergyIntolerance allergyIntolerance, Practitioner practitioner)
 {
     if (practitioner != null)
     {
         practitioner.Id = $"#practitioner-{Guid.NewGuid()}";
         allergyIntolerance.Contained.Add(practitioner);
         allergyIntolerance.Asserter = new ResourceReference
         {
             Reference = practitioner.Id
         };
     }
 }
 public bool Has(Practitioner p)
 {
     if (practitioner == null)
     {
         return(false);
     }
     if (p == null)
     {
         return(false);
     }
     return(practitioner.IsExactly(p));
 }