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
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmAdmissionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// A d m i s s i o n
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual admission.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist admission.
|
||||
public abstract bool AdmissionExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get admission.
|
||||
public abstract SpmAdmission GetAdmission(SpmAdmission.Params prm);
|
||||
public abstract SpmAdmission GetAdmissionById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create admission.
|
||||
public abstract SpmAdmission CreateAdmission(SysId facilityId, SysId facilityTemplateId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate admission data.
|
||||
public bool IsValidAdmission(SpmAdmission admission)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (admission == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidAdmissionData(admission.GetData(), new SpmAdmission.ErrField());
|
||||
}
|
||||
public virtual bool IsValidAdmissionData(SpmAdmission.Data data, SpmAdmission.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Admission properties.
|
||||
if (errField.FacilityId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.FacilityId))
|
||||
{
|
||||
errField.FacilityId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid facility Id");
|
||||
}
|
||||
if (errField.AdmissionFrom != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.AdmissionFrom))
|
||||
{
|
||||
errField.AdmissionFrom = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("'From' date not specified");
|
||||
}
|
||||
if (errField.AdmissionTo != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.AdmissionTo))
|
||||
{
|
||||
errField.AdmissionTo = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("'To' date not specified");
|
||||
}
|
||||
if (errField.ToComeIn != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.ToComeIn))
|
||||
{
|
||||
if (data.ToComeIn > data.AdmissionFrom) return SetErrorState("'TCI' cannot be after the admission date/time");
|
||||
errField.ToComeIn = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AdmissionType != SacsHierarchyItem.ValidValue.Ignore && (short)data.AdmissionType < 1)
|
||||
{
|
||||
if ((int)data.AdmissionType < 1)
|
||||
{
|
||||
errField.AdmissionType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Admission type must be supplied");
|
||||
}
|
||||
}
|
||||
|
||||
bool patientEntered = !StringUtil.IsEmpty(data.PatientNo) || !StringUtil.IsEmpty(data.Surname) || !StringUtil.IsEmpty(data.Forename) || !StringUtil.IsEmpty(data.Age);
|
||||
|
||||
if (errField.PatientNo != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PatientNo, "PatientNo", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_PatientNo), true))
|
||||
{
|
||||
errField.PatientNo = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.NhsNumber != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.NhsNumber, "NhsNumber", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_NhsNumber), true))
|
||||
{
|
||||
errField.NhsNumber = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Title != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Title, "Title", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Title), true))
|
||||
{
|
||||
errField.Title = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Forename != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Forename, "Forename", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Forename), true))
|
||||
{
|
||||
errField.Forename = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Surname != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Surname, "Surname", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Surname), patientEntered))
|
||||
{
|
||||
errField.Surname = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Age != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Age, "Age", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Age), true))
|
||||
{
|
||||
errField.Age = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Ward != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Ward, "Ward", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Ward), true))
|
||||
{
|
||||
errField.Ward = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SpecialityCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SpecialityCode, "SpecialityCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_SpecialityCode), true))
|
||||
{
|
||||
errField.SpecialityCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ProcedureDesc != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ProcedureDesc, "ProcedureDesc", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_ProcedureDesc), true))
|
||||
{
|
||||
errField.ProcedureDesc = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ComplexityCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ComplexityCode, "ComplexityCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_ComplexityCode), true))
|
||||
{
|
||||
errField.ComplexityCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ProcedureIndication != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ProcedureIndication, "ProcedureIndication", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_ProcedureIndication), true))
|
||||
{
|
||||
errField.ProcedureIndication = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.GestationPeriod != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.GestationPeriod, "GestationPeriod", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_GestationPeriod), true))
|
||||
{
|
||||
errField.GestationPeriod = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SystemRef != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SystemRef, "SystemRef", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_SystemRef), true))
|
||||
{
|
||||
errField.SystemRef = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Anaesthetic != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Anaesthetic, "Anaesthetic", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Anaesthetic), true))
|
||||
{
|
||||
errField.Anaesthetic = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Position != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Position, "Position", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Position), true))
|
||||
{
|
||||
errField.Position = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SpecialEquipment != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SpecialEquipment, "SpecialEquipment", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_SpecialEquipment), true))
|
||||
{
|
||||
errField.SpecialEquipment = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.AttendanceStatus != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.AttendanceStatus, "AttendanceStatus", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_AttendanceStatus), true))
|
||||
{
|
||||
errField.AttendanceStatus = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ComfortScore != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ComfortScore, "ComfortScore", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_ComfortScore), true))
|
||||
{
|
||||
errField.ComfortScore = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.CancelCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CancelCode, "CancelCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_CancelCode), true))
|
||||
{
|
||||
errField.CancelCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.CancelReason != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CancelReason, "CancelReason", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_CancelReason), true))
|
||||
{
|
||||
errField.CancelReason = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmission_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmAdmission.AdmissionStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Admission database interface.
|
||||
public abstract bool InsertAdmission(SpmAdmission admission, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateAdmission(SpmAdmission admission, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool AdmissionCanBeDeleted(SpmAdmission admission)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteAdmission(SpmAdmission admission, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Admission list.
|
||||
public abstract ColumnDfn GetAdmissionColumnDfn(SpmAdmission.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetAdmissionQueryFilter(SpmAdmission.Params prm);
|
||||
public abstract long GetAdmissionCount(SpmAdmission.Params prm);
|
||||
public abstract List<SpmAdmission> GetAdmissionList(SpmAdmission.Params prm);
|
||||
public abstract DbResultSet ExecuteAdmissionQuery(List<ColumnDfn> columns, SpmAdmission.Params prm);
|
||||
public abstract DataValue GetAdmissionDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmAdmissionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// A d m i s s i o n A c t i o n
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual admissionAction.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist admissionAction.
|
||||
public abstract bool AdmissionActionExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get admissionAction.
|
||||
public abstract SpmAdmissionAction GetAdmissionAction(SpmAdmissionAction.Params prm);
|
||||
public abstract SpmAdmissionAction GetAdmissionActionById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create admissionAction.
|
||||
public abstract SpmAdmissionAction CreateAdmissionAction(SysId admissionId, Spm.AdmissionActionType admissionActionType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate admissionAction data.
|
||||
public bool IsValidAdmissionAction(SpmAdmissionAction admissionAction)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (admissionAction == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidAdmissionActionData(admissionAction.GetData(), new SpmAdmissionAction.ErrField());
|
||||
}
|
||||
public virtual bool IsValidAdmissionActionData(SpmAdmissionAction.Data data, SpmAdmissionAction.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// AdmissionAction properties.
|
||||
if (errField.AdmissionId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.AdmissionId))
|
||||
{
|
||||
errField.AdmissionId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid admission Id");
|
||||
}
|
||||
if (errField.AdmissionActionType != SacsHierarchyItem.ValidValue.Ignore && (short)data.AdmissionActionType < 1)
|
||||
{
|
||||
if ((int)data.AdmissionActionType < 1)
|
||||
{
|
||||
errField.AdmissionActionType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Association type must be supplied");
|
||||
}
|
||||
}
|
||||
if (errField.Raised != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.Raised))
|
||||
{
|
||||
errField.Raised = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionAction_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionAction_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmAdmissionAction.AdmissionActionStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// AdmissionAction database interface.
|
||||
public abstract bool InsertAdmissionAction(SpmAdmissionAction admissionAction, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateAdmissionAction(SpmAdmissionAction admissionAction, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool AdmissionActionCanBeDeleted(SpmAdmissionAction admissionAction)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteAdmissionAction(SpmAdmissionAction admissionAction, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// AdmissionAction list.
|
||||
public abstract ColumnDfn GetAdmissionActionColumnDfn(SpmAdmissionAction.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetAdmissionActionQueryFilter(SpmAdmissionAction.Params prm);
|
||||
public abstract long GetAdmissionActionCount(SpmAdmissionAction.Params prm);
|
||||
public abstract List<SpmAdmissionAction> GetAdmissionActionList(SpmAdmissionAction.Params prm);
|
||||
public abstract DbResultSet ExecuteAdmissionActionQuery(List<ColumnDfn> columns, SpmAdmissionAction.Params prm);
|
||||
public abstract DataValue GetAdmissionActionDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmAdmissionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// A d m i s s i o n D a t a
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual admissionData.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist admissionData.
|
||||
public abstract bool AdmissionDataExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get admissionData.
|
||||
public abstract SpmAdmissionData GetAdmissionData(SpmAdmissionData.Params prm);
|
||||
public abstract SpmAdmissionData GetAdmissionDataById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create admissionData.
|
||||
public abstract SpmAdmissionData CreateAdmissionData(SysId admissionId, Spm.AdmissionDataType admissionDataType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate admissionData data.
|
||||
public bool IsValidAdmissionData(SpmAdmissionData admissionData)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (admissionData == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidAdmissionDataData(admissionData.GetData(), new SpmAdmissionData.ErrField());
|
||||
}
|
||||
public virtual bool IsValidAdmissionDataData(SpmAdmissionData.Data data, SpmAdmissionData.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// AdmissionData properties.
|
||||
if (errField.AdmissionId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.AdmissionId))
|
||||
{
|
||||
errField.AdmissionId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid admission Id");
|
||||
}
|
||||
if (errField.AdmissionDataType != SacsHierarchyItem.ValidValue.Ignore && (short)data.AdmissionDataType < 1)
|
||||
{
|
||||
if ((int)data.AdmissionDataType < 1)
|
||||
{
|
||||
errField.AdmissionDataType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Admission Data Type must be supplied");
|
||||
}
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionData_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionData_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmAdmissionData.AdmissionDataStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// AdmissionData database interface.
|
||||
public abstract bool InsertAdmissionData(SpmAdmissionData admissionData, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateAdmissionData(SpmAdmissionData admissionData, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool AdmissionDataCanBeDeleted(SpmAdmissionData admissionData)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteAdmissionData(SpmAdmissionData admissionData, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// AdmissionData list.
|
||||
public abstract ColumnDfn GetAdmissionDataColumnDfn(SpmAdmissionData.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetAdmissionDataQueryFilter(SpmAdmissionData.Params prm);
|
||||
public abstract long GetAdmissionDataCount(SpmAdmissionData.Params prm);
|
||||
public abstract List<SpmAdmissionData> GetAdmissionDataList(SpmAdmissionData.Params prm);
|
||||
public abstract DbResultSet ExecuteAdmissionDataQuery(List<ColumnDfn> columns, SpmAdmissionData.Params prm);
|
||||
public abstract DataValue GetAdmissionDataDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmAdmissionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// A d m i s s i o n R o l e
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual admissionRole.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist admissionRole.
|
||||
public abstract bool AdmissionRoleExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get admissionRole.
|
||||
public abstract SpmAdmissionRole GetAdmissionRole(SpmAdmissionRole.Params prm);
|
||||
public abstract SpmAdmissionRole GetAdmissionRoleById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create admissionRole.
|
||||
public abstract SpmAdmissionRole CreateAdmissionRole(SysId admissionId, Spm.EmployeeRole employeeRole, Spm.EmployeeRoleCategory employeeRoleCategory);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate admissionRole data.
|
||||
public bool IsValidAdmissionRole(SpmAdmissionRole admissionRole)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (admissionRole == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidAdmissionRoleData(admissionRole.GetData(), new SpmAdmissionRole.ErrField());
|
||||
}
|
||||
public virtual bool IsValidAdmissionRoleData(SpmAdmissionRole.Data data, SpmAdmissionRole.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// AdmissionRole properties.
|
||||
if (errField.AdmissionId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.AdmissionId))
|
||||
{
|
||||
errField.AdmissionId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid admission Id");
|
||||
}
|
||||
if (errField.Seq != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Seq.ToString(), "seq", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionRole_Seq), true))
|
||||
{
|
||||
errField.Seq = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.EmployeeRole != SacsHierarchyItem.ValidValue.Ignore && (short)data.EmployeeRole < 1)
|
||||
{
|
||||
if ((int)data.EmployeeRole < 1)
|
||||
{
|
||||
errField.EmployeeRole = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Employee role must be supplied");
|
||||
}
|
||||
}
|
||||
if (errField.EmployeeRoleId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.EmployeeRoleId))
|
||||
{
|
||||
errField.EmployeeRoleId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid employeeRoleId");
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionRole_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmAdmissionRole_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmAdmissionRole.AdmissionRoleStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// AdmissionRole database interface.
|
||||
public abstract bool InsertAdmissionRole(SpmAdmissionRole admissionRole, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateAdmissionRole(SpmAdmissionRole admissionRole, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool AdmissionRoleCanBeDeleted(SpmAdmissionRole admissionRole)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteAdmissionRole(SpmAdmissionRole admissionRole, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// AdmissionRole list.
|
||||
public abstract ColumnDfn GetAdmissionRoleColumnDfn(SpmAdmissionRole.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetAdmissionRoleQueryFilter(SpmAdmissionRole.Params prm);
|
||||
public abstract long GetAdmissionRoleCount(SpmAdmissionRole.Params prm);
|
||||
public abstract List<SpmAdmissionRole> GetAdmissionRoleList(SpmAdmissionRole.Params prm);
|
||||
public abstract DbResultSet ExecuteAdmissionRoleQuery(List<ColumnDfn> columns, SpmAdmissionRole.Params prm);
|
||||
public abstract DataValue GetAdmissionRoleDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -10,9 +10,9 @@ namespace Sarand.PatientMgr.Core.Mgr
|
||||
// Department
|
||||
// Employee Role
|
||||
// Facility
|
||||
// Facility Session
|
||||
// Facility Template
|
||||
// Template Data
|
||||
// Facility Session
|
||||
// Procedure
|
||||
//=======================================================================
|
||||
public abstract partial class SpmDepartmentMgr : SpmItemMgr
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// D e p a r t m e n t
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual department.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist department.
|
||||
public abstract bool DepartmentExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get department.
|
||||
public abstract SpmDepartment GetDepartment(SpmDepartment.Params prm);
|
||||
public abstract SpmDepartment GetDepartmentById(SysId id);
|
||||
public abstract SpmDepartment GetDepartmentByName(String name);
|
||||
public abstract SpmDepartment GetDepartmentByFacilityId(SysId facilityId);
|
||||
public abstract SpmDepartment GetDepartmentByFacilityTemplateId(SysId facilityId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create department.
|
||||
public abstract SpmDepartment CreateDepartment();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate department data.
|
||||
public bool IsValidDepartment(SpmDepartment department)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (department == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidDepartmentData(department.GetData(), new SpmDepartment.ErrField());
|
||||
}
|
||||
public virtual bool IsValidDepartmentData(SpmDepartment.Data data, SpmDepartment.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Department properties.
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "name", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmDepartment_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ApplicationFrom != SacsHierarchyItem.ValidValue.Ignore && errField.ApplicationTo != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.ApplicationFrom) && DateUtil.IsValid(data.ApplicationTo))
|
||||
{
|
||||
if (data.ApplicationFrom.CompareTo(data.ApplicationTo) > 0)
|
||||
{
|
||||
errField.ApplicationFrom = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid application date range");
|
||||
}
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmDepartment_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmDepartment_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmDepartment.DepartmentStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Department database interface.
|
||||
public abstract bool InsertDepartment(SpmDepartment department, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateDepartment(SpmDepartment department, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool DepartmentCanBeDeleted(SpmDepartment department)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteDepartment(SpmDepartment department, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Department list.
|
||||
public abstract ColumnDfn GetDepartmentColumnDfn(SpmDepartment.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetDepartmentQueryFilter(SpmDepartment.Params prm);
|
||||
public abstract long GetDepartmentCount(SpmDepartment.Params prm);
|
||||
public abstract List<SpmDepartment> GetDepartmentList(SpmDepartment.Params prm);
|
||||
public abstract DbResultSet ExecuteDepartmentQuery(List<ColumnDfn> columns, SpmDepartment.Params prm);
|
||||
public abstract DataValue GetDepartmentDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// E m p l o y e e R o l e
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual employeeRole.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist employeeRole.
|
||||
public abstract bool EmployeeRoleExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get employeeRole.
|
||||
public abstract SpmEmployeeRole GetEmployeeRole(SpmEmployeeRole.Params prm);
|
||||
public abstract SpmEmployeeRole GetEmployeeRoleById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create employeeRole.
|
||||
public abstract SpmEmployeeRole CreateEmployeeRole(SysId deparmentId, SysId employeeId, Spm.EmployeeRole employeeRole);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate employeeRole data.
|
||||
public bool IsValidEmployeeRole(SpmEmployeeRole employeeRole)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (employeeRole == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidEmployeeRoleData(employeeRole.GetData(), new SpmEmployeeRole.ErrField());
|
||||
}
|
||||
public virtual bool IsValidEmployeeRoleData(SpmEmployeeRole.Data data, SpmEmployeeRole.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// EmployeeRole properties.
|
||||
if (errField.DepartmentId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.DepartmentId))
|
||||
{
|
||||
errField.DepartmentId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid DepartmentId");
|
||||
}
|
||||
if (errField.EmployeeId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.EmployeeId))
|
||||
{
|
||||
errField.EmployeeId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid EmployeeId");
|
||||
}
|
||||
if (errField.EmployeeRole != SacsHierarchyItem.ValidValue.Ignore && (short)data.EmployeeRole < 1)
|
||||
{
|
||||
if ((int)data.EmployeeRole < 1)
|
||||
{
|
||||
errField.EmployeeRole = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Employee role must be supplied");
|
||||
}
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployeeRole_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployeeRole_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmEmployeeRole.EmployeeRoleStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// EmployeeRole database interface.
|
||||
public abstract bool InsertEmployeeRole(SpmEmployeeRole employeeRole, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateEmployeeRole(SpmEmployeeRole employeeRole, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool EmployeeRoleCanBeDeleted(SpmEmployeeRole employeeRole)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteEmployeeRole(SpmEmployeeRole employeeRole, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// EmployeeRole list.
|
||||
public abstract ColumnDfn GetEmployeeRoleColumnDfn(SpmEmployeeRole.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetEmployeeRoleQueryFilter(SpmEmployeeRole.Params prm);
|
||||
public abstract long GetEmployeeRoleCount(SpmEmployeeRole.Params prm);
|
||||
public abstract List<SpmEmployeeRole> GetEmployeeRoleList(SpmEmployeeRole.Params prm);
|
||||
public abstract DbResultSet ExecuteEmployeeRoleQuery(List<ColumnDfn> columns, SpmEmployeeRole.Params prm);
|
||||
public abstract DataValue GetEmployeeRoleDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// F a c i l i t y
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual facility.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist facility.
|
||||
public abstract bool FacilityExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get facility.
|
||||
public abstract SpmFacility GetFacility(SpmFacility.Params prm);
|
||||
public abstract SpmFacility GetFacilityById(SysId id);
|
||||
public abstract SpmFacility GetFacilityByName(String name);
|
||||
public abstract SpmFacility GetFacilityByTemplateId(SysId facilityTemplateId);
|
||||
//-------------------------------------------------------------------
|
||||
// Create facility.
|
||||
public abstract SpmFacility CreateFacility(SysId facilityId, SysId departmentId, Spm.FacilityType facilityType);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate facility data.
|
||||
public bool IsValidFacility(SpmFacility facility)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (facility == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidFacilityData(facility.GetData(), new SpmFacility.ErrField());
|
||||
}
|
||||
public virtual bool IsValidFacilityData(SpmFacility.Data data, SpmFacility.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Facility properties.
|
||||
if (errField.DepartmentId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.DepartmentId))
|
||||
{
|
||||
errField.DepartmentId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid department Id");
|
||||
}
|
||||
if (errField.FacilityType != SacsHierarchyItem.ValidValue.Ignore && (short)data.FacilityType < 1)
|
||||
{
|
||||
if ((int)data.FacilityType < 1)
|
||||
{
|
||||
errField.FacilityType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("FacilityType must be supplied");
|
||||
}
|
||||
}
|
||||
if (errField.TemplateMapType != SacsHierarchyItem.ValidValue.Ignore && (short)data.TemplateMapType < 1)
|
||||
{
|
||||
if ((int)data.TemplateMapType < 1)
|
||||
{
|
||||
errField.FacilityType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("TemplateMapType must be supplied");
|
||||
}
|
||||
}
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "Name", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacility_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SortCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SortCode, "SortCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacility_SortCode), true))
|
||||
{
|
||||
errField.SortCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Desc != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Desc, "Desc", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacility_Description), true))
|
||||
{
|
||||
errField.Desc = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ScheduleFreezeType != SacsHierarchyItem.ValidValue.Ignore && (short)data.ScheduleFreezeType < 1)
|
||||
{
|
||||
if ((int)data.ScheduleFreezeType < 1)
|
||||
{
|
||||
errField.FacilityType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("ScheduleFreezeType must be supplied");
|
||||
}
|
||||
}
|
||||
if (errField.ScheduleFreezeData != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ScheduleFreezeData, "ScheduleFreezeData", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacility_ScheduleFreezeData), true))
|
||||
{
|
||||
errField.ScheduleFreezeData = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ApplicationFrom != SacsHierarchyItem.ValidValue.Ignore && errField.ApplicationTo != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.ApplicationFrom) && DateUtil.IsValid(data.ApplicationTo))
|
||||
{
|
||||
if (data.ApplicationFrom.CompareTo(data.ApplicationTo) > 0)
|
||||
{
|
||||
errField.ApplicationFrom = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid application date range");
|
||||
}
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacility_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacility_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmFacility.FacilityStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Facility database interface.
|
||||
public abstract bool InsertFacility(SpmFacility facility, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateFacility(SpmFacility facility, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool FacilityCanBeDeleted(SpmFacility facility)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteFacility(SpmFacility facility, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Facility list.
|
||||
public abstract ColumnDfn GetFacilityColumnDfn(SpmFacility.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetFacilityQueryFilter(SpmFacility.Params prm);
|
||||
public abstract long GetFacilityCount(SpmFacility.Params prm);
|
||||
public abstract List<SpmFacility> GetFacilityList(SpmFacility.Params prm);
|
||||
public abstract DbResultSet ExecuteFacilityQuery(List<ColumnDfn> columns, SpmFacility.Params prm);
|
||||
public abstract DataValue GetFacilityDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// F a c i l i t y S e s s i o n
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual facilitySession.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist facilitySession.
|
||||
public abstract bool FacilitySessionExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get facilitySession.
|
||||
public abstract SpmFacilitySession GetFacilitySession(SpmFacilitySession.Params prm);
|
||||
public abstract SpmFacilitySession GetFacilitySessionById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create facilitySession.
|
||||
public abstract SpmFacilitySession CreateFacilitySession(SysId facilityId, SysId facilityTemplateId, DateTime sessionDate);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate facilitySession data.
|
||||
public bool IsValidFacilitySession(SpmFacilitySession facilitySession)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (facilitySession == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidFacilitySessionData(facilitySession.GetData(), new SpmFacilitySession.ErrField());
|
||||
}
|
||||
public virtual bool IsValidFacilitySessionData(SpmFacilitySession.Data data, SpmFacilitySession.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// FacilitySession properties.
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "Name", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Desc != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Desc, "Description", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_Description), true))
|
||||
{
|
||||
errField.Desc = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SessionCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SessionCode, "SessionCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_SessionCode), true))
|
||||
{
|
||||
errField.SessionCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ConsultantCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ConsultantCode, "ConsultantCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_ConsultantCode), true))
|
||||
{
|
||||
errField.ConsultantCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SpecialityCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SpecialityCode, "SpecialityCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_SpecialityCode), true))
|
||||
{
|
||||
errField.SpecialityCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmFacilitySession.FacilitySessionStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// FacilitySession database interface.
|
||||
public abstract bool InsertFacilitySession(SpmFacilitySession facilitySession, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateFacilitySession(SpmFacilitySession facilitySession, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool FacilitySessionCanBeDeleted(SpmFacilitySession facilitySession)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteFacilitySession(SpmFacilitySession facilitySession, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// FacilitySession list.
|
||||
public abstract ColumnDfn GetFacilitySessionColumnDfn(SpmFacilitySession.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetFacilitySessionQueryFilter(SpmFacilitySession.Params prm);
|
||||
public abstract long GetFacilitySessionCount(SpmFacilitySession.Params prm);
|
||||
public abstract List<SpmFacilitySession> GetFacilitySessionList(SpmFacilitySession.Params prm);
|
||||
public abstract DbResultSet ExecuteFacilitySessionQuery(List<ColumnDfn> columns, SpmFacilitySession.Params prm);
|
||||
public abstract DataValue GetFacilitySessionDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// F a c i l i t y T e m p l a t e
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual facilityTemplate.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist facilityTemplate.
|
||||
public abstract bool FacilityTemplateExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get facilityTemplate.
|
||||
public abstract SpmFacilityTemplate GetFacilityTemplate(SpmFacilityTemplate.Params prm);
|
||||
public abstract SpmFacilityTemplate GetFacilityTemplateById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create facilityTemplate.
|
||||
public abstract SpmFacilityTemplate CreateFacilityTemplate(SysId facilityId, Spm.ResourceCategory resourceCategory);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate facilityTemplate data.
|
||||
public bool IsValidFacilityTemplate(SpmFacilityTemplate facilityTemplate)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (facilityTemplate == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidFacilityTemplateData(facilityTemplate.GetData(), new SpmFacilityTemplate.ErrField());
|
||||
}
|
||||
public virtual bool IsValidFacilityTemplateData(SpmFacilityTemplate.Data data, SpmFacilityTemplate.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// FacilityTemplate properties.
|
||||
if (errField.Group != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Group, "Group", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_Group), true))
|
||||
{
|
||||
errField.Group = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "Name", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SortCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SortCode, "SortCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_SortCode), true))
|
||||
{
|
||||
errField.SortCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Desc != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Desc, "Desc", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_Description), true))
|
||||
{
|
||||
errField.Desc = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SessionCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SessionCode, "SessionCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_SessionCode), true))
|
||||
{
|
||||
errField.SessionCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ToDo FacilityType&TemplateMapType need to have connection between Facility and FacilityTemplate like FacTmpl.WeekOfMonth etc.
|
||||
/*if (Type != Spm.FacilityType.Ward)
|
||||
{
|
||||
// Validate week of month against the template map type.
|
||||
if (TemplateMapType == Spm.FacilityTemplateMapType.RollingWeek && data.WeekOfMonth != 0) return SetErrorState("week of month must be '0'");
|
||||
if (TemplateMapType != Spm.FacilityTemplateMapType.RollingWeek && (data.WeekOfMonth < 1 || data.WeekOfMonth > 5)) return SetErrorState("week of month must be between 1 and 5");
|
||||
|
||||
// Validate the day of the week.
|
||||
if (data.DayOfWeek() < 1 || data.DayOfWeek() > 7) return SetErrorState("invalid day of week");
|
||||
}*/
|
||||
|
||||
if (errField.CapacityMin != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CapacityMin.ToString(), "CapacityMin", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_CapacityMin), true))
|
||||
{
|
||||
errField.CapacityMin = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid CapacityMin");
|
||||
}
|
||||
if (errField.CapacityMax != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.CapacityMax.ToString(), "CapacityMax", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_CapacityMax), true))
|
||||
{
|
||||
errField.CapacityMax = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid CapacityMax");
|
||||
}
|
||||
if (errField.DurationInterval != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DurationInterval.ToString(), "DurationInterval", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_DurationInterval), true))
|
||||
{
|
||||
errField.DurationInterval = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid DurationInterval");
|
||||
}
|
||||
if (errField.DurationMin != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DurationMin.ToString(), "DurationMin", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_DurationMin), true))
|
||||
{
|
||||
errField.DurationMin = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid DurationMin");
|
||||
}
|
||||
if (errField.DurationMax != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DurationMax.ToString(), "DurationMax", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_DurationMax), true))
|
||||
{
|
||||
errField.DurationMax = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid DurationMax");
|
||||
}
|
||||
if (errField.DurationBreaks != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.DurationBreaks.ToString(), "DurationBreaks", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_DurationBreaks), true))
|
||||
{
|
||||
errField.DurationBreaks = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid DurationBreaks");
|
||||
}
|
||||
|
||||
if (errField.ConsultantCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ConsultantCode, "ConsultantCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_ConsultantCode), true))
|
||||
{
|
||||
errField.ConsultantCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SpecialityCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SpecialityCode, "SpecialityCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilitySession_SpecialityCode), true))
|
||||
{
|
||||
errField.SpecialityCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ToDo need to get FacilityType.WARD for StartTime & FinishTime with ApplicationFrom & ApplicationTo.
|
||||
/*if (Type == Spm.FacilityType.Ward)
|
||||
{
|
||||
// Wards - start and finish times should be '00:00'.
|
||||
if (data.GetStartTime != Time("00:00:00")) return SetErrorState("invalid start time");
|
||||
if (data.GetFinishTime != Time("00:00:00")) return SetErrorState("invalid finish time");
|
||||
}
|
||||
else
|
||||
if (data.StartTime >= data.FinishTime) return SetErrorState("invalid start/finish times");*/
|
||||
|
||||
if (errField.ApplicationFrom != SacsHierarchyItem.ValidValue.Ignore && errField.ApplicationTo != SacsHierarchyItem.ValidValue.Ignore && DateUtil.IsValid(data.ApplicationFrom) && DateUtil.IsValid(data.ApplicationTo))
|
||||
{
|
||||
if (data.ApplicationFrom.CompareTo(data.ApplicationTo) > 0)
|
||||
{
|
||||
errField.ApplicationFrom = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Invalid application date range");
|
||||
}
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmFacilityTemplate_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmFacilityTemplate.FacilityTemplateStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// FacilityTemplate database interface.
|
||||
public abstract bool InsertFacilityTemplate(SpmFacilityTemplate facilityTemplate, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateFacilityTemplate(SpmFacilityTemplate facilityTemplate, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool FacilityTemplateCanBeDeleted(SpmFacilityTemplate facilityTemplate)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteFacilityTemplate(SpmFacilityTemplate facilityTemplate, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// FacilityTemplate list.
|
||||
public abstract ColumnDfn GetFacilityTemplateColumnDfn(SpmFacilityTemplate.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetFacilityTemplateQueryFilter(SpmFacilityTemplate.Params prm);
|
||||
public abstract long GetFacilityTemplateCount(SpmFacilityTemplate.Params prm);
|
||||
public abstract List<SpmFacilityTemplate> GetFacilityTemplateList(SpmFacilityTemplate.Params prm);
|
||||
public abstract DbResultSet ExecuteFacilityTemplateQuery(List<ColumnDfn> columns, SpmFacilityTemplate.Params prm);
|
||||
public abstract DataValue GetFacilityTemplateDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// P r o c e d u r e
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual procedure.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist procedure.
|
||||
public abstract bool ProcedureExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get procedure.
|
||||
public abstract SpmProcedure GetProcedure(SpmProcedure.Params prm);
|
||||
public abstract SpmProcedure GetProcedureById(SysId id);
|
||||
public abstract SpmProcedure GetProcedureByCode(String operationCode);
|
||||
public abstract SpmProcedure GetProcedureByOperationId(SysId operationId);
|
||||
//-------------------------------------------------------------------
|
||||
// Create procedure.
|
||||
public abstract SpmProcedure CreateProcedure(SysId procedureId, SysId departmentId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate procedure data.
|
||||
public bool IsValidProcedure(SpmProcedure procedure)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (procedure == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidProcedureData(procedure.GetData(), new SpmProcedure.ErrField());
|
||||
}
|
||||
public virtual bool IsValidProcedureData(SpmProcedure.Data data, SpmProcedure.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Procedure properties.
|
||||
if (errField.DepartmentId != SacsHierarchyItem.ValidValue.Ignore && !SysId.IsValid(data.DepartmentId))
|
||||
{
|
||||
errField.DepartmentId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("invalid department Id");
|
||||
}
|
||||
if (errField.OperationCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.OperationCode, "OperationCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmProcedure_OpnCode), true))
|
||||
{
|
||||
errField.OperationCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Description != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Description, "Description", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmProcedure_Description), true))
|
||||
{
|
||||
errField.Description = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.SpecialityCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.SpecialityCode, "SpecialityCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmProcedure_SpecialityCode), true))
|
||||
{
|
||||
errField.SpecialityCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.ComplexityCode != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.ComplexityCode, "ComplexityCode", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmProcedure_ComplexityCode), true))
|
||||
{
|
||||
errField.ComplexityCode = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmProcedure_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmProcedure_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmProcedure.ProcedureStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Procedure database interface.
|
||||
public abstract bool InsertProcedure(SpmProcedure procedure, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateProcedure(SpmProcedure procedure, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool ProcedureCanBeDeleted(SpmProcedure procedure)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteProcedure(SpmProcedure procedure, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Procedure list.
|
||||
public abstract ColumnDfn GetProcedureColumnDfn(SpmProcedure.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetProcedureQueryFilter(SpmProcedure.Params prm);
|
||||
public abstract long GetProcedureCount(SpmProcedure.Params prm);
|
||||
public abstract List<SpmProcedure> GetProcedureList(SpmProcedure.Params prm);
|
||||
public abstract DbResultSet ExecuteProcedureQuery(List<ColumnDfn> columns, SpmProcedure.Params prm);
|
||||
public abstract DataValue GetProcedureDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmDepartmentMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// T e m p l a t e D a t a
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual templateData.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist templateData.
|
||||
public abstract bool TemplateDataExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get templateData.
|
||||
public abstract SpmTemplateData GetTemplateData(SpmTemplateData.Params prm);
|
||||
public abstract SpmTemplateData GetTemplateDataById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create templateData.
|
||||
public abstract SpmTemplateData CreateTemplateData();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate templateData data.
|
||||
public bool IsValidTemplateData(SpmTemplateData templateData)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (templateData == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidTemplateDataData(templateData.GetData(), new SpmTemplateData.ErrField());
|
||||
}
|
||||
public virtual bool IsValidTemplateDataData(SpmTemplateData.Data data, SpmTemplateData.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// TemplateData properties.
|
||||
|
||||
|
||||
// Common properties.
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmTemplateData_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmTemplateData.TemplateDataStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// TemplateData database interface.
|
||||
public abstract bool InsertTemplateData(SpmTemplateData templateData, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateTemplateData(SpmTemplateData templateData, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool TemplateDataCanBeDeleted(SpmTemplateData templateData)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteTemplateData(SpmTemplateData templateData, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// TemplateData list.
|
||||
public abstract ColumnDfn GetTemplateDataColumnDfn(SpmTemplateData.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetTemplateDataQueryFilter(SpmTemplateData.Params prm);
|
||||
public abstract long GetTemplateDataCount(SpmTemplateData.Params prm);
|
||||
public abstract List<SpmTemplateData> GetTemplateDataList(SpmTemplateData.Params prm);
|
||||
public abstract DbResultSet ExecuteTemplateDataQuery(List<ColumnDfn> columns, SpmTemplateData.Params prm);
|
||||
public abstract DataValue GetTemplateDataDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmInstitutionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// E m p l o y e e
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual employee.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist employee.
|
||||
public abstract bool EmployeeExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get employee.
|
||||
public abstract SpmEmployee GetEmployee(SpmEmployee.Params prm);
|
||||
public abstract SpmEmployee GetEmployeeById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create employee.
|
||||
public abstract SpmEmployee CreateEmployee(SysId id, SysId institutionId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate employee data.
|
||||
public bool IsValidEmployee(SpmEmployee employee)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (employee == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidEmployeeData(employee.GetData(), new SpmEmployee.ErrField());
|
||||
}
|
||||
public virtual bool IsValidEmployeeData(SpmEmployee.Data data, SpmEmployee.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Employee properties.
|
||||
if (errField.EmployeeNo != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.EmployeeNo, "EmployeeNo", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_EmployeeNo), true))
|
||||
{
|
||||
errField.EmployeeNo = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Code != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Code, "Code", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Code), true))
|
||||
{
|
||||
errField.Code = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Title != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Title, "Title", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Title), true))
|
||||
{
|
||||
errField.Title = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Initials != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Initials, "Initials", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Initials), true))
|
||||
{
|
||||
errField.Initials = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Forename != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Forename, "Forename", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Forename), true))
|
||||
{
|
||||
errField.Forename = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Surname != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Surname, "Surname", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Surname), true))
|
||||
{
|
||||
errField.Surname = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmEmployee_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmEmployee.EmployeeStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Employee database interface.
|
||||
public abstract bool InsertEmployee(SpmEmployee employee, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateEmployee(SpmEmployee employee, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool EmployeeCanBeDeleted(SpmEmployee employee)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteEmployee(SpmEmployee employee, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Employee list.
|
||||
public abstract ColumnDfn GetEmployeeColumnDfn(SpmEmployee.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetEmployeeQueryFilter(SpmEmployee.Params prm);
|
||||
public abstract long GetEmployeeCount(SpmEmployee.Params prm);
|
||||
public abstract List<SpmEmployee> GetEmployeeList(SpmEmployee.Params prm);
|
||||
public abstract DbResultSet ExecuteEmployeeQuery(List<ColumnDfn> columns, SpmEmployee.Params prm);
|
||||
public abstract DataValue GetEmployeeDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmInstitutionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// I n s t i t u t i o n
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual institution.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist institution.
|
||||
public abstract bool InstitutionExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get institution.
|
||||
public abstract SpmInstitution GetInstitution(SpmInstitution.Params prm);
|
||||
public abstract SpmInstitution GetInstitutionById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create institution.
|
||||
public abstract SpmInstitution CreateInstitution(SysId institutionId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate institution data.
|
||||
public bool IsValidInstitution(SpmInstitution institution)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (institution == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidInstitutionData(institution.GetData(), new SpmInstitution.ErrField());
|
||||
}
|
||||
public virtual bool IsValidInstitutionData(SpmInstitution.Data data, SpmInstitution.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Institution properties.
|
||||
if (errField.Name != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Name, "Name", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmInstitution_Name), true))
|
||||
{
|
||||
errField.Name = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmInstitution_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmInstitution_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmInstitution.InstitutionStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Institution database interface.
|
||||
public abstract bool InsertInstitution(SpmInstitution institution, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateInstitution(SpmInstitution institution, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool InstitutionCanBeDeleted(SpmInstitution institution)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteInstitution(SpmInstitution institution, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Institution list.
|
||||
public abstract ColumnDfn GetInstitutionColumnDfn(SpmInstitution.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetInstitutionQueryFilter(SpmInstitution.Params prm);
|
||||
public abstract long GetInstitutionCount(SpmInstitution.Params prm);
|
||||
public abstract List<SpmInstitution> GetInstitutionList(SpmInstitution.Params prm);
|
||||
public abstract DbResultSet ExecuteInstitutionQuery(List<ColumnDfn> columns, SpmInstitution.Params prm);
|
||||
public abstract DataValue GetInstitutionDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmInstitutionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// O p e r a t i o n
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual operation.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist operation.
|
||||
public abstract bool OperationExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get operation.
|
||||
public abstract SpmOperation GetOperation(SpmOperation.Params prm);
|
||||
public abstract SpmOperation GetOperationById(SysId id);
|
||||
public abstract SpmOperation GetOperationByCode(String code);
|
||||
//-------------------------------------------------------------------
|
||||
// Create operation.
|
||||
public abstract SpmOperation CreateOperation(SysId departmentId, SysId institutionId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate operation data.
|
||||
public bool IsValidOperation(SpmOperation operation)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (operation == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidOperationData(operation.GetData(), new SpmOperation.ErrField());
|
||||
}
|
||||
public virtual bool IsValidOperationData(SpmOperation.Data data, SpmOperation.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Operation properties.
|
||||
if (errField.Code != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Code, "Code", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmOperation_Code), true))
|
||||
{
|
||||
errField.Code = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Description != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Description, "Description", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmOperation_Description), true))
|
||||
{
|
||||
errField.Description = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmOperation_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmOperation_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmOperation.OperationStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Operation database interface.
|
||||
public abstract bool InsertOperation(SpmOperation operation, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateOperation(SpmOperation operation, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool OperationCanBeDeleted(SpmOperation operation)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeleteOperation(SpmOperation operation, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Operation list.
|
||||
public abstract ColumnDfn GetOperationColumnDfn(SpmOperation.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetOperationQueryFilter(SpmOperation.Params prm);
|
||||
public abstract long GetOperationCount(SpmOperation.Params prm);
|
||||
public abstract List<SpmOperation> GetOperationList(SpmOperation.Params prm);
|
||||
public abstract DbResultSet ExecuteOperationQuery(List<ColumnDfn> columns, SpmOperation.Params prm);
|
||||
public abstract DataValue GetOperationDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Sarand.Core.App;
|
||||
using Sarand.Core.Base;
|
||||
using Sarand.Core.Bus;
|
||||
using Sarand.Core.Dbas.Base;
|
||||
using Sarand.PatientMgr.Core.App;
|
||||
using Sarand.PatientMgr.Core.Bus;
|
||||
|
||||
namespace Sarand.PatientMgr.Core.Mgr
|
||||
{
|
||||
//=======================================================================
|
||||
partial class SpmInstitutionMgr
|
||||
{
|
||||
//*******************************************************************
|
||||
// P a t i e n t
|
||||
//*******************************************************************
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve individual patient.
|
||||
//-------------------------------------------------------------------
|
||||
// Exist patient.
|
||||
public abstract bool PatientExistsById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Get patient.
|
||||
public abstract SpmPatient GetPatient(SpmPatient.Params prm);
|
||||
public abstract SpmPatient GetPatientById(SysId id);
|
||||
//-------------------------------------------------------------------
|
||||
// Create patient.
|
||||
public abstract SpmPatient CreatePatient(SysId id, SysId institutionId);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate patient data.
|
||||
public bool IsValidPatient(SpmPatient patient)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (patient == null) return SetErrorState(ErrorMessage.ItemNotSpecified);
|
||||
return IsValidPatientData(patient.GetData(), new SpmPatient.ErrField());
|
||||
}
|
||||
public virtual bool IsValidPatientData(SpmPatient.Data data, SpmPatient.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Patient properties.
|
||||
if (errField.PatientNo != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.PatientNo, "PatientNo", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_PatientNo), true))
|
||||
{
|
||||
errField.PatientNo = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.NhsNumber != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.NhsNumber, "NhsNumber", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_NhsNumber), true))
|
||||
{
|
||||
errField.NhsNumber = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Title != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Title, "Title", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_Title), true))
|
||||
{
|
||||
errField.Title = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Forename != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Forename, "Forename", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_Forename), true))
|
||||
{
|
||||
errField.Forename = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Surname != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Surname, "Surname", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_Surname), true))
|
||||
{
|
||||
errField.Surname = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Age != SacsHierarchyItem.ValidValue.Ignore && !IsValidValue(data.Age, "Age", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_Age), true))
|
||||
{
|
||||
errField.Age = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Common properties.
|
||||
if (!IsValidValue(data.Notes, "notes", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_Notes)))
|
||||
{
|
||||
errField.Notes = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (errField.Status != SacsHierarchyItem.ValidValue.Ignore)
|
||||
{
|
||||
if (!IsValidValue(SacsSystem.GetStatusCode(data.Status), "status", (long)SpmDbDfn.GetColTextLen(SpmDbDfn.ColumnIdx.SwmPatient_Status), true, true))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return false;
|
||||
}
|
||||
if (!SpmPatient.PatientStatuses.Contains(data.Status))
|
||||
{
|
||||
errField.Status = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState(ErrorMessage.InvalidStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Patient database interface.
|
||||
public abstract bool InsertPatient(SpmPatient patient, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdatePatient(SpmPatient patient, DbUpdateInfo dbUpdateInfo);
|
||||
public virtual bool PatientCanBeDeleted(SpmPatient patient)
|
||||
{
|
||||
ClearErrorState();
|
||||
return true;
|
||||
}
|
||||
public abstract bool DeletePatient(SpmPatient patient, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Patient list.
|
||||
public abstract ColumnDfn GetPatientColumnDfn(SpmPatient.Column columnId, String caption = "", int width = 0);
|
||||
public abstract List<String> GetPatientQueryFilter(SpmPatient.Params prm);
|
||||
public abstract long GetPatientCount(SpmPatient.Params prm);
|
||||
public abstract List<SpmPatient> GetPatientList(SpmPatient.Params prm);
|
||||
public abstract DbResultSet ExecutePatientQuery(List<ColumnDfn> columns, SpmPatient.Params prm);
|
||||
public abstract DataValue GetPatientDataValue(ColumnDfn column, NamedValue.Map values);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Core\Bus\" />
|
||||
<Folder Include="Core\Consoles\" />
|
||||
<Folder Include="Core\Data\" />
|
||||
<Folder Include="Core\UpdateLog\" />
|
||||
|
||||
Reference in New Issue
Block a user