Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Specification

Expand
titleSchema
Code Block
"""
Fields to filter medical programs in the system.
"""
input MedicalProgramFilter {
  "Checks for equality with the object’s `databaseId` field."
  databaseId: UUID
  "Checks for matching with the object’s `name` field."
  name: String
  "Checks for equality with the object’s `isActive` field."
  isActive: Boolean
  "Checks for equality with the object’s `type` field."
  type: String
}

"""
Methods to use when ordering `MedicalProgram`.
"""
enum MedicalProgramOrderBy {
  "Orders by the object’s `insertedAt` field in the ascending order."
  INSERTED_AT_ASC
  "Orders by the object’s `insertedAt` field in the descending order."
  INSERTED_AT_DESC
  "Orders by the object’s `name` field in the ascending order."
  NAME_ASC
  "Orders by the object’s `name` field in the descending order."
  NAME_DESC
}

"""
A connection to a list of `MedicalProgram` items.
"""
type MedicalProgramConnection {
  "Information to aid in pagination."
  pageInfo: PageInfo!
  "A list of nodes."
  nodes: [MedicalProgram]
  "A list of edges."
  edges: [MedicalProgramEdge]
}

"""
An edge in a connection of `MedicalProgram`.
"""
type MedicalProgramEdge {
  "The item at the end of the edge."
  node: MedicalProgram!
  "A cursor for use in pagination."
  cursor: String!
}

"""
MedicalProgram contains details about medical program for reimbursement and services.
In order to obtain details user must have a scope **medical_program:read**
"""
type MedicalProgram implements Node {
  "The ID of an object."
  id: ID!
  "Primary key identifier from the database."
  databaseId: UUID!
  "The name of the `MedicalProgram`."
  name: String!
  "Type of the `MedicalProgram`."
  type: String!
  "Whether the `MediaclProgram` is active or not?"
  isActive: Boolean!
  "Date and time when record was inserted."
  insertedAt: DateTime!
  "Date and time when record was updated."
  updatedAt: DateTime!
  "Whether it is possible to create `Medication Request`"
  medicationRequestAllowed: Boolean!
  "Medication request allowed status description"
  medicationRequestAllowedText: String
  "Whether it is possible to create `Medication Dispense`"
  medicationDispenseAllowed: Boolean!
  "Medication dispense allowed status description"
  medicationDispenseAllowedText: String
}

"""
Input for `createMedicalProgram` mutation.
User must have a scope **medical_program:write**
"""
input CreateMedicalProgramInput {
  "The name of the `MedicalProgram`."
  name: String!
  "Type of the `MedicalProgram`. The value should be present in the `MEDICAL_PROGRAM_TYPE` dictionary."
  type: String!
}

"""
Return type for `createMedicalProgram` mutation.
"""
type CreateMedicalProgramPayload {
  "Created `MedicalProgram`."
  medicalProgram: MedicalProgram
}

"""
Input for `updateMedicalProgram` mutation.
User must have a scope **medical_program:write**
"""
input UpdateMedicalProgramInput {
  "The ID of an object."
  id: ID!
  "Whether it is possible to create `Medication Request`"
  medicationRequestAllowed: Boolean
  "Medication request allowed status description"
  medicationRequestAllowedText: String
  "Whether it is possible to create `Medication Dispense`"
  medicationDispenseAllowed: Boolean
  "Medication dispense allowed status description"
  medicationDispenseAllowedText: String
}

"""
Return type for `updateMedicalProgram` mutation.
"""
type UpdateMedicalProgramPayload {
  "Updated `MedicalProgram`."
  medicalProgram: MedicalProgram
}

"""
Input for `deactivateMedicalProgram` mutation.
User must have a scope **medical_program:deactivate**
"""
input DeactivateMedicalProgramInput {
  "The ID of a `MedicalProgram` to deactivate."
  id: ID!
}

"""
Return type for `deactivateMedicalProgram` mutation.
"""
type DeactivateMedicalProgramPayload {
  "Deactivated `MedicalProgram`."
  medicalProgram: MedicalProgram
}

Purpose

This WS is designed to create new medical program.

WS logic

Authorize

  1. Verify the validity of access token

    1. In case error - generate 401 response

  2. Check user scope (scope = 'medical_program:write') in order to perform this action

    1. In case error - generate 403 response

Validate request (JSON schema)

  1. Validate request using JSON schemas (TBD):

    1. Return 422 with list of validation errors in case validation fails (422 EView)

Create new Medical Program

  1. Create new record in Medical_programs 

Destination

Source

Type

Default

M/O

Description

id


uuid


M

Autogenerated

name


varchar


M


is_active


boolean


M


type


varchar


M

Dictionary: MEDICAL_PROGRAM_TYPE

medication_request_allowed


boolean


M


medication_dispense_allowed


boolean


M


medication_request_allowed_text


varchar


O


medication_dispense_allowed_text


varchar


O


medical_program_settings

jsonb:






skip_mnn_in_treatment_period

boolean

false

M

Allow to create medication request with the same innm in one treatment period

employee_types_to_create_medication_request

varchar

null

M

Allow to create medication request for particular types of employees (if empty - all employee types, which have scopes can create medication request without limitations). Fills with values from EMPLOYEE_TYPE dictionary.

Example: "DOCTOR, SPECIALIST"

speciality_types_to_create_medication_request

varchar

null

M

Allow to create medication request for particular specialities $.employees.speciality.speciality(speciality_officio == true) of employees with SPECIALIST type (if empty - all specialists, which have scopes can create medication request w/o limitations). Fills with values from SPECIALITY_TYPE dictionary.

Example: "ENDOCRINOLOGY, FAMILY_DOCTOR"

care_plan_required

boolean

false

M

Allow to create medication request for with reference on care plan

set_medical_program_on_medication_dispense

boolean

false

M

Allow to set medical program at dispense, if it was not specified on create medication request

skip_employee_validation

boolean

false

M

Allows to skip all employee validations, including restrictions in the employee_types_to_create_medication_request and speciality_types_to_create_medication_request parameters. So, any user who has a scope can create medication request

inserted_at


Timestamp: now()


M

Get current date-time

inserted_by


Token: user_id


M

Extract user from token

updated_at


Timestamp: now()


M

Get current date-time

updated_by


Token: user_id


M

Extract user from token

...