Skip to content

Latest commit

 

History

History
1693 lines (1603 loc) · 32.8 KB

File metadata and controls

1693 lines (1603 loc) · 32.8 KB

TDC API

The TDC application contains the following modules

  • Patient
  • Treatment
  • Appointment
  • Invoice
  • File

Note: All input data of type Date accepts both JS time (milliseconds) and Epoch timestamp.

Patient

Here's a quick overview of the Patient endpoints

POST /api/patient/new
GET /api/patient/all
GET /api/patient/get/:pid
GET /api/patient/search
PUT /api/patient/update/:pid

Create Patient

Create a new patient record

POST /api/patient/new/

Request Body

Required fields: name, contact

{
  name:             String,
  dob:              Date,
  age:              Number,
  area:             String,
  gender:           String,
  address:          String,
  contact:          Number,
  med_history:      [ String ],
  current_meds:     [ String ],
  files:            [ String ]
}

Response

Status 201

{
  name:         String,
  contact:      Number,
  p_id:         String
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/patient/new/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Taika Waititi",
    "gender": "M",
    "contact": 977777644444,
    "area": "Waihau Bay",
    "dob": 177359400
}'
{
    "name": "Taika Waititi",
    "gender": "M",
    "contact": 977777644444,
    "area": "Waihau Bay",
    "dob": 177359400000,
    "age": 45,
    "p_id": "PAT0001"
}

List Patients

List all patient records

GET /api/patient/all/

Allowed Methods: GET, POST, PUT

Response

Status 200

{
  total_docs:     Number,
  docs: [
    {
      p_id:             String,
      name:             String,
      dob:              Date,
      age:              Number,
      area:             String,
      gender:           String,
      address:          String,
      contact:          Number,
      med_history:      [ String ],
      current_meds:     [ String ],
      files:            [ String ],
      created_at:       Date
    }
  ]
}

Status 204 No data found

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/patient/all/'
{
    "total_docs": 1,
    "docs": [
        {
            "dob": "1975-08-15T18:30:00.000Z",
            "age": 45,
            "gender": "M",
            "address": null,
            "med_history": [],
            "current_meds": [],
            "files": [],
            "name": "Taika Waititi",
            "contact": 977777644444,
            "area": "Waihau Bay",
            "p_id": "PAT0001",
            "created_at": "2021-04-27T14:22:34.294Z"
        }
    ]
}

Get Patient

Get one patient record by patient id

GET /api/patient/get/:pid

Allowed Methods: GET, POST, PUT

Path Parameters

Parameter Type Description
pid String The id of the patient to fetch

Response

Status 200

{
  p_id:            String,
  name:           String,
  dob:            Date,
  age:            Number,
  area:           String,
  gender:         String,
  address:        String,
  contact:        Number,
  med_history:    [ String ],
  current_meds:   [ String ],
  files:          [ String ],
  created_at:     Date
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/patient/get/PAT0001'
{
    "dob": "1975-08-15T18:30:00.000Z",
    "age": 45,
    "gender": "M",
    "address": null,
    "med_history": [],
    "current_meds": [],
    "files": [],
    "name": "Taika Waititi",
    "contact": 977777644444,
    "area": "Waihau Bay",
    "p_id": "PAT0001",
    "created_at": "2021-04-27T14:22:34.294Z"
}

Search Patient

Search for a patient record by area or contact.

GET /api/patient/search/

Allowed Methods: GET, POST, PUT

Query Parameters

Parameter Type Description
type String The type of data to search. Can be Contact or Area
term String The term to search for (the contact number or the area)

Note: If you are using POST or PUT methods, you can pass the above parameters in the request body.

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      p_id:             String,
      name:             String,
      dob:              Date,
      age:              Number,
      area:             String,
      gender:           String,
      address:          String,
      contact:          Number,
      med_history:      [ String ],
      current_meds:     [ String ],
      files:            [ String ],
      created_at:       Date
    }
  ]
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample (Contact)
curl --location --request GET 'http://127.0.0.1:8000/api/patient/search/?type=contact&term=977777644444'
{
    "total_docs": 1,
    "docs": [
        {
            "dob": "1975-08-15T18:30:00.000Z",
            "age": 45,
            "gender": "M",
            "address": null,
            "med_history": [],
            "current_meds": [],
            "files": [],
            "name": "Taika Waititi",
            "contact": 977777644444,
            "area": "Waihau Bay",
            "p_id": "PAT0001",
            "created_at": "2021-04-27T14:22:34.294Z"
        }
    ]
}
Sample (Area)
curl --location --request GET 'http://127.0.0.1:8000/api/patient/search/?type=Area&term=bay'
  {
    "total_docs": 1,
    "docs": [
        {
            "dob": "1975-08-15T18:30:00.000Z",
            "age": 45,
            "gender": "M",
            "address": null,
            "med_history": [],
            "current_meds": [],
            "files": [],
            "name": "Taika Waititi",
            "contact": 977777644444,
            "area": "Waihau Bay",
            "p_id": "PAT0001",
            "created_at": "2021-04-27T14:22:34.294Z"
        }
    ]
}

Update Patient

Update an existing patient record

PUT /api/patient/update/:pid

The request body should contain changes to be made to the patient document.

Path Parameters

Parameter Type Description
pid String The id of the patient to fetch

Response

Status 200

{
  p_id:           String,
  name:           String,
  dob:            Date,
  age:            Number,
  area:           String,
  gender:         String,
  address:        String,
  contact:        Number,
  med_history:    [ String ],
  current_meds:   [ String ],
  files:          [ String ],
  created_at:     Date
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request PUT 'http://127.0.0.1:8000/api/patient/update/PAT0001' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "current_meds": [
          "Aspirin",
          "Paracetamol"
      ],
      "address": "2, Random Address, New Zealand"
  }'
{
    "dob": "1975-08-15T18:30:00.000Z",
    "age": 45,
    "gender": "M",
    "address": "2, Random Address, New Zealand",
    "med_history": [],
    "current_meds": [
        "Aspirin",
        "Paracetamol"
    ],
    "files": [],
    "name": "Taika Waititi",
    "contact": 977777644444,
    "area": "Waihau Bay",
    "p_id": "PAT0001",
    "created_at": "2021-04-27T14:22:34.294Z"
}

Import Patients

Import XLS file containing patient records. Filename (present in data/ folder) to be passed in request body.

PUT /api/patient/import

Request Body

Required fields: file

{
  file:   String
}

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      p_id:       String,
      name:       String,
      contact:    Number
    }
  ]
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request PUT 'http://127.0.0.1:8000/api/patient/import' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "file": "Patients.xlsx"
    }'
    {
      "total_docs": 3,
      "docs": [
          {
              "name": "Angel",
              "contact": 2020202020,
              "area": "Spain",
              "med_history": [
                  "Blood Pressure",
                  "Diabetes"
              ],
              "p_id": "PAT0005"
          },
          {
              "p_id": "PAT0003",
              "name": "Maria",
              "contact": 1234567890,
              "area": "Germany"
          },
          {
              "name": "Rick Astley",
              "contact": 30008000,
              "area": "America",
              "med_history": [
                  "Never gives up"
              ],
              "p_id": "PAT0006"
          }
      ]
  }
  

Export Patients

Export patient records to XLS file. Exports into data/Patient List(Month YYYY).xls.

GET /api/patient/export/

Response

Status 200

{
  total_docs:   Number
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/patient/export/'
    {
      "total_docs": 6
    }
  

Treatment

Here's a quick overview of all Treatment endpoints

POST /api/treatment/new
GET /api/treatment/all
GET /api/treatment/get/:tid
GET /api/treatment/patient/:pid
GET /api/treatment/history/:pid
PUT /api/treatment/update/:tid

Create Treatment

Create a new treatment record

POST /api/treatment/new/

Request Body

Required fields: p_id, doctor, procedure_done

{
  p_id:               String,
  doctor:             String,
  procedure_done:     String,
  treatment_date:     Date,
  remarks:            String,
  teeth_number:       [ Number ]
}

Response

Status 201

{
  p_id:             String,
  doctor:           String,
  procedure_done:   String,
  t_id:             String
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/treatment/new/' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "doctor" : "Dr. Who",
      "p_id" : "PAT0001",
      "procedure_done" : "General Checkup",
        "treatment_date": 1616410800
    }'
{
    "doctor": "Dr. Who",
    "p_id": "PAT0001",
    "procedure_done": "General Checkup",
    "treatment_date": 1616410800000,
    "t_id": "TRT0001"
}

List Treatments

List all the treatment records

GET /api/treatment/all/

Allowed Methods: GET, POST, PUT

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      p_id:               String,
      doctor:             String,
      procedure_done:     String,
      treatment_date:     Date,
      remarks:            String,
      teeth_number:       [ Number ],
      created_at:         Date
    }
  ]
}

Status 204 No data found

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/treatment/all/'
{
    "total_docs": 1,
    "docs": [
        {
            "procedure_done": "General Checkup",
            "teeth_number": [],
            "remarks": null,
            "doctor": "Dr. Who",
            "p_id": "PAT0001",
            "treatment_date": "2021-03-22T11:00:00.000Z",
            "t_id": "TRT0001",
            "created_at": "2021-04-27T17:49:55.970Z"
        }
    ]
}

Get Treatment by ID

Get one treatment record by treatment id

GET /api/treatment/get/:tid

Allowed Methods: GET, POST, PUT

Path Parameters

Parameter Type Description
tid String The id of the treatment to fetch

Response

Status 200

{
  p_id:               String,
  doctor:             String,
  procedure_done:     String,
  treatment_date:     Date,
  remarks:            String,
  teeth_number:       [ Number ],
  created_at:         Date
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/treatment/get/TRT0001'
{
    "procedure_done": "General Checkup",
    "teeth_number": [],
    "remarks": null,
    "doctor": "Dr. Who",
    "p_id": "PAT0001",
    "treatment_date": "2021-03-22T11:00:00.000Z",
    "t_id": "TRT0001",
    "created_at": "2021-04-27T17:49:55.970Z"
}

Get Treatments by Patient

Get the treatment records for a patient by patient id

GET /api/treatment/patient/:pid

Allowed Methods: GET, POST, PUT

Path Parameters

Parameter Type Description
pid String The id of the patient to fetch treatments

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      p_id:               String,
      doctor:             String,
      procedure_done:     String,
      treatment_date:     Date,
      remarks:            String,
      teeth_number:       [ Number ],
      created_at:         Date
    }
  ]
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/treatment/patient/PAT0001'
{
    "total_docs": 2,
    "docs": [
        {
            "procedure_done": "General Checkup",
            "teeth_number": [],
            "remarks": null,
            "doctor": "Dr. Who",
            "p_id": "PAT0001",
            "treatment_date": "2021-03-22T11:00:00.000Z",
            "t_id": "TRT0001",
            "created_at": "2021-04-27T17:49:55.970Z"
        },
        {
            "procedure_done": "Filling",
            "teeth_number": [],
            "remarks": null,
            "doctor": "Dr. Who",
            "p_id": "PAT0001",
            "treatment_date": "2021-03-24T05:30:00.000Z",
            "t_id": "TRT0002",
            "created_at": "2021-04-27T17:51:18.643Z"
        }
    ]
}

Get Treatment History

Get the treatment history of a patient by patient id

GET /api/treatment/history/:pid

Allowed Methods: GET, POST, PUT

Path Parameters

Parameter Type Description
pid String The id of the patient to fetch treatment history

Query Parameters

Parameter Type Description
quick Boolean To filter and obtain a concise history

Response

Status 200

{
  total_docs:   Number,
  procedures: [
    {
      doctor:             String,
      procedure_done:     String,
      treatment_date:     Date,
      remarks:            String,
      teeth_number:       [ Number ]
    }
  ],
  doctors:      [ String ],
  last_visit:   Date
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/treatment/history/PAT0001'
{
    "total_docs": 2,
    "procedures": [
        {
            "procedure_done": "General Checkup",
            "treatment_date": "2021-03-22T11:00:00.000Z",
            "remarks": null,
            "doctor": "Dr. Who",
            "teeth_number": [],
            "t_id": "TRT0001"
        },
        {
            "procedure_done": "Filling",
            "treatment_date": "2021-03-24T05:30:00.000Z",
            "remarks": null,
            "doctor": "Dr. Who",
            "teeth_number": [],
            "t_id": "TRT0002"
        }
    ],
    "doctors": [
        "Dr. Who"
    ],
    "last_visit": "2021-03-22T11:00:00.000Z"
}

Update Treatment

Update an existing treatment record

PUT /api/treatment/update/:tid

The request body should contain the changes to be made to the treatment record

Path Parameters

Parameter Type Description
tid String The id of the treatment to update

Response

Status 200

{
  p_id:               String,
  doctor:             String,
  procedure_done:     String,
  treatment_date:     Date,
  remarks:            String,
  teeth_number:       [ Number ],
  created_at:         Date
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request PUT 'http://127.0.0.1:8000/api/treatment/update/TRT0002' \
--header 'Content-Type: application/json' \
--data-raw '{
    "procedure_done": "Filling",
    "teeth_number": [
        19,
        20
    ],
    "remarks": "Checkup after a month",
    "doctor": "Dr. Who",
    "p_id": "PAT0001",
    "t_id": "TRT0002"
}'
{ "procedure_done": "Filling", "teeth_number": [ 19, 20 ], "remarks": "Checkup after a month", "doctor": "Dr. Who", "p_id": "PAT0001", "treatment_date": "2021-03-24T05:30:00.000Z", "t_id": "TRT0002", "created_at": "2021-04-27T17:51:18.643Z" }

Import Treatments

Import XLS file containing treatment records. Filename (present in data/ folder) to be passed in request body.

PUT /api/treatment/import

Request Body

Required fields: file

{
  file:   String
}

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      t_id:             String,
      p_id:             String,
      doctor:           String,
      procedure_done:   String
    }
  ]
}

Status 400 Bad Request

Status 500 Internal Server Error

Export Treatments

Export treatment records to XLS file. Exports into data/Treatment List(Month YYYY).xls.

GET /api/treatment/export/

Response

Status 200

{
  total_docs:   Number
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/treatment/export/'
    {
      "total_docs": 2
    }
  

Appointment

Here's a quick overview of all Appointment endpoints

POST /api/appointment/new
GET /api/appointment/all
GET /api/appointment/patient/:pid
POST /api/appointment/doctor/
PUT /api/appointment/update/:appid

Create Appointment

Create a new appointment record

POST /api/appointment/new/

Request Body

Required fields: p_id, doctor, appointment_date

{
  p_id:               String,
  doctor:             String,
  appointment_date:   Date,
  status:             Number,
  room:               Number
}

Response

Status 201

{
  p_id:               String,
  doctor:             String,
  appointment_date:   Date,
  app_id:             String
}

Status 400 Bad Request

Status 409 Appointment not feasible

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/appointment/new/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "p_id": "PAT0001",
    "doctor": "Dr. Who",
    "appointment_date": 1622286000,
    "status": 2
}'
{
    "p_id": "PAT0001",
    "doctor": "Dr. Who",
    "appointment_date": 1622286000000,
    "status": 2,
    "app_id": "APP0001"
}

List Appointments

List all appointment records

GET /api/appointment/all/

Allowed Methods: GET, POST, PUT

Query Parameters

Parameter Type Description
quick Boolean To filter and obtain a concise list
from Date The from date to filter the list
to Date The to date to filter the list
count Boolean To fetch only the count of appointments

Note: The from & to parameters need to be applied together.

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      app_id:             String,
      p_id:               String,
      doctor:             String,
      appointment_date:   Date,
      status:             Number,
      room:               Number,
      created_at:         Date
    }
  ],
  meta:         [ Object ]
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/appointment/all/'
{
    "total_docs": 1,
    "docs": [
        {
            "status": 2,
            "p_id": "PAT0001",
            "doctor": "Dr. Who",
            "appointment_date": "2021-05-29T11:00:00.000Z",
            "app_id": "APP0001",
            "created_at": "2021-04-28T14:00:57.931Z"
        }
    ],
    "meta": [
        {
            "type": "doctor",
            "name": "Dr. Who",
            "count": 1
        },
        {
            "type": "status",
            "value": 2,
            "count": 1
        }
    ]
}
Sample (by date)
curl --location --request GET 'http://127.0.0.1:8000/api/appointment/all/?from=1622140200&to=1622312999'
{
    "total_docs": 1,
    "docs": [
        {
            "status": 2,
            "p_id": "PAT0001",
            "doctor": "Dr. Who",
            "appointment_date": "2021-05-29T12:00:00.000Z",
            "app_id": "APP0001",
            "created_at": "2021-04-28T14:00:57.931Z",
            "patient": {
                "name": "Taika Waititi",
                "age": 45,
                "gender": "M"
            }
        }
    ],
    "meta": [
        {
            "type": "doctor",
            "name": "Dr. Who",
            "count": 1
        },
        {
            "type": "status",
            "value": 2,
            "count": 1
        }
    ]
}

Get Appointments by Patient

Get the appointment records for a patient by patient id

GET /api/appointment/patient/:pid

Path Parameters

Parameter Type Description
pid String The id of the patient to fetch appointments

Query Parameters

Parameter Type Description
count Boolean To fetch only the count of appointments

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      app_id:             String,
      p_id:               String,
      doctor:             String,
      appointment_date:   Date,
      status:             Number,
      room:               Number,
      created_at:         Date
    }
  ],
  meta:         [ Object ]
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/appointment/patient/PAT0001'
{
    "total_docs": 1,
    "docs": [
        {
            "status": 2,
            "p_id": "PAT0001",
            "doctor": "Dr. Who",
            "appointment_date": "2021-05-29T11:00:00.000Z",
            "app_id": "APP0001",
            "created_at": "2021-04-28T14:00:57.931Z"
        }
    ]
}

Get Appointments by Doctor

Get the appointment records for a doctor

GET /api/appointment/doctor/

Allowed Methods: GET, POST, PUT

Query Parameters

Parameter Type Description
doctor string The name of the doctor to fetch the appointments
count Boolean To fetch only the count of appointments

Note: Note: If you are using POST or PUT methods, you can pass the doctor parameter in the request body.

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      app_id:             String,
      p_id:               String,
      doctor:             String,
      appointment_date:   Date,
      status:             Number,
      room:               Number,
      created_at:         Date
    }
  ],
  meta:         [ Object ]
}

Status 204 No data found

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request POST 'http://127.0.0.1:8000/api/appointment/doctor/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "doctor": "Dr. Who"
}'
{
    "total_docs": 1,
    "docs": [
        {
            "status": 2,
            "p_id": "PAT0001",
            "doctor": "Dr. Who",
            "appointment_date": "2021-05-29T11:00:00.000Z",
            "app_id": "APP0001",
            "created_at": "2021-04-28T14:00:57.931Z"
        }
    ]
}

Update Appointment

Update an existing appointment record

PUT /api/appointment/update/APP0001

The request body should contain the changes to be made to the appointment record.

Response

Status 200

{
  app_id:             String,
  p_id:               String,
  doctor:             String,
  appointment_date:   Date,
  status:             Number,
  room:               Number,
  created_at:         Date
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request PUT 'http://127.0.0.1:8000/api/appointment/update/APP0001' \
--header 'Content-Type: application/json' \
--data-raw '{
    "status": 2,
    "appointment_date": 1622289600
}'
{
    "status": 2,
    "p_id": "PAT0001",
    "doctor": "Dr. Who",
    "appointment_date": "2021-05-29T12:00:00.000Z",
    "app_id": "APP0001",
    "created_at": "2021-04-28T14:00:57.931Z"
}

Import Appointments

Import XLS file containing patient records. Filename (present in data/ folder) to be passed in request body.

PUT /api/appointment/import

Request Body

Required fields: file

{
  file:   String
}

Response

Status 200

{
  total_docs:   Number,
  docs: [
    {
      app_id:             String,
      p_id:               String,
      doctor:             String,
      appointment_date:   Date
    }
  ]
}

Status 400 Bad Request

Status 500 Internal Server Error

Export Appointments

Export appointment records to XLS file. Exports into data/Appointment List(Month YYYY).xls.

GET /api/appointment/export/

Response

Status 200

{
  total_docs:   Number
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/appointment/export/'
    {
      "total_docs": 1
    }
  

Invoice

Here's a quick overview of all Invoice endpoints

POST /api/invoice/new
GET /api/invoice/all
GET /api/invoice/print/:invid

Create Invoice

Create a new invoice record

POST /api/invoice/new

Request Body

Require fields: p_id, treatments.doctor, treatments.procedure_done

{
  p_id:   String,
  treatments: [
    {
      doctor:             String,
      procedure_done:     String,
      treatment_date:     Date,
      teeth_number:       [ Number ],
      cost:               Number,
      qty:                Number,
      total:              Number
    }
  ]
}

Response

Status 201

{
  p_id:         String,
  doctor:       [ String ],
  treatments:   [ String ],
  inv_id:       String
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
    curl --location --request POST 'http://127.0.0.1:8000/api/invoice/new/' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "p_id": "PAT0001",
        "treatments": [
            {
                "t_id": "TRT0001",
                "doctor": "Dr. Who",
                "cost": 1000,
                "qty": 1,
                "total": 1000
            },
            {
                "t_id": "TRT0002",
                "doctor": "Dr. Who",
                "cost": 1000,
                "qty": 1,
                "total": 1000
            }
        ],
        "payment_method": "Cash",
        "sub_total": 2000,
        "grand_total": 2000
    }'
  
    {
        "p_id": "PAT0001",
        "doctor": [
            "Dr. Who"
        ],
        "treatments": [
            "{\"t_id\":\"TRT0001\",\"doctor\":\"Dr. Who\",\"cost\":1000,\"qty\":1,\"total\":1000}",
            "{\"t_id\":\"TRT0002\",\"doctor\":\"Dr. Who\",\"cost\":1000,\"qty\":1,\"total\":1000}"
        ],
        "payment_method": "Cash",
        "sub_total": 2000,
        "grand_total": 2000,
        "inv_id": "INV0001"
    }
  

List Invoices

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/invoice/all/'
    {
        "total_docs": 1,
        "docs": [
            {
                "treatments": [
                    {
                        "t_id": "TRT0001",
                        "doctor": "Dr. Who",
                        "cost": 1000,
                        "qty": 1,
                        "total": 1000
                    },
                    {
                        "t_id": "TRT0002",
                        "doctor": "Dr. Who",
                        "cost": 1000,
                        "qty": 1,
                        "total": 1000
                    }
                ],
                "doctor": [
                    "Dr. Who"
                ],
                "p_id": "PAT0001",
                "payment_method": "Cash",
                "sub_total": 2000,
                "grand_total": 2000,
                "inv_id": "INV0001",
                "created_at": "2021-04-29T12:22:21.208Z"
            }
        ]
    }
  

Print Invoice

GET /api/invoice/print/:invid

Path Parameter

Parameter Type Description
invid String The id of the invoice to print

Response

Status 201

{
  file:   String
}

Status 400 Bad Request

Status 500 Internal Server Error

Sample
curl --location --request GET 'http://127.0.0.1:8000/api/invoice/print/INV0001'
    {
      "file": "/home/USER/TDC/invoice/INV0001.pdf"
    }