SB 16-May-2019
This commit is contained in:
@@ -0,0 +1,840 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmAdmission : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Session, // Not populated - reserved for session heading.
|
||||
Id,
|
||||
|
||||
FacilityId,
|
||||
TemplateId,
|
||||
Seq,
|
||||
// Admission date.
|
||||
AdmissionFromDate,
|
||||
AdmissionFromTime,
|
||||
AdmissionFromDateTime,
|
||||
AdmissionToDate,
|
||||
AdmissionToTime,
|
||||
AdmissionToDateTime,
|
||||
Type,
|
||||
Type_Desc,
|
||||
// Dates.
|
||||
DecisionToReferOn,
|
||||
ReferredOn,
|
||||
BreechOn,
|
||||
DecisionToAdmitOn,
|
||||
// Admission details.
|
||||
Patient, // No & display name.
|
||||
PatientId,
|
||||
PatientNo,
|
||||
PatientName, // LAST, First
|
||||
PatientSurname,
|
||||
PatientForename,
|
||||
BirthAge,
|
||||
BirthOn,
|
||||
Age,
|
||||
AgeOn,
|
||||
FacilityIdWard,
|
||||
Ward,
|
||||
ProcedureId,
|
||||
SpecialityCode,
|
||||
Procedure,
|
||||
ComplexityCode,
|
||||
ProcedureIndication,
|
||||
DurationExp,
|
||||
DurationAct,
|
||||
Anaesthetic,
|
||||
Position,
|
||||
SpecialEquipment,
|
||||
AttendanceStatusDesc,
|
||||
ComfortScore,
|
||||
// Admission timings.
|
||||
TimeCalled,
|
||||
TimeArrived,
|
||||
TimeAnaesStart,
|
||||
TimeProcStart,
|
||||
TimeProcEnd,
|
||||
TimeInRecovery,
|
||||
TimeInformDest,
|
||||
TimeLeave,
|
||||
// Cancellations.
|
||||
CancelType,
|
||||
CancelTypeDesc,
|
||||
CancelDate,
|
||||
CancelElapsed,
|
||||
CancelReBookBy,
|
||||
CancelReBookDue,
|
||||
CancelCount,
|
||||
Notes,
|
||||
// Facility.
|
||||
Facility_Type,
|
||||
Facility_TypeDesc,
|
||||
Facility_Name,
|
||||
Facility_Desc,
|
||||
Facility_TemplateMapType,
|
||||
Facility_ApplicFrom,
|
||||
Facility_ApplicTo,
|
||||
Facility_Notes,
|
||||
// Facility Template.
|
||||
Template_WeekOfMonth,
|
||||
Template_DayOfWeek,
|
||||
Template_ConsultantId,
|
||||
Template_ConsultantCode,
|
||||
Template_SpecialityCode,
|
||||
Template_StartAt,
|
||||
Template_FinishAt,
|
||||
Template_CategoryDesc,
|
||||
Template_TypeDesc,
|
||||
Template_Name,
|
||||
Template_Desc,
|
||||
Template_Group,
|
||||
Template_ApplicFrom,
|
||||
Template_ApplicTo,
|
||||
Template_Notes,
|
||||
// Facility Session.
|
||||
Session_TemplateId,
|
||||
Session_ConsultantId,
|
||||
Session_ConsultantCode,
|
||||
Session_SpecialityCode,
|
||||
Session_StartAt,
|
||||
Session_FinishAt,
|
||||
Session_Name,
|
||||
Session_Desc,
|
||||
Session_Flags,
|
||||
Session_Notes,
|
||||
// Session definition (combined template and date-specific session info):
|
||||
SessionDfn_Summary,
|
||||
SessionDfn_Name,
|
||||
// Patient.
|
||||
Patient_PatientNo,
|
||||
Patient_Surname,
|
||||
Patient_Forename,
|
||||
Patient_BirthOn,
|
||||
Patient_Age,
|
||||
Patient_AgeOn,
|
||||
// Members of staff (Role-categories not in use are commented out).
|
||||
Role_Consultant_Operating_Code,
|
||||
Role_Consultant_Referring_Code,
|
||||
//Role_Consultant_Attending_Code,
|
||||
Role_Surgeon_Operating_Code,
|
||||
//Role_Surgeon_Referring_Code,
|
||||
//Role_Surgeon_Attending_Code,
|
||||
Role_Anaesthetist_Operating_Code,
|
||||
|
||||
// Common properties.
|
||||
//Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = AdmissionStatus;
|
||||
}
|
||||
public SysId FacilityId { get; set; }
|
||||
public SysId FacilityTemplateId { get; set; }
|
||||
public DateTime AdmissionFrom { get; set; }
|
||||
public DateTime AdmissionTo { get; set; }
|
||||
public DateTime ToComeIn { get; set; }
|
||||
public bool RequiresSeq() { return RequiresSeq(/*AdmissionType*/); }
|
||||
public ushort Seq { get; set; }
|
||||
public Spm.AdmissionType AdmissionType { get; set; }
|
||||
public Spm.AdmissionOccupancy Occupancy { get; set; }
|
||||
public DateTime DecisionToReferOn { get; set; }
|
||||
public DateTime ReferredOn { get; set; }
|
||||
public DateTime DecisionToAdmitOn { get; set; }
|
||||
public DateTime BreechOn { get; set; }
|
||||
public SysId PatientId { get; set; }
|
||||
public String PatientNo { get; set; }
|
||||
public String NhsNumber { get; set; }
|
||||
public String Title { get; set; }
|
||||
public String Forename { get; set; }
|
||||
public String Surname { get; set; }
|
||||
public Spm.Gender Gender { get; set; }
|
||||
public DateTime BirthOn { get; set; }
|
||||
public String Age { get; set; }
|
||||
public DateTime AgeOn { get; set; }
|
||||
public SysId FacilityIdWard { get; set; }
|
||||
public String Ward { get; set; }
|
||||
public SysId ProcedureId { get; set; }
|
||||
public String SpecialityCode { get; set; }
|
||||
public String ProcedureDesc { get; set; }
|
||||
public String ComplexityCode { get; set; }
|
||||
public String ProcedureIndication { get; set; }
|
||||
public String PatientHistory { get; set; }
|
||||
public String GestationPeriod { get; set; }
|
||||
public String SystemRef { get; set; }
|
||||
public ushort DurationExp { get; set; }
|
||||
public ushort DurationAct { get; set; }
|
||||
public decimal UnitsExp { get; set; }
|
||||
public decimal UnitsAct { get; set; }
|
||||
public String Anaesthetic { get; set; }
|
||||
public String Position { get; set; }
|
||||
public String SpecialEquipment { get; set; }
|
||||
public Spm.AttendanceType AttendanceType { get; set; }
|
||||
public String AttendanceStatus { get; set; }
|
||||
public String ComfortScore { get; set; }
|
||||
|
||||
// Admission times.
|
||||
public DateTime TimeCalled { get; set; }
|
||||
public DateTime TimeArrived { get; set; }
|
||||
public DateTime TimeAnaesStart { get; set; }
|
||||
public DateTime TimeProcStart { get; set; }
|
||||
public DateTime TimeProcEnd { get; set; }
|
||||
public DateTime TimeInRecovery { get; set; }
|
||||
public DateTime TimeInformDest { get; set; }
|
||||
public DateTime TimeLeave { get; set; }
|
||||
|
||||
// Cancellation.
|
||||
public static bool IsCancelled(Spm.AdmissionCancelType cancel) { return (cancel != Spm.AdmissionCancelType.None); }
|
||||
public bool IsCancelled() { return IsCancelled(/*CancelType*/); }
|
||||
public Spm.AdmissionCancelType CancelType { get; set; }
|
||||
public DateTime CancelDate { get; set; }
|
||||
public ushort CancelCount { get; set; }
|
||||
public String CancelCode { get; set; }
|
||||
public String CancelReason { get; set; }
|
||||
|
||||
// Flags.
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
FacilityId = data.FacilityId;
|
||||
FacilityTemplateId = data.FacilityTemplateId;
|
||||
AdmissionFrom = data.AdmissionFrom;
|
||||
AdmissionTo = data.AdmissionTo;
|
||||
ToComeIn = data.ToComeIn;
|
||||
Seq = data.Seq;
|
||||
AdmissionType = data.AdmissionType;
|
||||
Occupancy = data.Occupancy;
|
||||
DecisionToReferOn = data.DecisionToReferOn;
|
||||
ReferredOn = data.ReferredOn;
|
||||
DecisionToAdmitOn = data.DecisionToAdmitOn;
|
||||
BreechOn = data.BreechOn;
|
||||
PatientId = data.PatientId;
|
||||
PatientNo = data.PatientNo;
|
||||
NhsNumber = data.NhsNumber;
|
||||
Title = data.Title;
|
||||
Forename = data.Forename;
|
||||
Surname = data.Surname;
|
||||
Gender = data.Gender;
|
||||
BirthOn = data.BirthOn;
|
||||
Age = data.Age;
|
||||
AgeOn = data.AgeOn;
|
||||
FacilityIdWard = data.FacilityIdWard;
|
||||
Ward = data.Ward;
|
||||
ProcedureId = data.ProcedureId;
|
||||
SpecialityCode = data.SpecialityCode;
|
||||
ProcedureDesc = data.ProcedureDesc;
|
||||
ComplexityCode = data.ComplexityCode;
|
||||
ProcedureIndication = data.ProcedureIndication;
|
||||
PatientHistory = data.PatientHistory;
|
||||
GestationPeriod = data.GestationPeriod;
|
||||
SystemRef = data.SystemRef;
|
||||
DurationExp = data.DurationExp;
|
||||
DurationAct = data.DurationAct;
|
||||
UnitsExp = data.UnitsExp;
|
||||
UnitsAct = data.UnitsAct;
|
||||
Anaesthetic = data.Anaesthetic;
|
||||
Position = data.Position;
|
||||
SpecialEquipment = data.SpecialEquipment;
|
||||
AttendanceType = data.AttendanceType;
|
||||
AttendanceStatus = data.AttendanceStatus;
|
||||
ComfortScore = data.ComfortScore;
|
||||
TimeCalled = data.TimeCalled;
|
||||
TimeArrived = data.TimeArrived;
|
||||
TimeAnaesStart = data.TimeAnaesStart;
|
||||
TimeProcStart = data.TimeProcStart;
|
||||
TimeProcEnd = data.TimeProcEnd;
|
||||
TimeInRecovery = data.TimeInRecovery;
|
||||
TimeInformDest = data.TimeInformDest;
|
||||
TimeLeave = data.TimeLeave;
|
||||
CancelType = data.CancelType;
|
||||
CancelDate = data.CancelDate;
|
||||
CancelCount = data.CancelCount;
|
||||
CancelCode = data.CancelCode;
|
||||
CancelReason = data.CancelReason;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue FacilityId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FacilityTemplateId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AdmissionFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AdmissionTo { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ToComeIn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Seq { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AdmissionType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Occupancy { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DecisionToReferOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ReferredOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DecisionToAdmitOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue BreechOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PatientId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PatientNo { get; set; } = ValidValue.Valid;
|
||||
public ValidValue NhsNumber { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Title { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Forename { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Surname { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Gender { get; set; } = ValidValue.Valid;
|
||||
public ValidValue BirthOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Age { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AgeOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FacilityIdWard { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Ward { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ProcedureId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SpecialityCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ProcedureDesc { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ComplexityCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ProcedureIndication { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PatientHistory { get; set; } = ValidValue.Valid;
|
||||
public ValidValue GestationPeriod { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SystemRef { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationExp { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationAct { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UnitsExp { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UnitsAct { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Anaesthetic { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Position { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SpecialEquipment { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AttendanceType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AttendanceStatus { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ComfortScore { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeCalled { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeArrived { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeAnaesStart { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeProcStart { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeProcEnd { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeInRecovery { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeInformDest { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TimeLeave { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CancelType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CancelDate { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CancelCount { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CancelCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CancelReason { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly ushort Flag_HasRisk = 0x01;
|
||||
public static readonly ushort Flag_HighlightNotes = 0x02;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmAdmission(SysId facilityId, SysId facilityTemplateId) : base()
|
||||
{
|
||||
facilityId = FacilityId;
|
||||
facilityTemplateId = FacilityTemplateId;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> admissionStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> AdmissionStatuses { get { return new List<SaStatus>(admissionStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
admissionStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { CheckChanged(data.FacilityId, value); data.FacilityId = value; }
|
||||
}
|
||||
public SysId FacilityTemplateId
|
||||
{
|
||||
get { return data.FacilityTemplateId; }
|
||||
set { CheckChanged(data.FacilityTemplateId, value); data.FacilityTemplateId = value; }
|
||||
}
|
||||
public DateTime AdmissionFrom
|
||||
{
|
||||
get { return data.AdmissionFrom; }
|
||||
set { CheckChanged(data.AdmissionFrom, value); data.AdmissionFrom = value; }
|
||||
}
|
||||
public DateTime AdmissionTo
|
||||
{
|
||||
get { return data.AdmissionTo; }
|
||||
set { CheckChanged(data.AdmissionTo, value); data.AdmissionTo = value; }
|
||||
}
|
||||
public DateTime ToComeIn
|
||||
{
|
||||
get { return data.ToComeIn; }
|
||||
set { CheckChanged(data.ToComeIn, value); data.ToComeIn = value; }
|
||||
}
|
||||
public static bool RequiresSeq(Spm.AdmissionType admissionType)
|
||||
{
|
||||
switch (admissionType)
|
||||
{
|
||||
// Ward and clinic admission do not require a sequence.
|
||||
case Spm.AdmissionType.WardAdmission:
|
||||
case Spm.AdmissionType.WardReservation:
|
||||
case Spm.AdmissionType.ClinicBooking:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public ushort Seq
|
||||
{
|
||||
get { return data.Seq; }
|
||||
set { CheckChanged(data.Seq, value); data.Seq = value; }
|
||||
}
|
||||
public Spm.AdmissionType AdmissionType
|
||||
{
|
||||
get { return data.AdmissionType; }
|
||||
set { CheckChanged((int)data.AdmissionType, (int)value); data.AdmissionType = value; }
|
||||
}
|
||||
public Spm.AdmissionOccupancy Occupancy
|
||||
{
|
||||
get { return data.Occupancy; }
|
||||
set { CheckChanged((int)data.Occupancy, (int)value); data.Occupancy = value; }
|
||||
}
|
||||
|
||||
public bool IsTheatreAdmission()
|
||||
{
|
||||
switch (AdmissionType)
|
||||
{
|
||||
case Spm.AdmissionType.TheatreDayCase:
|
||||
case Spm.AdmissionType.TheatreInPatientElective:
|
||||
case Spm.AdmissionType.TheatreEmergency:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool IsClinicAdmission()
|
||||
{
|
||||
switch (AdmissionType)
|
||||
{
|
||||
case Spm.AdmissionType.ClinicBooking:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool IsWardAdmission()
|
||||
{
|
||||
switch (AdmissionType)
|
||||
{
|
||||
case Spm.AdmissionType.WardAdmission:
|
||||
case Spm.AdmissionType.WardReservation:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public DateTime DecisionToReferOn
|
||||
{
|
||||
get { return data.DecisionToReferOn; }
|
||||
set { CheckChanged(data.DecisionToReferOn, value); data.DecisionToReferOn = value; }
|
||||
}
|
||||
public DateTime ReferredOn
|
||||
{
|
||||
get { return data.ReferredOn; }
|
||||
set { CheckChanged(data.ReferredOn, value); data.ReferredOn = value; }
|
||||
}
|
||||
public DateTime DecisionToAdmitOn
|
||||
{
|
||||
get { return data.DecisionToAdmitOn; }
|
||||
set { CheckChanged(data.DecisionToAdmitOn, value); data.DecisionToAdmitOn = value; }
|
||||
}
|
||||
public DateTime BreechOn
|
||||
{
|
||||
get { return data.BreechOn; }
|
||||
set { CheckChanged(data.BreechOn, value); data.BreechOn = value; }
|
||||
}
|
||||
public SysId PatientId
|
||||
{
|
||||
get { return data.PatientId; }
|
||||
set { CheckChanged(data.PatientId, value); data.PatientId = value; }
|
||||
}
|
||||
public String PatientNo
|
||||
{
|
||||
get { return data.PatientNo; }
|
||||
set { CheckChanged(data.PatientNo, value); data.PatientNo = value; }
|
||||
}
|
||||
public String NhsNumber
|
||||
{
|
||||
get { return data.NhsNumber; }
|
||||
set { CheckChanged(data.NhsNumber, value); data.NhsNumber = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { CheckChanged(data.Title, value); data.Title = value; }
|
||||
}
|
||||
public String Forename
|
||||
{
|
||||
get { return data.Forename; }
|
||||
set { CheckChanged(data.Forename, value); data.Forename = value; }
|
||||
}
|
||||
public String Surname
|
||||
{
|
||||
get { return data.Surname; }
|
||||
set { CheckChanged(data.Surname, value); data.Surname = value; }
|
||||
}
|
||||
public static String GetDisplayName(String surname, String forename, bool upperSurname = true)
|
||||
{
|
||||
String name = surname;
|
||||
if (upperSurname)
|
||||
name.ToUpper();
|
||||
if (!StringUtil.IsEmpty(surname) && !StringUtil.IsEmpty(forename))
|
||||
name += ", ";
|
||||
name += forename;
|
||||
return name;
|
||||
}
|
||||
public String GetDisplayName(bool upperSurname = true)
|
||||
{
|
||||
return GetDisplayName(Surname, Forename, upperSurname);
|
||||
}
|
||||
public Spm.Gender Gender
|
||||
{
|
||||
get { return data.Gender; }
|
||||
set { CheckChanged((int)data.Gender, (int)value); data.Gender = value; }
|
||||
}
|
||||
public DateTime BirthOn
|
||||
{
|
||||
get { return data.BirthOn; }
|
||||
set { CheckChanged(data.BirthOn, value); data.BirthOn = value; }
|
||||
}
|
||||
public String Age
|
||||
{
|
||||
get { return data.Age; }
|
||||
set { CheckChanged(data.Age, value); data.Age = value; }
|
||||
}
|
||||
public DateTime AgeOn
|
||||
{
|
||||
get { return data.AgeOn; }
|
||||
set { CheckChanged(data.AgeOn, value); data.AgeOn = value; }
|
||||
}
|
||||
public String GetPatientAge(DateTime dob, DateTime ageOn)
|
||||
{
|
||||
String patientAge = "";
|
||||
if (DateUtil.IsValid(dob) && DateUtil.IsValid(ageOn) && dob < ageOn)
|
||||
{
|
||||
/*ushort age = Date::CalculateAge(dob, ageOn);
|
||||
ushort ageMonths = Date::CalculateAgeMonths(dob, ageOn);
|
||||
if (age >= 2) patientAge = age.ToString();
|
||||
else if (ageMonths > 0) patientAge = ageMonths.ToString() + "M";*/
|
||||
}
|
||||
return patientAge;
|
||||
}
|
||||
public SysId FacilityIdWard
|
||||
{
|
||||
get { return data.FacilityIdWard; }
|
||||
set { CheckChanged(data.FacilityIdWard, value); data.FacilityIdWard = value; }
|
||||
}
|
||||
public String Ward
|
||||
{
|
||||
get { return data.Ward; }
|
||||
set { CheckChanged(data.Ward, value); data.Ward = value; }
|
||||
}
|
||||
public SysId ProcedureId
|
||||
{
|
||||
get { return data.ProcedureId; }
|
||||
set { CheckChanged(data.ProcedureId, value); data.ProcedureId = value; }
|
||||
}
|
||||
public String SpecialityCode
|
||||
{
|
||||
get { return data.SpecialityCode; }
|
||||
set { CheckChanged(data.SpecialityCode, value); data.SpecialityCode = value; }
|
||||
}
|
||||
public String ProcedureDesc
|
||||
{
|
||||
get { return data.ProcedureDesc; }
|
||||
set { CheckChanged(data.ProcedureDesc, value); data.ProcedureDesc = value; }
|
||||
}
|
||||
public String ComplexityCode
|
||||
{
|
||||
get { return data.ComplexityCode; }
|
||||
set { CheckChanged(data.ComplexityCode, value); data.ComplexityCode = value; }
|
||||
}
|
||||
public String ProcedureIndication
|
||||
{
|
||||
get { return data.ProcedureIndication; }
|
||||
set { CheckChanged(data.ProcedureIndication, value); data.ProcedureIndication = value; }
|
||||
}
|
||||
public String PatientHistory
|
||||
{
|
||||
get { return data.PatientHistory; }
|
||||
set { CheckChanged(data.PatientHistory, value); data.PatientHistory = value; }
|
||||
}
|
||||
public String GestationPeriod
|
||||
{
|
||||
get { return data.GestationPeriod; }
|
||||
set { CheckChanged(data.GestationPeriod, value); data.GestationPeriod = value; }
|
||||
}
|
||||
public String SystemRef
|
||||
{
|
||||
get { return data.SystemRef; }
|
||||
set { CheckChanged(data.SystemRef, value); data.SystemRef = value; }
|
||||
}
|
||||
public ushort DurationExp
|
||||
{
|
||||
get { return data.DurationExp; }
|
||||
set { CheckChanged(data.DurationExp, value); data.DurationExp = value; }
|
||||
}
|
||||
public ushort DurationAct
|
||||
{
|
||||
get { return data.DurationAct; }
|
||||
set { CheckChanged(data.DurationAct, value); data.DurationAct = value; }
|
||||
}
|
||||
public decimal UnitsExp
|
||||
{
|
||||
get { return data.UnitsExp; }
|
||||
set { CheckChanged(data.UnitsExp, value); data.UnitsExp = value; }
|
||||
}
|
||||
public decimal UnitsAct
|
||||
{
|
||||
get { return data.UnitsAct; }
|
||||
set { CheckChanged(data.UnitsAct, value); data.UnitsAct = value; }
|
||||
}
|
||||
public String Anaesthetic
|
||||
{
|
||||
get { return data.Anaesthetic; }
|
||||
set { CheckChanged(data.Anaesthetic, value); data.Anaesthetic = value; }
|
||||
}
|
||||
public String Position
|
||||
{
|
||||
get { return data.Position; }
|
||||
set { CheckChanged(data.Position, value); data.Position = value; }
|
||||
}
|
||||
public String SpecialEquipment
|
||||
{
|
||||
get { return data.SpecialEquipment; }
|
||||
set { CheckChanged(data.SpecialEquipment, value); data.SpecialEquipment = value; }
|
||||
}
|
||||
public Spm.AttendanceType AttendanceType
|
||||
{
|
||||
get { return data.AttendanceType; }
|
||||
set { CheckChanged((int)data.AttendanceType, (int)value); data.AttendanceType = value; }
|
||||
}
|
||||
public String AttendanceStatus
|
||||
{
|
||||
get { return data.AttendanceStatus; }
|
||||
set { CheckChanged(data.AttendanceStatus, value); data.AttendanceStatus = value; }
|
||||
}
|
||||
public String ComfortScore
|
||||
{
|
||||
get { return data.ComfortScore; }
|
||||
set { CheckChanged(data.ComfortScore, value); data.ComfortScore = value; }
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Admission time.
|
||||
public DateTime TimeCalled
|
||||
{
|
||||
get { return data.TimeCalled; }
|
||||
set { CheckChanged(data.TimeCalled, value); data.TimeCalled = value; }
|
||||
}
|
||||
public DateTime TimeArrived
|
||||
{
|
||||
get { return data.TimeArrived; }
|
||||
set { CheckChanged(data.TimeArrived, value); data.TimeArrived = value; }
|
||||
}
|
||||
public DateTime TimeAnaesStart
|
||||
{
|
||||
get { return data.TimeAnaesStart; }
|
||||
set { CheckChanged(data.TimeAnaesStart, value); data.TimeAnaesStart = value; }
|
||||
}
|
||||
public DateTime TimeProcStart
|
||||
{
|
||||
get { return data.TimeProcStart; }
|
||||
set { CheckChanged(data.TimeProcStart, value); data.TimeProcStart = value; }
|
||||
}
|
||||
public DateTime TimeProcEnd
|
||||
{
|
||||
get { return data.TimeProcEnd; }
|
||||
set { CheckChanged(data.TimeProcEnd, value); data.TimeProcEnd = value; }
|
||||
}
|
||||
public DateTime TimeInRecovery
|
||||
{
|
||||
get { return data.TimeInRecovery; }
|
||||
set { CheckChanged(data.TimeInRecovery, value); data.TimeInRecovery = value; }
|
||||
}
|
||||
public DateTime TimeInformDest
|
||||
{
|
||||
get { return data.TimeInformDest; }
|
||||
set { CheckChanged(data.TimeInformDest, value); data.TimeInformDest = value; }
|
||||
}
|
||||
public DateTime TimeLeave
|
||||
{
|
||||
get { return data.TimeLeave; }
|
||||
set { CheckChanged(data.TimeLeave, value); data.TimeLeave = value; }
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Cancellation.
|
||||
public Spm.AdmissionCancelType CancelType
|
||||
{
|
||||
get { return data.CancelType; }
|
||||
set { CheckChanged((int)data.CancelType, (int)value); data.CancelType = value; }
|
||||
}
|
||||
public DateTime CancelDate
|
||||
{
|
||||
get { return data.CancelDate; }
|
||||
set { CheckChanged(data.CancelDate, value); data.CancelDate = value; }
|
||||
}
|
||||
public ushort CancelCount
|
||||
{
|
||||
get { return data.CancelCount; }
|
||||
set { CheckChanged(data.CancelCount, value); data.CancelCount = value; }
|
||||
}
|
||||
public String CancelCode
|
||||
{
|
||||
get { return data.CancelCode; }
|
||||
set { CheckChanged(data.CancelCode, value); data.CancelCode = value; }
|
||||
}
|
||||
public String CancelReason
|
||||
{
|
||||
get { return data.CancelReason; }
|
||||
set { CheckChanged(data.CancelReason, value); data.CancelReason = value; }
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
public bool HasRisk
|
||||
{
|
||||
get { return GetFlag(Flag_HasRisk); }
|
||||
set { SetFlag(Flag_HasRisk, value); }
|
||||
}
|
||||
public bool HighlightNotes
|
||||
{
|
||||
get { return GetFlag(Flag_HighlightNotes); }
|
||||
set { SetFlag(Flag_HighlightNotes, value); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
// Admission Roles
|
||||
public bool HasRoles() { return HasRole(Spm.EmployeeRole.Unknown, ""); }
|
||||
public abstract bool HasRole(Spm.EmployeeRole admissionRole); // Any admission.
|
||||
public abstract bool HasRole(Spm.EmployeeRole admissionRole, String admissionCode); // Specific emloyee.
|
||||
public abstract List<SpmAdmissionRole> GetRoles();
|
||||
public abstract bool SetRoles(List<SpmAdmissionRole> admissionRoles); // Without commiting the changes.
|
||||
public abstract bool CommitRoles();
|
||||
|
||||
// Admission Action.
|
||||
public bool HasActions() { return HasAction(Spm.AdmissionActionType.Unknown); }
|
||||
public abstract bool HasAction(Spm.AdmissionActionType admissionActionType); // Any admission.
|
||||
public abstract bool GetActions();
|
||||
public abstract bool SetActions(); // Without commiting the changes.
|
||||
public abstract bool CommitActions();
|
||||
|
||||
|
||||
// Admission Data.
|
||||
public bool HasDatas() { return HasData(Spm.AdmissionDataType.Unknown); }
|
||||
public abstract bool HasData(Spm.AdmissionDataType admissionDataType); // Any admission.
|
||||
public abstract bool GetDatas();
|
||||
public abstract bool SetDatas(); // Without commiting the changes.
|
||||
public abstract bool CommitDatas();
|
||||
|
||||
public abstract List<String> GetProcedureKits();
|
||||
public abstract List<String> GetAllergies();
|
||||
public abstract List<String> GetRiskFactors();
|
||||
public abstract bool SetProcedureKits(List<String> procedures);
|
||||
public abstract bool SetAllergies(List<String> allergies);
|
||||
public abstract bool SetRiskFactors(List<String> riskFactors);
|
||||
|
||||
public abstract bool ClearAssociatedData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Admission.
|
||||
public DateTime Admission { get; set; }
|
||||
public DateTime AdmissionFrom { get; set; }
|
||||
public DateTime AdmissionTo { get; set; }
|
||||
public SysId DepartmentId { get; set; }
|
||||
public SysId FacilityId { get; set; }
|
||||
public SysId FacilityTemplateId { get; set; }
|
||||
public Spm.FacilityType FacilityType { get; set; }
|
||||
public int MaxSeq { get; set; }
|
||||
public int MinSeq { get; set; }
|
||||
public Spm.AdmissionCancelType CancelType { get; set; }
|
||||
public String PatientNoFull { get; set; }
|
||||
public String PatientNoPartial { get; set; }
|
||||
public String PatientSurname { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// A d m i s s i o n D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmAdmissionList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmAdmissionAction : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
AdmissionId,
|
||||
Type,
|
||||
Type_Desc,
|
||||
// Admission details.
|
||||
Admission_FacilityId,
|
||||
Admission_TemplateId,
|
||||
AdmissionFrom,
|
||||
AdmissionFromDateTime,
|
||||
AdmissionFromDate,
|
||||
AdmissionFromTime,
|
||||
AdmissionTo,
|
||||
AdmissionToDate,
|
||||
AdmissionToTime,
|
||||
AdmissionType,
|
||||
AdmissionTypeDesc,
|
||||
AdmissionNotes,
|
||||
AdmissionFlags,
|
||||
AdmissionStatus,
|
||||
AdmissionStatusInd,
|
||||
// Admission patient details.
|
||||
Patient, // No & display name.
|
||||
PatientId,
|
||||
PatientNo,
|
||||
PatientSurname,
|
||||
PatientForename,
|
||||
// Facility:
|
||||
Facility_Name,
|
||||
Facility_Desc,
|
||||
Facility_Notes,
|
||||
// Facility Template.
|
||||
Template_Name,
|
||||
Template_Desc,
|
||||
Template_Notes,
|
||||
// Session definition (combined template and date-specific session info).
|
||||
SessionDfn_Summary,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = AdmissionActionStatus;
|
||||
}
|
||||
public SysId AdmissionId { get; set; }
|
||||
public Spm.AdmissionActionType AdmissionActionType { get; set; }
|
||||
public DateTime Raised { get; set; }
|
||||
public SysId EmployeeIdRaised { get; set; }
|
||||
public DateTime Completed { get; set; }
|
||||
public SysId EmployeeIdCompleted { get; set; }
|
||||
public String ActionData { get; set; }
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
AdmissionId = data.AdmissionId;
|
||||
AdmissionActionType = data.AdmissionActionType;
|
||||
Raised = data.Raised;
|
||||
EmployeeIdRaised = data.EmployeeIdRaised;
|
||||
Completed = data.Completed;
|
||||
EmployeeIdCompleted = data.EmployeeIdCompleted;
|
||||
ActionData = data.ActionData;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue AdmissionId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AdmissionActionType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Raised { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeIdRaised { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Completed { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeIdCompleted { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ActionData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmAdmissionAction(SysId id, SysId admissionId, Spm.AdmissionActionType admissionActionType) : base(id)
|
||||
{
|
||||
id = Id;
|
||||
admissionId = AdmissionId;
|
||||
admissionActionType = AdmissionActionType;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> admissionActionStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> AdmissionActionStatuses { get { return new List<SaStatus>(admissionActionStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
admissionActionStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId AdmissionId
|
||||
{
|
||||
get { return data.AdmissionId; }
|
||||
set { CheckChanged(data.AdmissionId, value); data.AdmissionId = value; }
|
||||
}
|
||||
public Spm.AdmissionActionType AdmissionActionType
|
||||
{
|
||||
get { return data.AdmissionActionType; }
|
||||
set { CheckChanged((int)data.AdmissionActionType, (int)value); data.AdmissionActionType = value; }
|
||||
}
|
||||
public DateTime Raised
|
||||
{
|
||||
get { return data.Raised; }
|
||||
set { CheckChanged(data.Raised, value); data.Raised = value; }
|
||||
}
|
||||
public SysId EmployeeIdRaised
|
||||
{
|
||||
get { return data.EmployeeIdRaised; }
|
||||
set { CheckChanged(data.EmployeeIdRaised, value); data.EmployeeIdRaised = value; }
|
||||
}
|
||||
public DateTime Completed
|
||||
{
|
||||
get { return data.Completed; }
|
||||
set { CheckChanged(data.Completed, value); data.Completed = value; }
|
||||
}
|
||||
public SysId EmployeeIdCompleted
|
||||
{
|
||||
get { return data.EmployeeIdCompleted; }
|
||||
set { CheckChanged(data.EmployeeIdCompleted, value); data.EmployeeIdCompleted = value; }
|
||||
}
|
||||
public String ActionData
|
||||
{
|
||||
get { return data.ActionData; }
|
||||
set { CheckChanged(data.ActionData, value); data.ActionData = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
|
||||
|
||||
public int Compare(SpmAdmissionAction action)
|
||||
{
|
||||
SaStatus status1 = new SaStatus();
|
||||
SaStatus status2 = action.Status;
|
||||
// 'Required' actions always occur earlier in the list.
|
||||
if (status1 == SaStatus.Required && status2 != SaStatus.Required) return -1;
|
||||
if (status1 != SaStatus.Required && status2 == SaStatus.Required) return 1;
|
||||
// Followed by 'Completed' actions.
|
||||
if (status1 == SaStatus.Completed && status2 != SaStatus.Completed) return -1;
|
||||
if (status1 != SaStatus.Completed && status2 == SaStatus.Completed) return 1;
|
||||
// Sort by 'Raised' date.
|
||||
int iCompareRaised = Raised.CompareTo(action.Raised);
|
||||
if (iCompareRaised != 0) return iCompareRaised;
|
||||
// Sort by type.
|
||||
if (AdmissionActionType < action.AdmissionActionType) return -1;
|
||||
if (AdmissionActionType > action.AdmissionActionType) return 1;
|
||||
return -1; // To retain previous sequence.
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Admission Action.
|
||||
public SysId Id { get; set; }
|
||||
public SysId AdmissionId { get; set; }
|
||||
public SysId DepartmentId { get; set; }
|
||||
public SysId FacilityId { get; set; }
|
||||
public Spm.AdmissionActionType AdmissionActionType { get; set; }
|
||||
public DateTime Raised { get; set; }
|
||||
public SysId EmployeeIdRaised { get; set; }
|
||||
public DateTime Completed { get; set; }
|
||||
public SysId EmployeeIdCompleted { get; set; }
|
||||
public String ActionData { get; set; }
|
||||
public bool RequiredOnly { get; set; } = true;
|
||||
public bool ExcludeCancelled { get; set; } = true;
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// AdmissionAction D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmAdmissionActionList
|
||||
{
|
||||
public static int CompareByNameSeq(SpmAdmissionAction action1, SpmAdmissionAction action2)
|
||||
{
|
||||
if (action1 == null || action2 == null) return 0;
|
||||
return action1.Compare(action2);
|
||||
}
|
||||
public enum SortMode { SortActionRequiredRaised, };
|
||||
|
||||
public static void Sort(this List<SpmAdmissionAction> values, SortMode sortActionRequiredRaised, bool ascending = true)
|
||||
{
|
||||
if (sortActionRequiredRaised == SortMode.SortActionRequiredRaised)
|
||||
values.Sort
|
||||
(
|
||||
delegate (SpmAdmissionAction action1, SpmAdmissionAction action2)
|
||||
{
|
||||
return CompareByNameSeq(action1, action2);
|
||||
}
|
||||
);
|
||||
}
|
||||
public static bool SetIdentity(this List<SpmAdmissionAction> values, SpmAdmission admission)
|
||||
{
|
||||
foreach (SpmAdmissionAction admissionAction in values)
|
||||
admissionAction.AdmissionId = admission.Id;
|
||||
return true;
|
||||
}
|
||||
|
||||
// HasAction
|
||||
|
||||
// HasRequiredAction
|
||||
|
||||
public static bool Find(this List<SpmAdmissionAction> values, SpmAdmissionAction admissionAction)
|
||||
{
|
||||
if (admissionAction == null) return false;
|
||||
return (values.Find(item => item == admissionAction) != null);
|
||||
}
|
||||
public static bool FindById(this List<SpmAdmissionAction> values, SysId admissionActionId)
|
||||
{
|
||||
if (!SysId.IsValid(admissionActionId)) return false;
|
||||
return values.Exists(item => item.Id.Equals(admissionActionId));
|
||||
}
|
||||
public static bool FindByType(this List<SpmAdmissionAction> values, String admissionActionType)
|
||||
{
|
||||
if (StringUtil.IsEmpty(admissionActionType)) return false;
|
||||
return values.Exists(item => item.AdmissionActionType.ToString().EqualsCI(admissionActionType));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmAdmissionData : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
AdmissionId,
|
||||
Type,
|
||||
Type_Desc,
|
||||
AdmissionData,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = AdmissionDataStatus;
|
||||
}
|
||||
public SysId AdmissionId { get; set; }
|
||||
public Spm.AdmissionDataType AdmissionDataType { get; set; }
|
||||
public String AdmissionData { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
AdmissionId = data.AdmissionId;
|
||||
AdmissionDataType = data.AdmissionDataType;
|
||||
AdmissionData = data.AdmissionData;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue AdmissionId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AdmissionDataType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AdmissionData { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmAdmissionData(SysId admissionId, Spm.AdmissionDataType admissionDataType) : base()
|
||||
{
|
||||
admissionId = AdmissionId;
|
||||
admissionDataType = AdmissionDataType;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> admissionDataStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> AdmissionDataStatuses { get { return new List<SaStatus>(admissionDataStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
admissionDataStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId AdmissionId
|
||||
{
|
||||
get { return data.AdmissionId; }
|
||||
set { CheckChanged(data.AdmissionId, value); data.AdmissionId = value; }
|
||||
}
|
||||
public Spm.AdmissionDataType AdmissionDataType
|
||||
{
|
||||
get { return data.AdmissionDataType; }
|
||||
set { CheckChanged((int)data.AdmissionDataType, (int)value); data.AdmissionDataType = value; }
|
||||
}
|
||||
public String AdmissionData
|
||||
{
|
||||
get { return data.AdmissionData; }
|
||||
set { CheckChanged(data.AdmissionData, value); data.AdmissionData = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Admission Data.
|
||||
public SysId AdmissionId { get; set; }
|
||||
public Spm.AdmissionDataType AdmissionDataType { get; set; }
|
||||
public String AdmissionData { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// AdmissionData D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmAdmissionDataList
|
||||
{
|
||||
/// <summary>Check whether admission data exists/locate in list with specified Id.</summary>
|
||||
public static bool SetIdentity(this List<SpmAdmissionData> values, SpmAdmission admission)
|
||||
{
|
||||
foreach (SpmAdmissionData admissionData in values)
|
||||
admissionData.AdmissionId = admission.Id;
|
||||
return true;
|
||||
}
|
||||
public static bool Find(this List<SpmAdmissionData> values, SpmAdmissionData admissionData)
|
||||
{
|
||||
if (admissionData == null) return false;
|
||||
return (values.Find(item => item == admissionData) != null);
|
||||
}
|
||||
public static bool FindByType(this List<SpmAdmissionData> values, String admissionDataType)
|
||||
{
|
||||
if (StringUtil.IsEmpty(admissionDataType)) return false;
|
||||
return values.Exists(item => item.AdmissionDataType.ToString().EqualsCI(admissionDataType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmAdmissionRole : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
AdmissionId,
|
||||
Role,
|
||||
Category,
|
||||
Seq,
|
||||
EmployeeRoleId,
|
||||
EmployeeCode,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = AdmissionRoleStatus;
|
||||
}
|
||||
public SysId AdmissionId { get; set; }
|
||||
public Spm.EmployeeRole EmployeeRole { get; set; }
|
||||
public Spm.EmployeeRoleCategory EmployeeRoleCategory { get; set; }
|
||||
public ushort Seq { get; set; }
|
||||
public SysId EmployeeRoleId { get; set; }
|
||||
public String EmployeeCode { get; set; }
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
AdmissionId = data.AdmissionId;
|
||||
EmployeeRole = data.EmployeeRole;
|
||||
EmployeeRoleCategory = data.EmployeeRoleCategory;
|
||||
Seq = data.Seq;
|
||||
EmployeeRoleId = data.EmployeeRoleId;
|
||||
EmployeeCode = data.EmployeeCode;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue AdmissionId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeRole { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeRoleCategory { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Seq { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeRoleId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeCode { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmAdmissionRole(SysId admissionId, Spm.EmployeeRole employeeRole, Spm.EmployeeRoleCategory employeeRoleCategory) : base()
|
||||
{
|
||||
admissionId = AdmissionId;
|
||||
employeeRole = EmployeeRole;
|
||||
employeeRoleCategory = EmployeeRoleCategory;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> admissionRoleStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> AdmissionRoleStatuses { get { return new List<SaStatus>(admissionRoleStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
admissionRoleStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId AdmissionId
|
||||
{
|
||||
get { return data.AdmissionId; }
|
||||
set { CheckChanged(data.AdmissionId, value); data.AdmissionId = value; }
|
||||
}
|
||||
public Spm.EmployeeRole EmployeeRole
|
||||
{
|
||||
get { return data.EmployeeRole; }
|
||||
set { CheckChanged((int)data.EmployeeRole, (int)value); data.EmployeeRole = value; }
|
||||
}
|
||||
public Spm.EmployeeRoleCategory EmployeeRoleCategory
|
||||
{
|
||||
get { return data.EmployeeRoleCategory; }
|
||||
set { CheckChanged((int)data.EmployeeRoleCategory, (int)value); data.EmployeeRoleCategory = value; }
|
||||
}
|
||||
public ushort Seq
|
||||
{
|
||||
get { return data.Seq; }
|
||||
set { CheckChanged(data.Seq, value); data.Seq = value; }
|
||||
}
|
||||
public SysId EmployeeRoleId
|
||||
{
|
||||
get { return data.EmployeeRoleId; }
|
||||
set { CheckChanged(data.EmployeeRoleId, value); data.EmployeeRoleId = value; }
|
||||
}
|
||||
public String EmployeeCode
|
||||
{
|
||||
get { return data.EmployeeCode; }
|
||||
set { CheckChanged(data.EmployeeCode, value); data.EmployeeCode = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Admission Role.
|
||||
public SysId AdmissionId { get; set; }
|
||||
public Spm.EmployeeRole EmployeeRole { get; set; } = Spm.EmployeeRole.Unknown;
|
||||
public Spm.EmployeeRoleCategory EmployeeRoleCategory { get; set; } = Spm.EmployeeRoleCategory.Unknown;
|
||||
public ushort Seq { get; set; }
|
||||
public SysId EmployeeRoleId { get; set; }
|
||||
public String EmployeeCode { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// AdmissionRole D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmAdmissionRoleList
|
||||
{
|
||||
public static int CompareByRoleSeq(SpmAdmissionRole p1, SpmAdmissionRole p2)
|
||||
{
|
||||
Spm.EmployeeRole role1 = (p1 != null ? p1.EmployeeRole : Spm.EmployeeRole.Unknown);
|
||||
Spm.EmployeeRole role2 = (p2 != null ? p2.EmployeeRole : Spm.EmployeeRole.Unknown);
|
||||
ushort seq1 = (p1 != null ? p1.Seq : (ushort)0);
|
||||
ushort seq2 = (p2 != null ? p2.Seq : (ushort)0);
|
||||
if (role1 == role2 && seq1 == seq2) return 0;
|
||||
if (role1 > role2) return 1;
|
||||
if (role1 == role2 && seq1 > seq2) return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public enum SortMode { SortRoleSeq, };
|
||||
|
||||
public static void Sort(this List<SpmAdmissionRole> values, SortMode admissionRoleSort, bool ascending = true)
|
||||
{
|
||||
if (admissionRoleSort == SortMode.SortRoleSeq)
|
||||
values.Sort
|
||||
(
|
||||
delegate (SpmAdmissionRole admissionRole1, SpmAdmissionRole admissionRole2)
|
||||
{
|
||||
return CompareByRoleSeq(admissionRole1, admissionRole2);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public static void SetSequence(this List<SpmAdmissionRole> values)
|
||||
{
|
||||
if (values != null || values.Count == 0) return;
|
||||
for (int itemIdx = 0; itemIdx < values.Count; itemIdx++)
|
||||
values[itemIdx].Seq = (ushort)(itemIdx + 1);
|
||||
}
|
||||
|
||||
public static bool SetIdentity(this List<SpmAdmissionRole> values, SpmAdmission admission)
|
||||
{
|
||||
foreach (SpmAdmissionRole admissionRole in values)
|
||||
admissionRole.AdmissionId = admission.Id;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Find(this List<SpmAdmissionRole> values, SpmAdmissionRole admissionRole)
|
||||
{
|
||||
if (admissionRole == null) return false;
|
||||
return (values.Find(item => item == admissionRole) != null);
|
||||
}
|
||||
|
||||
public static bool FindByRoleCatSeq(this List<SpmAdmissionRole> values, Spm.EmployeeRole role, Spm.EmployeeRoleCategory category, ushort seq)
|
||||
{
|
||||
if ((int)role > 0 && (int)category > 0) return false;
|
||||
return values.Exists(item => item.EmployeeRole.Equals(role) && item.EmployeeRoleCategory.Equals(category) && item.Seq.Equals(seq));
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmDepartment : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
Name,
|
||||
ApplicatonFrom,
|
||||
ApplicationTo,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = DepartmentStatus;
|
||||
}
|
||||
public String Name { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
Name = data.Name;
|
||||
ApplicationFrom = data.ApplicationFrom;
|
||||
ApplicationTo = data.ApplicationTo;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationTo { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
private long facilityTypes;
|
||||
private long allowAnyFacility;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmDepartment(SysId id) : base(id)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> departmentStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> DepartmentStatuses { get { return new List<SaStatus>(departmentStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
departmentStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public int GetFacilityTypeBit(Spm.FacilityType facilityType)
|
||||
{
|
||||
// Map facility types to their position in the bit mapped value:
|
||||
if (facilityType == Spm.FacilityType.Theatre) return 0;
|
||||
if (facilityType == Spm.FacilityType.Clinic) return 1;
|
||||
if (facilityType == Spm.FacilityType.Ward) return 2;
|
||||
if (facilityType == Spm.FacilityType.Apparatus) return 3;
|
||||
return -1;
|
||||
}
|
||||
public bool HasFacilityType(Spm.FacilityType facilityType)
|
||||
{
|
||||
int facilityTypeBit = GetFacilityTypeBit(facilityType);
|
||||
if (facilityTypeBit >= 0 && facilityTypeBit < 32)
|
||||
return ((facilityTypes & (((long)1) << facilityTypeBit)) > 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AllowAnyFacility(Spm.FacilityType facilityType)
|
||||
{
|
||||
int iFacilityTypeBit = GetFacilityTypeBit(facilityType);
|
||||
if (iFacilityTypeBit >= 0 && iFacilityTypeBit < 32)
|
||||
return ((allowAnyFacility & (((long)1) << iFacilityTypeBit)) > 0);
|
||||
return false;
|
||||
}
|
||||
public long GetFacilityTypes() { return facilityTypes; }
|
||||
public long GetAllowAnyFacilities() { return allowAnyFacility; }
|
||||
|
||||
public ushort GetCancelReBookLimit(Spm.FacilityType facility)
|
||||
{
|
||||
if (facility == Spm.FacilityType.Theatre) return 28;
|
||||
return 0;
|
||||
}
|
||||
public DateTime ApplicationFrom
|
||||
{
|
||||
get { return data.ApplicationFrom; }
|
||||
set { CheckChanged(data.ApplicationFrom, value); data.ApplicationFrom = value; }
|
||||
}
|
||||
public DateTime ApplicationTo
|
||||
{
|
||||
get { return data.ApplicationTo; }
|
||||
set { CheckChanged(data.ApplicationTo, value); data.ApplicationTo = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
|
||||
// Department.
|
||||
public String Name { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
public DateTime Application { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Department D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmDepartmentList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmEmployee : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
InstitutionId,
|
||||
EmployeeNo,
|
||||
Code,
|
||||
Initials,
|
||||
Title,
|
||||
Forename,
|
||||
Surname,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = EmployeeStatus;
|
||||
}
|
||||
public SysId InstitutionId { get; set; }
|
||||
public String EmployeeNo { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String Initials { get; set; }
|
||||
public String Title { get; set; }
|
||||
public String Forename { get; set; }
|
||||
public String Surname { get; set; }
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
InstitutionId = data.InstitutionId;
|
||||
EmployeeNo = data.EmployeeNo;
|
||||
Code = data.Code;
|
||||
Initials = data.Initials;
|
||||
Title = data.Title;
|
||||
Forename = data.Forename;
|
||||
Surname = data.Surname;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue InstitutionId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeNo { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Code { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Initials { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Title { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Forename { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Surname { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmEmployee(SysId id, SysId institutionId) : base()
|
||||
{
|
||||
institutionId = InstitutionId;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> employeeStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> EmployeeStatuses { get { return new List<SaStatus>(employeeStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
employeeStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId InstitutionId
|
||||
{
|
||||
get { return data.InstitutionId; }
|
||||
set { CheckChanged(data.InstitutionId, value); data.InstitutionId = value; }
|
||||
}
|
||||
public String EmployeeNo
|
||||
{
|
||||
get { return data.EmployeeNo; }
|
||||
set { CheckChanged(data.EmployeeNo, value); data.EmployeeNo = value; }
|
||||
}
|
||||
public String Code
|
||||
{
|
||||
get { return data.Code; }
|
||||
set { CheckChanged(data.Code, value); data.Code = value; }
|
||||
}
|
||||
public String Initials
|
||||
{
|
||||
get { return data.Initials; }
|
||||
set { CheckChanged(data.Initials, value); data.Initials = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { CheckChanged(data.Title, value); data.Title = value; }
|
||||
}
|
||||
public String Forename
|
||||
{
|
||||
get { return data.Forename; }
|
||||
set { CheckChanged(data.Forename, value); data.Forename = value; }
|
||||
}
|
||||
public String Surname
|
||||
{
|
||||
get { return data.Surname; }
|
||||
set { CheckChanged(data.Surname, value); data.Surname = value; }
|
||||
}
|
||||
public static String GetDisplayName(String surname, String forename, bool upperSurname = true)
|
||||
{
|
||||
String name = surname;
|
||||
if (upperSurname)
|
||||
name.ToUpper();
|
||||
if (!StringUtil.IsEmpty(surname) && !StringUtil.IsEmpty(forename))
|
||||
name += ", ";
|
||||
name += forename;
|
||||
return name;
|
||||
}
|
||||
public String GetDisplayName(bool upperSurname = true)
|
||||
{
|
||||
return GetDisplayName(Surname, Forename, upperSurname);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Employee.
|
||||
public SysId InstitutionId { get; set; }
|
||||
public String EmployeeNo { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String Surname { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Employee D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmEmployeeList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmEmployeeRole : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
DepartmentId,
|
||||
EmployeeId,
|
||||
Role,
|
||||
ApplicationFrom,
|
||||
ApplicationTo,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = EmployeeRoleStatus;
|
||||
}
|
||||
public SysId DepartmentId { get; set; }
|
||||
public SysId EmployeeId { get; set; }
|
||||
public Spm.EmployeeRole EmployeeRole { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
DepartmentId = data.DepartmentId;
|
||||
EmployeeId = data.EmployeeId;
|
||||
EmployeeRole = data.EmployeeRole;
|
||||
ApplicationFrom = data.ApplicationFrom;
|
||||
ApplicationTo = data.ApplicationTo;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue DepartmentId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue EmployeeRole { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationTo { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmEmployeeRole(SysId departmentId, SysId employeeId, Spm.EmployeeRole employeeRole) : base()
|
||||
{
|
||||
departmentId = DepartmentId;
|
||||
employeeId = EmployeeId;
|
||||
employeeRole = EmployeeRole;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> employeeRoleStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> EmployeeRoleStatuses { get { return new List<SaStatus>(employeeRoleStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
employeeRoleStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId DepartmentId
|
||||
{
|
||||
get { return data.DepartmentId; }
|
||||
set { CheckChanged(data.DepartmentId, value); data.DepartmentId = value; }
|
||||
}
|
||||
public SysId EmployeeId
|
||||
{
|
||||
get { return data.EmployeeId; }
|
||||
set { CheckChanged(data.EmployeeId, value); data.EmployeeId = value; }
|
||||
}
|
||||
public Spm.EmployeeRole EmployeeRole
|
||||
{
|
||||
get { return data.EmployeeRole; }
|
||||
set { CheckChanged((int)data.EmployeeRole, (int)value); data.EmployeeRole = value; }
|
||||
}
|
||||
public DateTime ApplicationFrom
|
||||
{
|
||||
get { return data.ApplicationFrom; }
|
||||
set { CheckChanged(data.ApplicationFrom, value); data.ApplicationFrom = value; }
|
||||
}
|
||||
public DateTime ApplicationTo
|
||||
{
|
||||
get { return data.ApplicationTo; }
|
||||
set { CheckChanged(data.ApplicationTo, value); data.ApplicationTo = value; }
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// EmployeeRole.
|
||||
public SysId DepartmentId { get; set; }
|
||||
public SysId EmployeeId { get; set; }
|
||||
public Spm.EmployeeRole EmployeeRole { get; set; }
|
||||
public String Surname { get; set; }
|
||||
public String Initials { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
public DateTime Application { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// EmployeeRole D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmEmployeeRoleList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmFacility : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
DepartmentId,
|
||||
Type,
|
||||
Type_Desc,
|
||||
Name,
|
||||
SortCode,
|
||||
Desc,
|
||||
TemplateMapType,
|
||||
ScheduleFreezeType,
|
||||
FreezeTime,
|
||||
FreezeData,
|
||||
ApplicFrom,
|
||||
ApplicTo,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flag,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = FacilityStatus;
|
||||
}
|
||||
public SysId DepartmentId { get; set; }
|
||||
public Spm.FacilityType FacilityType { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String SortCode { get; set; }
|
||||
public String Desc { get; set; }
|
||||
public Spm.FacilityTemplateMapType TemplateMapType { get; set; }
|
||||
public Spm.ScheduleFreezeType ScheduleFreezeType { get; set; }
|
||||
public DateTime ScheduleFreezeAtTime { get; set; }
|
||||
public String ScheduleFreezeData { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
DepartmentId = data.DepartmentId;
|
||||
FacilityType = data.FacilityType;
|
||||
Name = data.Name;
|
||||
SortCode = data.SortCode;
|
||||
Desc = data.Desc;
|
||||
TemplateMapType = data.TemplateMapType;
|
||||
ScheduleFreezeType = data.ScheduleFreezeType;
|
||||
ScheduleFreezeAtTime = data.ScheduleFreezeAtTime;
|
||||
ScheduleFreezeData = data.ScheduleFreezeData;
|
||||
ApplicationFrom = data.ApplicationFrom;
|
||||
ApplicationTo = data.ApplicationTo;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue DepartmentId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FacilityType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SortCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Desc { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TemplateMapType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ScheduleFreezeType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ScheduleFreezeAtTime { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ScheduleFreezeData { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationTo { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly ushort Flag_BookingToFacility = 0x01;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmFacility(SysId facilityId, SysId departmentId, Spm.FacilityType facilityType) : base()
|
||||
{
|
||||
departmentId = DepartmentId;
|
||||
facilityType = FacilityType;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> facilityStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> FacilityStatuses { get { return new List<SaStatus>(facilityStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
facilityStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId DepartmentId
|
||||
{
|
||||
get { return data.DepartmentId; }
|
||||
set { CheckChanged(data.DepartmentId, value); data.DepartmentId = value; }
|
||||
}
|
||||
public Spm.FacilityType FacilityType
|
||||
{
|
||||
get { return data.FacilityType; }
|
||||
set { CheckChanged((int)data.FacilityType, (int)value); data.FacilityType = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public String SortCode
|
||||
{
|
||||
get { return data.SortCode; }
|
||||
set { CheckChanged(data.SortCode, value); data.SortCode = value; }
|
||||
}
|
||||
public String Desc
|
||||
{
|
||||
get { return data.Desc; }
|
||||
set { CheckChanged(data.Desc, value); data.Desc = value; }
|
||||
}
|
||||
public Spm.FacilityTemplateMapType TemplateMapType
|
||||
{
|
||||
get { return data.TemplateMapType; }
|
||||
set { CheckChanged((int)data.TemplateMapType, (int)value); data.TemplateMapType = value; }
|
||||
}
|
||||
public Spm.ScheduleFreezeType ScheduleFreezeType
|
||||
{
|
||||
get { return data.ScheduleFreezeType; }
|
||||
set { CheckChanged((int)data.ScheduleFreezeType, (int)value); data.ScheduleFreezeType = value; }
|
||||
}
|
||||
public DateTime ScheduleFreezeAtTime
|
||||
{
|
||||
get { return data.ScheduleFreezeAtTime; }
|
||||
set { CheckChanged(data.ScheduleFreezeAtTime, value); data.ScheduleFreezeAtTime = value; }
|
||||
}
|
||||
public String ScheduleFreezeData
|
||||
{
|
||||
get { return data.ScheduleFreezeData; }
|
||||
set { CheckChanged(data.ScheduleFreezeData, value); data.ScheduleFreezeData = value; }
|
||||
}
|
||||
public DateTime ApplicationFrom
|
||||
{
|
||||
get { return data.ApplicationFrom; }
|
||||
set { CheckChanged(data.ApplicationFrom, value); data.ApplicationFrom = value; }
|
||||
}
|
||||
public DateTime ApplicationTo
|
||||
{
|
||||
get { return data.ApplicationTo; }
|
||||
set { CheckChanged(data.ApplicationTo, value); data.ApplicationTo = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
public bool BookingToFacility
|
||||
{
|
||||
get { return GetFlag(Flag_BookingToFacility); }
|
||||
set { SetFlag(Flag_BookingToFacility, value); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Facility.
|
||||
public SysId DepartmentId { get; set; }
|
||||
public Spm.FacilityType FacilityType { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public int WeekOfMonth { get; set; }
|
||||
public int WorkingDayOfWeek { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
public DateTime Application { get; set; }
|
||||
public DateTime TemplatesApplicationFrom { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Facility D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmFacilityList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,428 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmFacilitySession : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
// Facility columns.
|
||||
Facility_TypeDesc,
|
||||
Facility_Name,
|
||||
Facility_SortCode,
|
||||
Facility_Desc,
|
||||
Facility_TemplateMapTypeDesc,
|
||||
Facility_ApplicFrom,
|
||||
Facility_ApplicTo,
|
||||
Facility_Notes,
|
||||
// Template columns.
|
||||
Template_Id,
|
||||
Template_FacilityId,
|
||||
Template_WeekOfMonth,
|
||||
Template_DayOfWeek,
|
||||
Template_TypeDesc,
|
||||
Template_Name,
|
||||
Template_Desc,
|
||||
Template_ConsultantCode,
|
||||
Template_SpecialityCode,
|
||||
Template_ConsSpec,
|
||||
Template_StartTime,
|
||||
Template_FinishTime,
|
||||
Template_DurationTotal,
|
||||
Template_DurationInterval,
|
||||
Template_DurationMin,
|
||||
Template_DurationMax,
|
||||
Template_DurationBreaks,
|
||||
Template_UnitsExp,
|
||||
Template_ApplicFrom,
|
||||
Template_ApplicTo,
|
||||
Template_Notes,
|
||||
// Session columns.
|
||||
Session_Date,
|
||||
Session_Name,
|
||||
Session_Desc,
|
||||
Session_ConsultantCode,
|
||||
Session_SpecialityCode,
|
||||
Session_ConsSpec,
|
||||
Session_StartTime,
|
||||
Session_FinishTime,
|
||||
Session_DurationTotal, // Total duration specifically for the session.
|
||||
Session_DurationInterval,
|
||||
Session_DurationMin,
|
||||
Session_DurationMax,
|
||||
Session_DurationBreaks,
|
||||
Session_UnitsExp,
|
||||
Session_Overrides,
|
||||
Session_Flags,
|
||||
Session_Unavailable,
|
||||
Session_Notes,
|
||||
// Derived session columns - template value if session not present.
|
||||
Session_Duration_Total, // Total duration for template or session if specified.
|
||||
Session_Duration_Breaks,
|
||||
Session_Duration_Session, // Total session time - breaks.
|
||||
Session_Admissions_Duration_Total, // Booked mins - discharge time - admission time.
|
||||
Session_Admissions_Duration_BlankPatientNo,
|
||||
Session_Admissions_DurationExp,
|
||||
Session_Admissions_DurationAct,
|
||||
Session_Admissions_Duration_Util,
|
||||
Session_Admissions_UnitsExp_Total,
|
||||
Session_Admissions_UnitsExp_Util,
|
||||
Session_Available_Mins,
|
||||
Session_Admissions_LateCancelled, // Includes bookings cancelled, deleted and moved sicne previous day.
|
||||
Session_Booked_Percent_Total,
|
||||
Session_Booked_Percent_Util,
|
||||
Session_Slots_Capacity_Min,
|
||||
Session_Slots_Capacity_Int,
|
||||
Session_Slots_Capacity_Maj,
|
||||
Session_Slots_Booked_Total,
|
||||
Session_Slots_Booked_Min,
|
||||
Session_Slots_Booked_Int,
|
||||
Session_Slots_Booked_Maj,
|
||||
Session_Slots_Booked_Other,
|
||||
Session_Slots_Booked_Percent,
|
||||
Session_Slots_Avail_Total,
|
||||
Session_Slots_Avail_Min,
|
||||
Session_Slots_Avail_Int,
|
||||
Session_Slots_Avail_Maj,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = FacilitySessionStatus;
|
||||
}
|
||||
public SysId FacilityId{ get; set; }
|
||||
public SysId FacilityTemplateId{ get; set; }
|
||||
public DateTime SessionDate{ get; set; }
|
||||
public Spm.TemplateType TemplateType { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String Desc { get; set; }
|
||||
public String SessionCode{ get; set; }
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime FinishTime { get; set; }
|
||||
// Ward resources & Clinic sessions.
|
||||
public Spm.ResourceCapacityType ResourceCapacityType { get; set; }
|
||||
public short CapacityMin { get; set; }
|
||||
public short CapacityMax { get; set; }
|
||||
public decimal UnitsExp { get; set; }
|
||||
public short DurationInterval { get; set; }
|
||||
public short DurationMin { get; set; }
|
||||
public short DurationMax { get; set; }
|
||||
public short DurationBreaks { get; set; }
|
||||
// Theatre & Clinic sessions.
|
||||
public SysId ConsultantId{ get; set; }
|
||||
public String ConsultantCode{ get; set; }
|
||||
public String SpecialityCode{ get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
FacilityId = data.FacilityId;
|
||||
FacilityTemplateId = data.FacilityTemplateId;
|
||||
SessionDate = data.SessionDate;
|
||||
TemplateType = data.TemplateType;
|
||||
Name = data.Name;
|
||||
Desc = data.Desc;
|
||||
SessionCode = data.SessionCode;
|
||||
StartTime = data.StartTime;
|
||||
FinishTime = data.FinishTime;
|
||||
ResourceCapacityType = data.ResourceCapacityType;
|
||||
CapacityMin = data.CapacityMin;
|
||||
CapacityMax = data.CapacityMax;
|
||||
UnitsExp = data.UnitsExp;
|
||||
DurationInterval = data.DurationInterval;
|
||||
DurationMin = data.DurationMin;
|
||||
DurationMax = data.DurationMax;
|
||||
DurationBreaks = data.DurationBreaks;
|
||||
ConsultantId = data.ConsultantId;
|
||||
ConsultantCode = data.ConsultantCode;
|
||||
SpecialityCode = data.SpecialityCode;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue FacilityId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FacilityTemplateId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SessionDate { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TemplateType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Desc { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SessionCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue StartTime { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FinishTime { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ResourceCapacityType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CapacityMin { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CapacityMax { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UnitsExp { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationInterval { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationMin { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationMax { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationBreaks { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ConsultantId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ConsultantCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SpecialityCode { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
public static readonly ushort Flag_NotAvailable = 0x01;
|
||||
public static readonly ushort Flag_HideTemplateNotes = 0x02;
|
||||
public static readonly ushort Flag_HighlightSessionNotes = 0x03;
|
||||
public static readonly ushort Flag_Finalised = 0x04;
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmFacilitySession(SysId facilityId, SysId facilityTemplateId, DateTime sessionDate) : base()
|
||||
{
|
||||
facilityId = FacilityId;
|
||||
facilityTemplateId = FacilityTemplateId;
|
||||
sessionDate = SessionDate;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> facilitySessionStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> FacilitySessionStatuses { get { return new List<SaStatus>(facilitySessionStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
facilitySessionStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { CheckChanged(data.FacilityId, value); data.FacilityId = value; }
|
||||
}
|
||||
public SysId FacilityTemplateId
|
||||
{
|
||||
get { return data.FacilityTemplateId; }
|
||||
set { CheckChanged(data.FacilityTemplateId, value); data.FacilityTemplateId = value; }
|
||||
}
|
||||
public DateTime SessionDate
|
||||
{
|
||||
get { return data.SessionDate; }
|
||||
set { CheckChanged(data.SessionDate, value); data.SessionDate = value; }
|
||||
}
|
||||
public Spm.TemplateType TemplateType
|
||||
{
|
||||
get { return data.TemplateType; }
|
||||
set { CheckChanged((int)data.TemplateType, (int)value); data.TemplateType = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public String Description
|
||||
{
|
||||
get { return data.Desc; }
|
||||
set { CheckChanged(data.Desc, value); data.Desc = value; }
|
||||
}
|
||||
public String SessionCode
|
||||
{
|
||||
get { return data.SessionCode; }
|
||||
set { CheckChanged(data.SessionCode, value); data.SessionCode = value; }
|
||||
}
|
||||
public DateTime StartTime
|
||||
{
|
||||
get { return data.StartTime; }
|
||||
set { CheckChanged(data.StartTime, value); data.StartTime = value; }
|
||||
}
|
||||
public DateTime FinishTime
|
||||
{
|
||||
get { return data.FinishTime; }
|
||||
set { CheckChanged(data.FinishTime, value); data.FinishTime = value; }
|
||||
}
|
||||
public Spm.ResourceCapacityType ResourceCapacityType
|
||||
{
|
||||
get { return data.ResourceCapacityType; }
|
||||
set { CheckChanged((int)data.ResourceCapacityType, (int)value); data.ResourceCapacityType = value; }
|
||||
}
|
||||
public short CapacityMin
|
||||
{
|
||||
get { return data.CapacityMin; }
|
||||
set { CheckChanged(data.CapacityMin, value); data.CapacityMin = value; }
|
||||
}
|
||||
public short CapacityMax
|
||||
{
|
||||
get { return data.CapacityMax; }
|
||||
set { CheckChanged(data.CapacityMax, value); data.CapacityMax = value; }
|
||||
}
|
||||
public decimal UnitsExp
|
||||
{
|
||||
get { return data.UnitsExp; }
|
||||
set { CheckChanged(data.UnitsExp, value); data.UnitsExp = value; }
|
||||
}
|
||||
public static ushort GetDurationIntervalDefault()
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
public short DurationInterval
|
||||
{
|
||||
get { return data.DurationInterval; }
|
||||
set { CheckChanged(data.DurationInterval, value); data.DurationInterval = value; }
|
||||
}
|
||||
public short DurationMin
|
||||
{
|
||||
get { return data.DurationMin; }
|
||||
set { CheckChanged(data.DurationMin, value); data.DurationMin = value; }
|
||||
}
|
||||
public short DurationMax
|
||||
{
|
||||
get { return data.DurationMax; }
|
||||
set { CheckChanged(data.DurationMax, value); data.DurationMax = value; }
|
||||
}
|
||||
public short DurationBreaks
|
||||
{
|
||||
get { return data.DurationBreaks; }
|
||||
set { CheckChanged(data.DurationBreaks, value); data.DurationBreaks = value; }
|
||||
}
|
||||
public SysId ConsultantId
|
||||
{
|
||||
get { return data.ConsultantId; }
|
||||
set { CheckChanged(data.ConsultantId, value); data.ConsultantId = value; }
|
||||
}
|
||||
public String ConsultantCode
|
||||
{
|
||||
get { return data.ConsultantCode; }
|
||||
set { CheckChanged(data.ConsultantCode, value); data.ConsultantCode = value; }
|
||||
}
|
||||
public String SpecialityCode
|
||||
{
|
||||
get { return data.SpecialityCode; }
|
||||
set { CheckChanged(data.SpecialityCode, value); data.SpecialityCode = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
public bool NotAvailable
|
||||
{
|
||||
get { return GetFlag(Flag_NotAvailable); }
|
||||
set { SetFlag(Flag_NotAvailable, value); }
|
||||
}
|
||||
public bool HideTemplateNotes
|
||||
{
|
||||
get { return GetFlag(Flag_HideTemplateNotes); }
|
||||
set { SetFlag(Flag_HideTemplateNotes, value); }
|
||||
}
|
||||
public bool HighlightSessionNotes
|
||||
{
|
||||
get { return GetFlag(Flag_HighlightSessionNotes); }
|
||||
set { SetFlag(Flag_HighlightSessionNotes, value); }
|
||||
}
|
||||
public bool Finalised
|
||||
{
|
||||
get { return GetFlag(Flag_Finalised); }
|
||||
set { SetFlag(Flag_Finalised, value); }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// FacilitySession.
|
||||
public SysId FacilityId { get; set; }
|
||||
public SysId FacilityTemplateId { get; set; }
|
||||
public DateTime SessionFrom { get; set; }
|
||||
public DateTime SessionTo { get; set; }
|
||||
|
||||
public DateTime Admission { get; set; }
|
||||
/*public DateTime AdmissionFrom { get; set; }
|
||||
public DateTime AdmissionTo { get; set; }
|
||||
public SysId DepartmentId { get; set; }
|
||||
public SysId FacilityId { get; set; }
|
||||
public SysId FacilityTemplate { get; set; }
|
||||
public Spm.FacilityType FacilityType { get; set; }
|
||||
int iMaxSeq, iMinSeq{ get; set; }
|
||||
eSwmAdmissionCancelType eCancelType{ get; set; }
|
||||
String sPatientNoFull, sPatientNoPartial, sPatientSurname{ get; set; }*/
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// FacilitySession D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmFacilitySessionList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmFacilityTemplate : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
Category,
|
||||
Type,
|
||||
Sort,
|
||||
Group,
|
||||
Name,
|
||||
Desc,
|
||||
CapacityType,
|
||||
WeekOfMonth,
|
||||
DayOfWeek,
|
||||
Consultant,
|
||||
Speciality,
|
||||
UnitsExp,
|
||||
DurationInterval,
|
||||
DurationMin,
|
||||
DurationMax,
|
||||
DurationBreaks,
|
||||
SlotsMin,
|
||||
SlotsInt,
|
||||
SlotsMaj,
|
||||
Start,
|
||||
Finish,
|
||||
Notes,
|
||||
ApplicFrom,
|
||||
ApplicTo,
|
||||
|
||||
// Common properties.
|
||||
//Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = FacilityTemplateStatus;
|
||||
}
|
||||
public SysId FacilityId { get; set; }
|
||||
public Spm.ResourceCategory ResourceCategory { get; set; }
|
||||
public Spm.TemplateType TemplateType { get; set; }
|
||||
public String Name { get; set; }
|
||||
public String SortCode { get; set; }
|
||||
public String Desc { get; set; }
|
||||
public String SessionCode { get; set; }
|
||||
public String Group { get; set; }
|
||||
// Ward resources & Clinic sessions.
|
||||
public Spm.ResourceCapacityType ResourceCapacityType { get; set; }
|
||||
public ushort CapacityMin { get; set; }
|
||||
public ushort CapacityMax { get; set; }
|
||||
public decimal UnitsExp { get; set; }
|
||||
public ushort DurationInterval { get; set; }
|
||||
public ushort DurationMin { get; set; }
|
||||
public ushort DurationMax { get; set; }
|
||||
public ushort DurationBreaks { get; set; }
|
||||
// Theatre & Clinic sessions.
|
||||
public ushort WeekOfMonth { get; set; }
|
||||
public ushort DayOfWeek { get; set; }
|
||||
public SysId ConsultantId { get; set; } // Employee role.
|
||||
public String ConsultantCode { get; set; }
|
||||
public String SpecialityCode { get; set; }
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime FinishTime { get; set; }
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
FacilityId = data.FacilityId;
|
||||
ResourceCategory = data.ResourceCategory;
|
||||
TemplateType = data.TemplateType;
|
||||
Name = data.Name;
|
||||
SortCode = data.SortCode;
|
||||
Desc = data.Desc;
|
||||
SessionCode = data.SessionCode;
|
||||
Group = data.Group;
|
||||
ResourceCapacityType = data.ResourceCapacityType;
|
||||
CapacityMin = data.CapacityMin;
|
||||
CapacityMax = data.CapacityMax;
|
||||
UnitsExp = data.UnitsExp;
|
||||
DurationInterval = data.DurationInterval;
|
||||
DurationMin = data.DurationMin;
|
||||
DurationMax = data.DurationMax;
|
||||
DurationBreaks = data.DurationBreaks;
|
||||
WeekOfMonth = data.WeekOfMonth;
|
||||
DayOfWeek = data.DayOfWeek;
|
||||
ConsultantId = data.ConsultantId;
|
||||
ConsultantCode = data.ConsultantCode;
|
||||
SpecialityCode = data.SpecialityCode;
|
||||
StartTime = data.StartTime;
|
||||
FinishTime = data.FinishTime;
|
||||
ApplicationFrom = data.ApplicationFrom;
|
||||
ApplicationTo = data.ApplicationTo;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue FacilityId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ResourceCategory { get; set; } = ValidValue.Valid;
|
||||
public ValidValue TemplateType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SortCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Desc { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SessionCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Group { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ResourceCapacityType { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CapacityMin { get; set; } = ValidValue.Valid;
|
||||
public ValidValue CapacityMax { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UnitsExp { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationInterval { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationMin { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationMax { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationBreaks { get; set; } = ValidValue.Valid;
|
||||
public ValidValue WeekOfMonth { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DayOfWeek { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ConsultantId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ConsultantCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SpecialityCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue StartTime { get; set; } = ValidValue.Valid;
|
||||
public ValidValue FinishTime { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationFrom { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ApplicationTo { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmFacilityTemplate(SysId facilityId, Spm.ResourceCategory resourceCategory) : base()
|
||||
{
|
||||
facilityId = FacilityId;
|
||||
resourceCategory = ResourceCategory;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> facilityTemplateStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> FacilityTemplateStatuses { get { return new List<SaStatus>(facilityTemplateStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
facilityTemplateStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId FacilityId
|
||||
{
|
||||
get { return data.FacilityId; }
|
||||
set { CheckChanged(data.FacilityId, value); data.FacilityId = value; }
|
||||
}
|
||||
public Spm.ResourceCategory ResourceCategory
|
||||
{
|
||||
get { return data.ResourceCategory; }
|
||||
set { CheckChanged((int)data.ResourceCategory, (int)value); data.ResourceCategory = value; }
|
||||
}
|
||||
public Spm.TemplateType TemplateType
|
||||
{
|
||||
get { return data.TemplateType; }
|
||||
set { CheckChanged((int)data.TemplateType, (int)value); data.TemplateType = value; }
|
||||
}
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
public String SortCode
|
||||
{
|
||||
get { return data.SortCode; }
|
||||
set { CheckChanged(data.SortCode, value); data.SortCode = value; }
|
||||
}
|
||||
public String Desc
|
||||
{
|
||||
get { return data.Desc; }
|
||||
set { CheckChanged(data.Desc, value); data.Desc = value; }
|
||||
}
|
||||
public String SessionCode
|
||||
{
|
||||
get { return data.SessionCode; }
|
||||
set { CheckChanged(data.SessionCode, value); data.SessionCode = value; }
|
||||
}
|
||||
public String Group
|
||||
{
|
||||
get { return data.Group; }
|
||||
set { CheckChanged(data.Group, value); data.Group = value; }
|
||||
}
|
||||
// Ward resources & Clinic sessions.
|
||||
public Spm.ResourceCapacityType ResourceCapacityType
|
||||
{
|
||||
get { return data.ResourceCapacityType; }
|
||||
set { CheckChanged((int)data.ResourceCapacityType, (int)value); data.ResourceCapacityType = value; }
|
||||
}
|
||||
public ushort CapacityMin
|
||||
{
|
||||
get { return data.CapacityMin; }
|
||||
set { CheckChanged(data.CapacityMin, value); data.CapacityMin = value; }
|
||||
}
|
||||
public ushort CapacityMax
|
||||
{
|
||||
get { return data.CapacityMax; }
|
||||
set { CheckChanged(data.CapacityMax, value); data.CapacityMax = value; }
|
||||
}
|
||||
public decimal UnitsExp
|
||||
{
|
||||
get { return data.UnitsExp; }
|
||||
set { CheckChanged(data.UnitsExp, value); data.UnitsExp = value; }
|
||||
}
|
||||
public static ushort GetDurationIntervalDefault()
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
public ushort DurationInterval
|
||||
{
|
||||
get { return data.DurationInterval; }
|
||||
set { CheckChanged(data.DurationInterval, value); data.DurationInterval = value; }
|
||||
}
|
||||
public ushort DurationMin
|
||||
{
|
||||
get { return data.DurationMin; }
|
||||
set { CheckChanged(data.DurationMin, value); data.DurationMin = value; }
|
||||
}
|
||||
public ushort DurationMax
|
||||
{
|
||||
get { return data.DurationMax; }
|
||||
set { CheckChanged(data.DurationMax, value); data.DurationMax = value; }
|
||||
}
|
||||
public ushort DurationBreaks
|
||||
{
|
||||
get { return data.DurationBreaks; }
|
||||
set { CheckChanged(data.DurationBreaks, value); data.DurationBreaks = value; }
|
||||
}
|
||||
// Theatre & Clinic sessions.
|
||||
public ushort WeekOfMonth
|
||||
{
|
||||
get { return data.WeekOfMonth; }
|
||||
set { CheckChanged(data.WeekOfMonth, value); data.WeekOfMonth = value; }
|
||||
}
|
||||
public ushort DayOfWeek
|
||||
{
|
||||
get { return data.DayOfWeek; }
|
||||
set { CheckChanged(data.DayOfWeek, value); data.DayOfWeek = value; }
|
||||
}
|
||||
public SysId ConsultantId
|
||||
{
|
||||
get { return data.ConsultantId; }
|
||||
set { CheckChanged(data.ConsultantId, value); data.ConsultantId = value; }
|
||||
}
|
||||
public String ConsultantCode
|
||||
{
|
||||
get { return data.ConsultantCode; }
|
||||
set { CheckChanged(data.ConsultantCode, value); data.ConsultantCode = value; }
|
||||
}
|
||||
public String SpecialityCode
|
||||
{
|
||||
get { return data.SpecialityCode; }
|
||||
set { CheckChanged(data.SpecialityCode, value); data.SpecialityCode = value; }
|
||||
}
|
||||
public DateTime StartTime
|
||||
{
|
||||
get { return data.StartTime; }
|
||||
set { CheckChanged(data.StartTime, value); data.StartTime = value; }
|
||||
}
|
||||
public DateTime FinishTime
|
||||
{
|
||||
get { return data.FinishTime; }
|
||||
set { CheckChanged(data.FinishTime, value); data.FinishTime = value; }
|
||||
}
|
||||
public DateTime ApplicationFrom
|
||||
{
|
||||
get { return data.ApplicationFrom; }
|
||||
set { CheckChanged(data.ApplicationFrom, value); data.ApplicationFrom = value; }
|
||||
}
|
||||
public DateTime ApplicationTo
|
||||
{
|
||||
get { return data.ApplicationTo; }
|
||||
set { CheckChanged(data.ApplicationTo, value); data.ApplicationTo = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
//FacilityTemplate.
|
||||
public DateTime ApplicationFrom { get; set; }
|
||||
public DateTime ApplicationTo { get; set; }
|
||||
public DateTime Application { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// FacilityTemplate D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmFacilityTemplateList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmInstitution : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
Name,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = InstitutionStatus;
|
||||
}
|
||||
public String Name { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
Name = data.Name;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue Name { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmInstitution(SysId id) : base(id)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> institutionStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> InstitutionStatuses { get { return new List<SaStatus>(institutionStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
institutionStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public String Name
|
||||
{
|
||||
get { return data.Name; }
|
||||
set { CheckChanged(data.Name, value); data.Name = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Institution.
|
||||
public String Name { get; set; }
|
||||
public String NamePartial { get; set; }
|
||||
public String NotesPartial { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Institution D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmInstitutionList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmOperation : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
InstitutionId,
|
||||
Code,
|
||||
Description,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = OperationStatus;
|
||||
}
|
||||
public SysId InstitutionId { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String Description { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
InstitutionId = data.InstitutionId;
|
||||
Code = data.Code;
|
||||
Description = data.Description;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue InstitutionId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Code { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Description { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmOperation(SysId departmentId, SysId institionId) : base()
|
||||
{
|
||||
institionId = InstitutionId;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> operationStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> OperationStatuses { get { return new List<SaStatus>(operationStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
operationStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId InstitutionId
|
||||
{
|
||||
get { return data.InstitutionId; }
|
||||
set { CheckChanged(data.InstitutionId, value); data.InstitutionId = value; }
|
||||
}
|
||||
public String Code
|
||||
{
|
||||
get { return data.Code; }
|
||||
set { CheckChanged(data.Code, value); data.Code = value; }
|
||||
}
|
||||
public String Description
|
||||
{
|
||||
get { return data.Description; }
|
||||
set { CheckChanged(data.Description, value); data.Description = value; }
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Operation.
|
||||
public SysId InstitutionId { get; set; }
|
||||
public String Code { get; set; }
|
||||
public String CodePartial { get; set; }
|
||||
public String Description { get; set; }
|
||||
public String DescriptionPartial { get; set; }
|
||||
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Operation D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmOperationList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmPatient : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
InstitutionId,
|
||||
PatientNo,
|
||||
NhsNumber,
|
||||
Title,
|
||||
Forename,
|
||||
Surname,
|
||||
BirthOn,
|
||||
Age,
|
||||
AgeOn,
|
||||
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = PatientStatus;
|
||||
}
|
||||
public SysId InstitutionId { get; set; }
|
||||
public String PatientNo { get; set; }
|
||||
public String NhsNumber { get; set; }
|
||||
public String Title { get; set; }
|
||||
public String Forename { get; set; }
|
||||
public String Surname { get; set; }
|
||||
public Spm.Gender Gender { get; set; }
|
||||
public DateTime BirthOn { get; set; }
|
||||
public String Age { get; set; }
|
||||
public DateTime AgeOn { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
InstitutionId = data.InstitutionId;
|
||||
PatientNo = data.PatientNo;
|
||||
NhsNumber = data.NhsNumber;
|
||||
Title = data.Title;
|
||||
Forename = data.Forename;
|
||||
Surname = data.Surname;
|
||||
Gender = data.Gender;
|
||||
BirthOn = data.BirthOn;
|
||||
Age = data.Age;
|
||||
AgeOn = data.AgeOn;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue InstitutionId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue PatientNo { get; set; } = ValidValue.Valid;
|
||||
public ValidValue NhsNumber { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Title { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Forename { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Surname { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Gender { get; set; } = ValidValue.Valid;
|
||||
public ValidValue BirthOn { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Age { get; set; } = ValidValue.Valid;
|
||||
public ValidValue AgeOn { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmPatient(SysId id, SysId institutionId) : base(id)
|
||||
{
|
||||
institutionId = InstitutionId;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> patientStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> PatientStatuses { get { return new List<SaStatus>(patientStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
patientStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId InstitutionId
|
||||
{
|
||||
get { return data.InstitutionId; }
|
||||
set { CheckChanged(data.InstitutionId, value); data.InstitutionId = value; }
|
||||
}
|
||||
public String PatientNo
|
||||
{
|
||||
get { return data.PatientNo; }
|
||||
set { CheckChanged(data.PatientNo, value); data.PatientNo = value; }
|
||||
}
|
||||
public String NhsNumber
|
||||
{
|
||||
get { return data.NhsNumber; }
|
||||
set { CheckChanged(data.NhsNumber, value); data.NhsNumber = value; }
|
||||
}
|
||||
public String Title
|
||||
{
|
||||
get { return data.Title; }
|
||||
set { CheckChanged(data.Title, value); data.Title = value; }
|
||||
}
|
||||
public String Forename
|
||||
{
|
||||
get { return data.Forename; }
|
||||
set { CheckChanged(data.Forename, value); data.Forename = value; }
|
||||
}
|
||||
public String Surname
|
||||
{
|
||||
get { return data.Surname; }
|
||||
set { CheckChanged(data.Surname, value); data.Surname = value; }
|
||||
}
|
||||
public static String GetDisplayName(String surname, String forename, bool upperSurname = true)
|
||||
{
|
||||
String name = surname;
|
||||
if (upperSurname)
|
||||
name.ToUpper();
|
||||
if (!StringUtil.IsEmpty(surname) && !StringUtil.IsEmpty(forename))
|
||||
name += ", ";
|
||||
name += forename;
|
||||
return name;
|
||||
}
|
||||
public String GetDisplayName(bool upperSurname = true)
|
||||
{
|
||||
return GetDisplayName(Surname, Forename, upperSurname);
|
||||
}
|
||||
public Spm.Gender Gender
|
||||
{
|
||||
get { return data.Gender; }
|
||||
set { CheckChanged((int)data.Gender, (int)value); data.Gender = value; }
|
||||
}
|
||||
public DateTime BirthOn
|
||||
{
|
||||
get { return data.BirthOn; }
|
||||
set { CheckChanged(data.BirthOn, value); data.BirthOn = value; }
|
||||
}
|
||||
public String Age
|
||||
{
|
||||
get { return data.Age; }
|
||||
set { CheckChanged(data.Age, value); data.Age = value; }
|
||||
}
|
||||
public DateTime AgeOn
|
||||
{
|
||||
get { return data.AgeOn; }
|
||||
set { CheckChanged(data.AgeOn, value); data.AgeOn = value; }
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
|
||||
// Patient.
|
||||
public SysId InstitutionId { get; set; }
|
||||
public String PatientNo { get; set; }
|
||||
public String Surname { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Patient D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmPatientList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmProcedure : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
Pos,
|
||||
Id,
|
||||
DepartmentId,
|
||||
OperationId,
|
||||
Description,
|
||||
SpecialityCode,
|
||||
ComplexityCode,
|
||||
Duration,
|
||||
Duration_Training,
|
||||
Units,
|
||||
Units_Training,
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = ProcedureStatus;
|
||||
}
|
||||
public SysId DepartmentId { get; set; } // Department.
|
||||
public SysId OperationId { get; set; } // Operation Id.
|
||||
public String OperationCode { get; set; } // Operation code.
|
||||
public String Description { get; set; }
|
||||
public String SpecialityCode { get; set; }
|
||||
public String ComplexityCode { get; set; }
|
||||
public short Duration { get; set; } // Minutes.
|
||||
public short DurationTraining { get; set; } // Minutes.
|
||||
public decimal Units { get; set; }
|
||||
public decimal UnitsTraining { get; set; }
|
||||
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
DepartmentId = data.DepartmentId;
|
||||
OperationId = data.OperationId;
|
||||
OperationCode = data.OperationCode;
|
||||
Description = data.Description;
|
||||
SpecialityCode = data.SpecialityCode;
|
||||
ComplexityCode = data.ComplexityCode;
|
||||
Duration = data.Duration;
|
||||
DurationTraining = data.DurationTraining;
|
||||
Units = data.Units;
|
||||
UnitsTraining = data.UnitsTraining;
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
public ValidValue DepartmentId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OperationId { get; set; } = ValidValue.Valid;
|
||||
public ValidValue OperationCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Description { get; set; } = ValidValue.Valid;
|
||||
public ValidValue SpecialityCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue ComplexityCode { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Duration { get; set; } = ValidValue.Valid;
|
||||
public ValidValue DurationTraining { get; set; } = ValidValue.Valid;
|
||||
public ValidValue Units { get; set; } = ValidValue.Valid;
|
||||
public ValidValue UnitsTraining { get; set; } = ValidValue.Valid;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmProcedure(SysId procedureId, SysId departmentId) : base()
|
||||
{
|
||||
departmentId = DepartmentId;
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> procedureStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> ProcedureStatuses { get { return new List<SaStatus>(procedureStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
procedureStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
public SysId DepartmentId
|
||||
{
|
||||
get { return data.DepartmentId; }
|
||||
set { CheckChanged(data.DepartmentId, value); data.DepartmentId = value; }
|
||||
}
|
||||
public SysId OperationId
|
||||
{
|
||||
get { return data.OperationId; }
|
||||
set { CheckChanged(data.OperationId, value); data.OperationId = value; }
|
||||
}
|
||||
public String OperationCode
|
||||
{
|
||||
get { return data.OperationCode; }
|
||||
set { CheckChanged(data.OperationCode, value); data.OperationCode = value; }
|
||||
}
|
||||
public String Description
|
||||
{
|
||||
get { return data.Description; }
|
||||
set { CheckChanged(data.Description, value); data.Description = value; }
|
||||
}
|
||||
public String SpecialityCode
|
||||
{
|
||||
get { return data.SpecialityCode; }
|
||||
set { CheckChanged(data.SpecialityCode, value); data.SpecialityCode = value; }
|
||||
}
|
||||
public String ComplexityCode
|
||||
{
|
||||
get { return data.ComplexityCode; }
|
||||
set { CheckChanged(data.ComplexityCode, value); data.ComplexityCode = value; }
|
||||
}
|
||||
public short Duration
|
||||
{
|
||||
get { return data.Duration; }
|
||||
set { CheckChanged(data.Duration, value); data.Duration = value; }
|
||||
}
|
||||
public short DurationTraining
|
||||
{
|
||||
get { return data.DurationTraining; }
|
||||
set { CheckChanged(data.DurationTraining, value); data.DurationTraining = value; }
|
||||
}
|
||||
public decimal Units
|
||||
{
|
||||
get { return data.Units; }
|
||||
set { CheckChanged(data.Units, value); data.Units = value; }
|
||||
}
|
||||
public decimal UnitsTraining
|
||||
{
|
||||
get { return data.UnitsTraining; }
|
||||
set { CheckChanged(data.UnitsTraining, value); data.UnitsTraining = value; }
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// Procedure.
|
||||
public SysId OperationId { get; set; }
|
||||
public String OperationCode { get; set; }
|
||||
public String Description { get; set; }
|
||||
public String SpecialityCode { get; set; }
|
||||
public String ComplexityCode { get; set; }
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// Procedure D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmProcedureList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Bus
|
||||
{
|
||||
//=======================================================================
|
||||
public abstract class SpmTemplateData : SacsHierarchyItem
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Columns.
|
||||
public enum Column
|
||||
{
|
||||
// Common properties.
|
||||
Notes,
|
||||
Flags,
|
||||
Status,
|
||||
Status_Ind,
|
||||
Status_Desc,
|
||||
CreateOn_Date,
|
||||
UpdateOn_Date,
|
||||
}
|
||||
|
||||
// Data.
|
||||
public new class Data : SacsHierarchyItem.Data
|
||||
{
|
||||
public Data()
|
||||
{
|
||||
//Status = TemplateDataStatus;
|
||||
}
|
||||
internal void PopulateFrom(Data data)
|
||||
{
|
||||
base.PopulateFrom(data);
|
||||
}
|
||||
public Data Clone()
|
||||
{
|
||||
Data data = new Data();
|
||||
data.PopulateFrom(this);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
// ErrField.
|
||||
public new class ErrField : SacsHierarchyItem.ErrField
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private readonly Data data = new Data();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
protected SpmTemplateData(SysId id) : base(id)
|
||||
{
|
||||
Status = DefaultStatus;
|
||||
base.SetData(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Status.
|
||||
private static readonly List<SaStatus> templateDataStatuses = new List<SaStatus>()
|
||||
{
|
||||
SaStatus.Current,
|
||||
};
|
||||
public static SaStatus DefaultStatus { get { return SaStatus.Current; } }
|
||||
public static List<SaStatus> TemplateDataStatuses { get { return new List<SaStatus>(templateDataStatuses); } }
|
||||
public static DataValue.TriStateType GetStatusTriState(SaStatus status)
|
||||
{
|
||||
templateDataStatuses.Add(SaStatus.Current);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case SaStatus.Current:
|
||||
return DataValue.TriStateType.Green;
|
||||
}
|
||||
return DataValue.TriStateType.Unknown;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Attributes.
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Flags.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// A s s o c i a t e d D a t a E l e m e n t s
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// P a r a m s
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Parameters - used to define the filters that should be applied to a List of Addresses</summary>
|
||||
// List parameters.
|
||||
public enum StatusCat
|
||||
{
|
||||
Any,
|
||||
}
|
||||
/// <summary> Item list parameters. </summary>
|
||||
public new class Params : SacsHierarchyItem.Params
|
||||
{
|
||||
// List filtering.
|
||||
public List<SysId> IncludedIds { get; } = new List<SysId>();
|
||||
public List<SysId> ExcludedIds { get; } = new List<SysId>();
|
||||
// ###.
|
||||
|
||||
public StatusCat StatusCat { get; set; } = StatusCat.Any;
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
// TemplateData D a t a L i s t
|
||||
//=======================================================================
|
||||
public static class SpmTemplateDataList
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
Reference in New Issue
Block a user