コード例 #1
0
        public List <Record> GetRecords(string patientNRIC, long noteID)
        {
            if (AccountBLL.IsTherapist())
            {
                List <Record>  records = recordDAL.RetrieveRecords(noteID, patientNRIC, AccountBLL.GetNRIC());
                Entity.Patient patient = new TherapistBLL().GetPatient(patientNRIC);

                List <Record> result = new List <Record>();
                foreach (Record record in records)
                {
                    if (!patient.hasPermissionsApproved(record))
                    {
                        Record newRecord = new Record();
                        newRecord.id     = record.id;
                        newRecord.title  = record.title;
                        newRecord.type   = record.type;
                        newRecord.status = record.status;
                        newRecord.recordPermissionStatus = record.recordPermissionStatus;
                        result.Add(newRecord);
                    }
                    else
                    {
                        record.permited = true;
                        result.Add(record);
                    }
                }

                logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "View Records of Note", "Action on: " + patientNRIC + " , Note ID: " + noteID + ".");
                return(result);
            }

            return(null);
        }
コード例 #2
0
        public void AddRecord(Record record)
        {
            if (AccountBLL.IsPatient() && record.patientNRIC.Equals(AccountBLL.GetNRIC()))
            {
                if (record.type.isContent)
                {
                    recordDAL.InsertContent(record, AccountBLL.GetNRIC());
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
                else if (!record.type.isContent)
                {
                    record.fileChecksum = record.GetMD5HashFromFile();

                    if (record.IsFileSafe())
                    {
                        recordDAL.InsertFile(record, AccountBLL.GetNRIC());
                    }
                    else
                    {
                        throw new Exception();
                    }

                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
            }
            else if (AccountBLL.IsTherapist())
            {
                Entity.Patient patient = new TherapistBLL().GetPatientPermissions(record.patientNRIC);

                if (patient.permissionApproved == 0 || ((patient.permissionApproved & record.type.permissionFlag) == 0) ||
                    AccountBLL.GetNRIC().Equals(record.patientNRIC))
                {
                    return;
                }

                if (record.type.isContent)
                {
                    recordDAL.InsertContent(record, AccountBLL.GetNRIC());
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
                else if (!record.type.isContent)
                {
                    record.fileChecksum = record.GetMD5HashFromFile();

                    if (record.IsFileSafe())
                    {
                        recordDAL.InsertFile(record, AccountBLL.GetNRIC());
                    }
                    else
                    {
                        throw new Exception();
                    }

                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
            }
        }
コード例 #3
0
        public void AddRecordDiagnosis(string patientNRIC, long recordID, string code)
        {
            if (AccountBLL.IsTherapist())
            {
                Record         record  = recordDAL.RetrieveRecord(recordID, AccountBLL.GetNRIC());
                Entity.Patient patient = new TherapistBLL().GetPatient(record.patientNRIC);

                if (record.patientNRIC.Equals(patientNRIC) && patient.hasPermissionsApproved(record))
                {
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record Diagnoses", "Action on: " + patientNRIC + ", Record ID: " + recordID + ", Diagnosis Code: " + code + ".");

                    recordDAL.InsertRecordDiagnosis(AccountBLL.GetNRIC(), recordID, code);
                }
            }
        }
コード例 #4
0
        public List <RecordDiagnosis> GetRecordDiagnoses(long recordID)
        {
            if (AccountBLL.IsPatient())
            {
                return(recordDAL.RetrieveRecordDiagnoses(recordID, AccountBLL.GetNRIC()));
            }
            else if (AccountBLL.IsTherapist())
            {
                Record         record  = recordDAL.RetrieveRecord(recordID, AccountBLL.GetNRIC());
                Entity.Patient patient = new TherapistBLL().GetPatient(record.patientNRIC);

                if (patient.hasPermissionsApproved(record))
                {
                    List <RecordDiagnosis> result = recordDAL.RetrieveRecordDiagnoses(recordID, record.patientNRIC, AccountBLL.GetNRIC());
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "View Record Diagnoses", "Record ID: " + recordID + ".");
                    return(result);
                }
            }

            return(null);
        }
コード例 #5
0
        public Record GetRecord(long recordID)
        {
            if (AccountBLL.IsPatient())
            {
                return(recordDAL.RetrieveRecord(AccountBLL.GetNRIC(), recordID));
            }
            else if (AccountBLL.IsTherapist())
            {
                Record         record  = recordDAL.RetrieveRecord(recordID, AccountBLL.GetNRIC());
                Entity.Patient patient = new TherapistBLL().GetPatient(record.patientNRIC);

                if (patient.hasPermissionsApproved(record))
                {
                    record.permited = true;

                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "View Record", "Record ID: " + recordID + ".");

                    return(record);
                }
            }

            return(null);
        }