41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using Livia.Models.Data;
|
|
|
|
namespace Livia.Models;
|
|
|
|
public interface IPatientInfoManager
|
|
{
|
|
bool AnonymousMode { get; set; }
|
|
string PatientName { get; }
|
|
string PatientId { get; }
|
|
string PatientSex { get; }
|
|
string PatientAge { get; }
|
|
DateTime StudyDate { get; }
|
|
void Init(AdditionalInfoJson additionalInfo);
|
|
}
|
|
|
|
internal class PatientInfoManager : ObservableObject, IPatientInfoManager
|
|
{
|
|
public bool AnonymousMode { get => _anonymousMode; set => SetProperty(ref _anonymousMode, value); }
|
|
public string PatientName { get => _patientName; private set => SetProperty(ref _patientName, value); }
|
|
public string PatientId { get => _patientId; private set => SetProperty(ref _patientId, value); }
|
|
public string PatientSex { get => _patientSex; private set => SetProperty(ref _patientSex, value); }
|
|
public string PatientAge { get => _patientAge; private set => SetProperty(ref _patientAge, value); }
|
|
public DateTime StudyDate { get => _studyDate; private set => SetProperty(ref _studyDate, value); }
|
|
|
|
private bool _anonymousMode;
|
|
private string _patientName = string.Empty;
|
|
private string _patientId = string.Empty;
|
|
private string _patientSex = string.Empty;
|
|
private string _patientAge = string.Empty;
|
|
private DateTime _studyDate = DateTime.MinValue;
|
|
|
|
public void Init(AdditionalInfoJson additionalInfo)
|
|
{
|
|
PatientName = additionalInfo.ScanInfo.PatientName;
|
|
PatientId = additionalInfo.ScanInfo.PatientId ?? string.Empty;
|
|
PatientAge = additionalInfo.ScanInfo.PatientAge;
|
|
PatientSex = additionalInfo.ScanInfo.PatientSex;
|
|
StudyDate = DateTime.ParseExact(additionalInfo.ScanInfo.StudyDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
|
|
}
|
|
} |