Fix:Duplicate Doctor Assignment for Same Patient in Medical Camp
name: Bug Report
about: Report a bug in the Medical Camp Backend.
title: "[Bug]:Duplicate Doctor Assignment for Same Patient in Medical Camp "
labels: "bug"
assignees: 'koushik'
title: "fix(backend): prevent duplicate doctor assignment for same patient in camp"
🐛 Bug Report
Describe the bug
The backend currently allows the same patient to be assigned to a doctor multiple times within the same medical camp. This creates duplicate doctor assignments and leads to inconsistent consultation workflow.
To Reproduce
Steps to reproduce the behavior:
- Go to the Assign Doctor page in the medical camp workflow.
- Select a patient who is already assigned to a doctor.
- Click on Assign Doctor again for the same patient.
- The system allows the assignment again, creating a duplicate doctor assignment.
Expected behavior
The system should block duplicate doctor assignments. If a patient is already assigned to a doctor in the current camp, the backend should return an error and prevent creating another assignment record.
API details
- Endpoint: POST /api/v1/doctors/assign-doctor
Screenshots
Environment
- OS: Linux
- Browser:Firefox(HTTP Client)
- Version: Current
Additional context
This issue occurs in the backend doctor assignment (claim/start consultation) API during the medical camp workflow. Proper validation is needed to ensure a patient cannot be assigned more than once within the same camp consultation.
