ЕСОЗ - публічна документація

(GraphQl) Search Program devices_EN

Purpose

This WS allows to search for a participant of medical program with device type.

Key points

  1. This is a graphQl method used in Administration panel only.

  2. Only authenticated and authorized NHS employee with appropriate scope can search for a Program devices.

Specification

"Reads and enables pagination through a set of `ProgramDevice`." programDevices( "A condition to be used in determining which values should be returned by the collection." filter: ProgramDeviceFilter "The method to use when ordering collection items." orderBy: ProgramDeviceOrderBy "Read all values in the set after (below) this cursor." after: String "Read all values in the set before (above) this cursor." before: String "Only read the first _n_ values of the set." first: Int "Only read the last _n_ values of the set." last: Int ): ProgramDeviceConnection!
""" Fields to filter reimbursement program device in the system. """ input ProgramDeviceFilter { "Primary key identifier from the database." databaseId: UUID "Medical program filter." medicalProgram: MedicalProgramFilter "is_active status." isActive: Boolean "Device request allowed status." deviceRequestAllowed: Boolean "Device definition filter." deviceDefinition: DeviceDefinitionFilter "Registry number filter." registryNumber: String "Type of reimbursement." reimbursementType: ReimbursementType "Start date for program device entry." startDate: DateInterval "End date for program device entry." endDate: DateInterval } """ Methods to use when ordering `ProgramDevice`. """ enum ProgramDeviceOrderBy { "Sort by inserted_at in ascending order." INSERTED_AT_ASC "Sort by inserted_at in descending order." INSERTED_AT_DESC } """ A connection to a list of `ProgramDevice` items. """ type ProgramDeviceConnection { "Information to aid in pagination." pageInfo: PageInfo! "A list of nodes." nodes: [ProgramDevice] "A list of edges." edges: [ProgramDeviceEdge] } """ An edge in a connection of `ProgramDevice`. """ type ProgramDeviceEdge { "The item at the end of the edge." node: ProgramDevice! "A cursor for use in pagination." cursor: String! } """ Program Device linkes device definition and medical program. In order to obtain details user must have a scope **program_device:read** """ type ProgramDevice implements Node { "The ID of an object." id: ID! "Primary key identifier from the database." databaseId: UUID! "Medical program." medicalProgram: MedicalProgram! "Device definition." deviceDefinition: DeviceDefinition! "Reimbursement information." reimbursement: Reimbursement! "Wholesale selling price per package." wholesalePrice: Float "Retail price per package." consumerPrice: Float "The daily count of the device definition to be compensated." reimbursementDailyCount: Int "The amount of surcharge for packaging." estimatedPaymentAmount: Float "Date of configuration start." startDate: Date! "Date of configuration end." endDate: Date "Number (version) of reimbursement configuration." registryNumber: String "Whether `ProgramDevice` is active or not?" isActive: Boolean! "Is it allowed to prescribe this device definition?" deviceRequestAllowed: Boolean! "Date and time when record was inserted" insertedAt: DateTime! "Date and time when record was updated" updatedAt: DateTime! "The maximum allowable daily quantity of the device." maxDailyCount: Int "Is it allowed to create care plan activity for this device definition?" carePlanActivityAllowed: Boolean! }

Authorization

  • Verify the validity of access token

    • Return (401, 'Invalid access token') in case of validation fails

  • Verify that token is not expired

    • in case of error - return (401, 'Invalid access token')

  • Check user scopes in order to perform this action (scope = 'program_device:read')

    • Return (403, 'Your scope does not allow to access this resource. Missing allowances: program_device:read') in case of invalid scope(s)

Validate legal entity

  • Extract client_id from token.

  • Check legal entity status (status = ACTIVE)

    • In case of error - return 409 ('client_id refers to legal entity that is not active')

  • Check client type (type = NHS)

    • In case of error - return 403 ('You don't have permission to access this resource')

Service logic

  1. Get all records from program_devices table in PRM database

  2. Apply additional search parameters (connected by logical AND):

    1. databaseId - search by program_devices.id (using exact match with = operator)

    2. medicalProgram - apply medical program filter, then search by program_devices.medical_program_id (using exact match with = operator)

    3. isActive - search by program_devices.is_active (using exact match with = operator)

    4. deviceRequestAllowed - search by program_devices.device_request_allowed (using exact match with = operator)

    5. deviceDefinition - apply device definition filter, then search by program_devices.device_definition_id (using exact match with = operator)

    6. registryNumber - search by program_devices.registry_number (using like match, case insensitive)

    7. reimbursementType - search by program_devices.reimbursement_type (using exact match with = operator)

    8. startDate - search by program_devices.start_date (using exact match with between operator)

    9. endDate - search by program_devices.end_date (using exact match with between operator)

  3. Apply optional ordering

    1. if no $.orderBy is passed - order records by inserted_at field in descending order.

  4. Render a response according to specification

ЕСОЗ - публічна документація