/pharmacy/:pharmacyId/patient
Creates a new patient in the specified pharmacy system. This endpoint accepts patient information and creates a new customer record with all associated metadata.
idstring (optional) - Custom patient identifier for queue messagingemailstring (required)passwordstring (optional)firstNamestring (required)lastNamestring (required)gender'male' | 'female' | 'other' (required)phonestring (required)unamestring (optional)rolesstring[] (optional)dobstring (required) - ISO date formatmetaobject (optional)notificationsCountnumber (optional)emrIdnumber (optional)referrerstring (optional)sourcestring (optional)hcCardobject (optional) - Health card informationacceptMarketingboolean (optional)isInsuranceAvailableboolean (optional)providersstring[] (optional)verificationsobject (optional)provinceCodestring (optional)extrasany (optional)groupsstring[] (optional)const response = await fetch('/api/pharmacy/123/patient', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
},
body: JSON.stringify({
id: 'custom-patient-123', // Optional: will use generated ID if not provided
email: 'john.doe@example.com',
firstName: 'John',
lastName: 'Doe',
gender: 'male',
phone: '+1234567890',
dob: '1990-01-01',
meta: {
allergies: 'Penicillin',
weight: 70,
temperature: 98.6
},
hcCard: {
number: '1234567890',
version: '1.0',
effectiveDate: '2023-01-01',
expiryDate: '2028-01-01',
type: 'standard'
},
isInsuranceAvailable: true,
acceptMarketing: false
})
});
const result = await response.json();
console.log('Patient creation result:', result);
// Example response:
// {
// "success": true,
// "message": "Patient creation request queued successfully",
// "data": {
// "id": "patient-1703123456789",
// "pharmacyId": "123",
// "queueMessageId": "msg-abc123",
// "status": "queued",
// "createdAt": "2023-12-21T10:30:56.789Z"
// }
// }