Ejemplo n.º 1
0
 public Session(int sessionId, DateTime date, OpenHRUser user, OpenHROrganisation organisation)
 {
     SessionId    = sessionId;
     Date         = date;
     User         = user;
     Organisation = organisation;
 }
Ejemplo n.º 2
0
 public static EomGetPatientAppointments.HolderStruct ToEomHolder2(OpenHRUser user)
 {
     return(new EomGetPatientAppointments.HolderStruct()
     {
         Title = user.Person.title,
         FirstNames = user.Person.forenames,
         LastName = user.Person.surname,
         DBID = user.OpenHRUserId
     });
 }
Ejemplo n.º 3
0
 private static EomAppointmentSessions.HolderStruct ToEomHolder(OpenHRUser user)
 {
     return(new EomAppointmentSessions.HolderStruct()
     {
         FirstNames = user.Person.forenames,
         LastName = user.Person.surname,
         Title = user.Person.title,
         DBID = user.OpenHRUserId,
         RefID = user.OpenHRUserId
     });
 }
 public static EomUserDetails37.UserDetails ToEomUserDetails(OpenHRUser user)
 {
     return(new EomUserDetails37.UserDetails()
     {
         Person = new EomUserDetails37.PersonType()
         {
             DBID = user.OpenHRUserId.ToString(),
             GUID = user.UserInRole.id,
             Title = user.Person.title,
             FirstNames = user.Person.forenames,
             LastName = user.Person.surname
         }
     });
 }
Ejemplo n.º 5
0
        public string GetUserByUserInRoleGuid(string odsCode, Guid userInRoleGuid)
        {
            OpenHRUser user = DataStore
                              .Users
                              .FirstOrDefault(t => t.Organisation.nationalPracticeCode == odsCode &&
                                              userInRoleGuid.Equals(new Guid(t.UserInRole.id)));

            string result = string.Empty;

            if (user != null)
            {
                EomUserDetails37.UserDetails userDetails = EomUsersTransform.ToEomUserDetails(user);

                result = Utilities.Serialize <EomUserDetails37.UserDetails>(userDetails);
            }

            return(result);
        }
Ejemplo n.º 6
0
        public string GetUserByID(string odsCode, int userInRoleId)
        {
            OpenHRUser user = DataStore
                              .Users
                              .FirstOrDefault(t => t.Organisation.nationalPracticeCode == odsCode &&
                                              t.OpenHRUserId == userInRoleId);

            string result = string.Empty;

            if (user != null)
            {
                EomUserDetails37.UserDetails userDetails = EomUsersTransform.ToEomUserDetails(user);

                result = Utilities.Serialize <EomUserDetails37.UserDetails>(userDetails);
            }

            return(result);
        }
Ejemplo n.º 7
0
        private void AddVerticalUserPanel(Session session)
        {
            OpenHRUser            user         = session.User;
            OpenHR001Organisation organisation = session.Organisation.Organisation;

            tableLayoutPanel1.CreateColumn(new ColumnStyle(SizeType.Absolute, 200F));
            Panel panel = CreateVerticalPanel(user.Person.GetCuiDisplayName(), " at " + organisation.name);

            foreach (Slot slot in session.Slots)
            {
                Panel outer = new Panel()
                {
                    Height  = 100,
                    Dock    = DockStyle.Top,
                    Padding = new Padding(10, 10, 10, 0)
                };

                Panel p = new Panel()
                {
                    Dock             = DockStyle.Fill,
                    BackColor        = Color.White,
                    ContextMenuStrip = _contextMenuStrip,
                    Tag = slot
                };

                if (slot.Patient != null)
                {
                    Control c = CreateBookedPatientControl(slot.Patient);
                    p.Controls.Add(c);
                }

                outer.Controls.Add(p);
                panel.Controls.Add(outer);
                outer.BringToFront();
            }

            tableLayoutPanel1.Controls.Add(panel, (tableLayoutPanel1.ColumnCount - 1), 0);
        }
Ejemplo n.º 8
0
        private void DrawAppointmentBook()
        {
            lblDateHeader.Text = monthCalendar1.SelectionStart.Date.ToString("dddd dd MMMM yyyy");

            OpenHRUser[] userFilter = _allUsers;

            if (cbClinicianFilter.SelectedValue != null)
            {
                OpenHRUser selectedUser = (OpenHRUser)cbClinicianFilter.SelectedValue;

                userFilter = _allUsers
                             .Where(t => new Guid(t.Person.id) == new Guid(selectedUser.Person.id))
                             .ToArray();
            }

            if (cbOrganisationFilter.SelectedValue != null)
            {
                OpenHROrganisation selectedOrganisation = (OpenHROrganisation)cbOrganisationFilter.SelectedValue;

                userFilter = userFilter
                             .Where(t => new Guid(t.Organisation.id) == new Guid(selectedOrganisation.Organisation.id))
                             .ToArray();
            }

            DateTime selectedDate = monthCalendar1.SelectionStart.Date;

            Session[] sessions = DataStore
                                 .AppointmentSessions
                                 .Where(t => t.Date.Date.Equals(selectedDate) &&
                                        userFilter.Contains(t.User))
                                 .OrderBy(t => t.Date)
                                 .ThenBy(t => t.Organisation.Organisation.name)
                                 .ThenBy(t => t.User.Person.GetCuiDisplayName())
                                 .ToArray();

            DrawAppointmentBook(sessions);
        }
Ejemplo n.º 9
0
        private void cbOrganisationFilter_SelectedIndexChanged(object sender, EventArgs e)
        {
            OpenHROrganisation selectedOrganisation = (OpenHROrganisation)cbOrganisationFilter.SelectedValue;
            OpenHRUser         selectedUser         = (OpenHRUser)cbClinicianFilter.SelectedValue;

            OpenHRUser[] users = _distinctUsers.Where(t => t.IsSessionHolder).ToArray();

            if (selectedOrganisation != null)
            {
                users = selectedOrganisation.Users;
            }

            cbClinicianFilter.PopulateComboBox(users.OrderBy(t => t.Person.GetCuiDisplayName()).ToArray(), t => t.Person.GetCuiDisplayName(), "(no filter)");

            if (selectedUser != null)
            {
                cbClinicianFilter.SelectedValue = selectedUser;

                if (cbClinicianFilter.SelectedValue == null)
                {
                    cbClinicianFilter.SelectedIndex = 0;
                }
            }
        }
Ejemplo n.º 10
0
        private static OpenHROrganisation[] GetOrganisations()
        {
            List <OpenHROrganisation> structuredOrganisations = new List <OpenHROrganisation>();

            OpenHR001Organisation[] organisations = OpenHRPatients
                                                    .SelectMany(t => t.OpenHealthRecord.adminDomain.organisation.Where(s => new Guid(s.id) == new Guid(t.OpenHealthRecord.author.organisation)))
                                                    .DistinctBy(t => t.id)
                                                    .OrderBy(t => t.name)
                                                    .ToArray();

            int organisationId = 1;
            int locationId     = 1;
            int userId         = 1;

            foreach (OpenHR001Organisation organisation in organisations)
            {
                OpenHRPatient[] openHRAtOrganisation = OpenHRPatients
                                                       .Where(t => new Guid(t.OpenHealthRecord.author.organisation) == new Guid(organisation.id))
                                                       .ToArray();

                OpenHR001User[] users = openHRAtOrganisation
                                        .SelectMany(t => t.OpenHealthRecord.adminDomain.user)
                                        .DistinctBy(t => new Guid(t.id))
                                        .ToArray();

                List <OpenHRUser> structuredUsers = new List <OpenHRUser>();

                int organisationUserCount = 1;

                foreach (OpenHR001User user in users)
                {
                    OpenHRUser structuredUser = new OpenHRUser();
                    structuredUser.OpenHRUserId = userId++;
                    structuredUser.User         = user;
                    structuredUser.UserInRole   = openHRAtOrganisation.SelectMany(t => t.OpenHealthRecord.adminDomain.userInRole).FirstOrDefault(t => new Guid(t.user) == new Guid(user.id));
                    structuredUser.Role         = openHRAtOrganisation.SelectMany(t => t.OpenHealthRecord.adminDomain.role).FirstOrDefault(t => new Guid(t.id) == new Guid(structuredUser.UserInRole.id));
                    structuredUser.Person       = openHRAtOrganisation.SelectMany(t => t.OpenHealthRecord.adminDomain.person).FirstOrDefault(t => new Guid(t.id) == new Guid(structuredUser.User.userPerson));
                    structuredUser.Organisation = organisation;

                    if (organisationUserCount <= _maxSessionHoldersPerOrganisation)
                    {
                        structuredUser.IsSessionHolder = true;
                    }

                    organisationUserCount++;

                    structuredUsers.Add(structuredUser);
                }

                OpenHRLocation[] locations = openHRAtOrganisation
                                             .SelectMany(t => t.OpenHealthRecord.adminDomain.location)
                                             .Where(t => (new Guid(t.id) == new Guid(organisation.mainLocation)) || (organisation.locations.Select(s => new Guid(s.location)).Contains(new Guid(t.id))))
                                             .DistinctBy(t => new Guid(t.id))
                                             .Select(t => new OpenHRLocation(locationId++, t))
                                             .ToArray();

                structuredOrganisations.Add(new OpenHROrganisation(
                                                organisationId: organisationId++,
                                                organisation: organisation,
                                                locations: locations,
                                                users: structuredUsers.ToArray()));
            }

            return(structuredOrganisations.ToArray());
        }