Create a new Practitioner.
This function registers a new practitioner by validating and sending their information to the backend.
Practitioner data containing the following fields:
A promise resolving to the created practitioner response object:
// Input:
const createPractitioner = {
registrationId: "1234567458",
department: "urology",
designation: "surgeon",
status: "Active",
joiningDate: "2023-05-15",
staffType: "Full-Time",
firstName: "Baipalli",
middleName: "A",
lastName: "Rama Rao",
birthDate: "1980-12-25",
gender: "male",
mobileNumber: "+919182856790",
emailId: "ramarao.baipalli@example.com",
address: "123 Main Street, Cityville",
pincode: "560001",
state: "Karnataka",
wantsToLinkWhatsapp: true,
photo: "base64EncodedPhotoString",
resourceType: "Practitioner"
};
const result = await practitioner.create(createPractitioner);
console.log(result);
// Expected Output:
{
message: "Successfully created the Practitioner profile",
type: "Practitioner",
resourceId: "43a0f739-0c54-4b9f-ab4b-08afbed0bf3c",
validationErrors: [],
fhirProfileId: "",
resource: {
firstName: "Baipalli",
lastName: "Rama Rao",
birthDate: "1980-12-25",
registrationId: "1234567458",
resourceId: "43a0f739-0c54-4b9f-ab4b-08afbed0bf3c",
gender: "male",
photo: "data:application/pdf;base64,base64EncodedPhotoString",
address: "123 Main Street, Cityville",
pincode: "560001",
state: "Karnataka",
mobileNumber: "*********6790",
emailId: "ramarao.baipalli@example.com",
organizationId: "ACHALA_HEALTH_01",
resourceType: "Practitioner",
hprId: "",
department: "urology",
designation: "surgeon",
wantsToLinkWhatsapp: true,
status: "Active",
joiningDate: "2023-05-15",
staffType: "Doctor"
}
}
Delete a practitioner
Practitioner's unique identifier
Checks whether a practitioner exists in the system using their unique identifier.
Unique identifier (Resource ID) of the practitioner to check - mandatory
A promise that resolves to:
true
if the practitioner existsRetrieves a paginated list of all practitioners.
Optional
pageSize: numberNumber of practitioners to fetch in a single page - optional
(Only effective in the first request. Default is 10 if not provided)
Optional
nextPage: stringCursor to fetch the next set of practitioners - optional
(Use the value from the previous response's nextPage
for pagination)
A promise that resolves to the practitioner's details returns:
// Input
const practitioners = await practitioner.findAll(20);
const morePractitioners = await practitioner.findAll(undefined, practitioners.nextPage);
// Expected Output
{
data: {
Entry: [
{
firstName: 'arya',
lastName: 'bunny',
// ... other fields
},
{
firstName: 'Neha',
lastName: 'Verma',
// ... other fields
}
// ... more entries
],
link: {
nextPage: 'X2NvdW50PTEwJl9zb3J0PS1fb'
},
total: 900
}
}
Fetches a list of practitioners based on provided filters.
This function allows filtering practitioners using various parameters such as name, location, contact information, and date ranges.
Pagination is supported through the nextPage
parameter.
Filters to apply while fetching practitioners:
Optional
nextPage: stringURL or token to fetch the next page of results. Used for pagination - optional
A promise resolving to the list of practitioners and metadata.
Throws an error if validation fails or request encounters an issue.
@note:
// Input:
const result = await practitioner.findByFilters({
firstName: "John",
state: "Telangana",
fromDate: "2024-01-01",
toDate: "2024-12-31"
});
console.log(result);
// Expected Output:
{
data: {
Entry: [
{
firstName: 'Joel',
middleName: 'Paul',
lastName: 'Jeripothula',
abhaAddress: 'joelpauljoel@sbx',
state: 'Telangana'
// ... other fields
},
{
firstName: 'Neha',
lastName: 'Verma',
abhaAddress: 'joelpauljoel@sbx',
state: 'Telangana'
// ... other fields
}
// ... more entries
],
total: 2
}
}
Fetches the details of a practitioner using their unique identifier.
Unique identifier (Resource ID) of the practitioner to fetch - mandatory
A promise that resolves to the practitioner's details:
// Input:
const practitioner = await practitioner.findById("767113fd-aaaf-492f-8226-347f804757b6");
console.log(practitioner);
// Expected Output:
{
type: 'Practitioner',
message: 'Practitioner Found !!!',
requestResource: {
firstName: 'Nandamuri',
lastName: 'Taraka Rama Rao',
birthDate: '1980-12-25',
registrationId: '1234567890',
resourceId: '767113fd-aaaf-492f-8226-347f804757b6',
gender: 'male',
photo: 'data:application/pdf;base64,base64EncodedPhotoString',
address: '123 Main Street, Cityville',
pincode: '560001',
state: 'Karnataka',
mobileNumber: '*********3225',
emailId: 'tarak.Nandamuri@example.com',
organizationId: 'ACHALA_HEALTH_01',
resourceType: 'Practitioner',
hprId: '',
department: 'cardiology',
designation: 'Junior Consultant',
wantsToLinkWhatsapp: true,
status: 'Active',
joiningDate: '2023-05-15',
staffType: 'Doctor'
},
totalNumberOfRecords: 1
}
Update Practitioner data.
This method validates and updates the practitioner’s details.
The updated practitioner information, including:
A promise resolving to the updated practitioner data and a success message.
// Input:
const updatedData: UpdatePractitionerDTO = {
registrationId: "PR12345",
department: "Cardiology",
designation: "Senior Surgeon",
status: "Active",
joiningDate: "2022-07-01",
staffType: "Permanent",
firstName: "Arjun",
lastName: "Rao",
birthDate: "1985-12-20",
gender: "male",
mobileNumber: "+911234567890",
emailId: "arjun.rao@hospital.com",
address: "123 Hospital Road",
pincode: "500001",
state: "Telanagana",
resourceType: "practitioner"
};
const result = await practitioner.update(updatedData);
console.log(result);
// Expected Output:
{
message: 'Details Updated successfully',
type: 'Patient',
resource: {
firstName: 'Vijaya',
middleName: 'A',
lastName: 'Doe',
.....Other Details
}
}
Provides services for managing Practitioner resources within the EHR system.
This class is the main entry point for all practitioner-related operations.
The service provides methods for: