get_patient_encounters
Retrieve patient healthcare encounters by specifying a patient ID, date range, and status. Facilitates efficient access to visit data for clinical and administrative workflows.
Instructions
Get healthcare encounters/visits for a patient
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dateFrom | No | YYYY-MM-DD | |
| dateTo | No | YYYY-MM-DD | |
| patientId | Yes | ||
| status | No |
Implementation Reference
- The main handler function that executes the tool logic: queries FHIR Encounter resources filtered by patient ID, optional status, and date range, then formats and returns the response.async getPatientEncounters(args: any) { const params = new URLSearchParams(); params.append('patient', `${args.patientId}`); if (args.status) params.append('status', args.status); if (args.dateFrom) params.append('date', `ge${args.dateFrom}`); if (args.dateTo) params.append('date', `le${args.dateTo}`); const response = await this.client.get(`/Encounter?${params}`); return this.formatResponse(`fhir://Patient/${args.patientId}/encounters`, response.data); }
- src/server/handlers/ToolHandler.ts:74-75 (registration)Registration/dispatch point in ToolHandler.handleCall switch statement that routes the tool call to the FhirClient implementation.case "get_patient_encounters": return await this.fhirClient.getPatientEncounters(request.params.arguments);
- src/server/constants/tools.ts:68-83 (schema)Tool schema definition used for input validation and tool listing/registration via TOOL_DEFINITIONS.{ name: "get_patient_encounters", description: "Get healthcare encounters/visits for a patient", inputSchema: { type: "object", properties: { patientId: { type: "string" }, status: { type: "string", enum: ["planned", "arrived", "in-progress", "finished", "cancelled"] }, dateFrom: { type: "string", description: "YYYY-MM-DD" }, dateTo: { type: "string", description: "YYYY-MM-DD" } }, required: ["patientId"] }