fix: doctor report list shows all patient reports, upload area supports file selection, start-dev.bat starts frontends

This commit is contained in:
MingNian
2026-05-20 17:02:25 +08:00
parent 15deddfcb9
commit 5d89dcceeb
5 changed files with 109 additions and 24 deletions

View File

@@ -16,12 +16,33 @@ public class ReportController(ReportService reportService) : ControllerBase
[HttpGet]
public async Task<IActionResult> GetReports()
{
var targetUserId = UserId;
if (Role == "doctor" && Request.Query.ContainsKey("patientId"))
targetUserId = Guid.Parse(Request.Query["patientId"]!);
// Patients: see own reports. Doctors: see all reports (or filter by patientId)
if (Role == "doctor")
{
if (Request.Query.ContainsKey("patientId"))
{
var targetUserId = Guid.Parse(Request.Query["patientId"]!);
var reports = await reportService.GetPatientReportsAsync(targetUserId);
return Ok(reports.Select(r => new
{
r.Id, r.PatientId, r.Title, r.Category, r.ImageUrls, r.Status,
r.RiskLevel, r.UploadedAt, r.CompletedAt,
PatientName = r.Patient?.Name,
DoctorName = r.Doctor?.Name,
}));
}
var allReports = await reportService.GetAllReportsAsync();
return Ok(allReports.Select(r => new
{
r.Id, r.PatientId, r.Title, r.Category, r.ImageUrls, r.Status,
r.RiskLevel, r.UploadedAt, r.CompletedAt,
PatientName = r.Patient?.Name,
DoctorName = r.Doctor?.Name,
}));
}
var reports = await reportService.GetPatientReportsAsync(targetUserId);
return Ok(reports.Select(r => new
var myReports = await reportService.GetPatientReportsAsync(UserId);
return Ok(myReports.Select(r => new
{
r.Id, r.PatientId, r.Title, r.Category, r.ImageUrls, r.Status,
r.RiskLevel, r.UploadedAt, r.CompletedAt,