feat: doctor reply + diagnosis + tracking code per health request
Backend:
- HealthRequest model: TrackingCode (DR-XXXXXX), Diagnosis,
DoctorReply, RepliedAt fields
- Runtime migration: ALTER TABLE adds 4 new columns to existing DB
- POST /api/health-request: auto-generates tracking code, returns it
- PUT /api/health-requests/{id}/reply: doctor sets diagnosis + reply
- GET /api/health-request/track/{code}: public lookup by tracking code
- GET /api/health-requests?phone=: filter history by phone number
Admin panel:
- Request table shows tracking code column (gold badge)
- Detail modal (680px): tracking code header, patient info, full message
- Previous doctor reply shown in green box if exists
- Reply form: diagnosis input + textarea for doctor message
- History panel: all requests from same phone, click to switch
- 'پاسخ / مشاهده' button opens reply modal directly
Frontend:
- After form submit: shows tracking code in green box to user
(format: DR-XXXXXX, stays visible 8 seconds)
- Box auto-hides and form resets after timeout
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -171,17 +171,23 @@ public class PatientVisit
|
||||
public class HealthRequest
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[MaxLength(150)] public string FullName { get; set; } = "";
|
||||
[MaxLength(20)] public string PhoneNumber { get; set; } = "";
|
||||
[MaxLength(200)] public string Email { get; set; } = "";
|
||||
public string Message { get; set; } = "";
|
||||
[MaxLength(20)] public string Category { get; set; } = "beauty"; // beauty | health
|
||||
public bool IsHandled { get; set; } = false;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
[MaxLength(20)] public string TrackingCode { get; set; } = ""; // e.g. DR-A3F7K2
|
||||
[MaxLength(150)] public string FullName { get; set; } = "";
|
||||
[MaxLength(20)] public string PhoneNumber { get; set; } = "";
|
||||
[MaxLength(200)] public string Email { get; set; } = "";
|
||||
public string Message { get; set; } = "";
|
||||
[MaxLength(20)] public string Category { get; set; } = "beauty"; // beauty | health
|
||||
public bool IsHandled { get; set; } = false;
|
||||
// Doctor response
|
||||
public string Diagnosis { get; set; } = ""; // پزشک: تشخیص
|
||||
public string DoctorReply { get; set; } = ""; // پزشک: پاسخ/توضیح
|
||||
public DateTime? RepliedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
// ─── DTOs ─────────────────────────────────────────────────────────────────────
|
||||
public record LoginRequest(string Username, string Password);
|
||||
public record DoctorReplyDto(string? Diagnosis, string? DoctorReply);
|
||||
public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
|
||||
public record SettingDto(string Key, string Value);
|
||||
public record BulkSettingsDto(Dictionary<string, string> Settings);
|
||||
|
||||
Reference in New Issue
Block a user