Created
November 11, 2016 17:51
-
-
Save marianoqueirel/bc646c17237f227d39f44c56af8b39ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
import mongoose from 'mongoose'; | |
/** | |
* registered | The existence of the report is registered, but there is nothing yet available. | |
* -----------------+---------------------------------------------------------------------------------------- | |
* partial | This is a partial (e.g. initial, interim or preliminary) report: data in the report may | |
* | be incomplete or unverified. | |
* -----------------+---------------------------------------------------------------------------------------- | |
* final | The report is complete and verified by an authorized person. | |
* -----------------+---------------------------------------------------------------------------------------- | |
* corrected | The report has been modified subsequent to being Final, and is complete and verified by | |
* | an authorized person. New content has been added, but existing content hasn't changed | |
* -----------------+---------------------------------------------------------------------------------------- | |
* appended | The report has been modified subsequent to being Final, and is complete and verified by | |
* | an authorized person. New content has been added, but existing content hasn't changed. | |
* -----------------+---------------------------------------------------------------------------------------- | |
* cancelled | The report is unavailable because the measurement was not started or not completed | |
* | (also sometimes called "aborted"). | |
* -----------------+---------------------------------------------------------------------------------------- | |
* entered-in-error | The report has been withdrawn following a previous final release. | |
*/ | |
const STATUS = ['registered', 'partial', 'final', 'corrected', 'appended', 'cancelled', 'entered-in-error']; | |
const CATEGORY = ['AU', 'BG', 'BLB', 'CG', 'CH', 'CP', 'CT', 'CTH', 'CUS', 'EC', 'EN', 'GE', 'HM', 'ICU', 'IMM', 'LAB', | |
'MB', 'MCB', 'MYC', 'NMR', 'NMS', 'NRS', 'OSL', 'OT', 'OTH', 'OUS', 'PF', 'PHR', 'PHY', 'PT', 'RAD', | |
'RC', 'RT', 'RUS', 'RX', 'SP', 'SR', 'TX', 'VR', 'VUS', 'XRC']; | |
//TODO model this | |
const DiagnosticReportSchema = new mongoose.Schema({ | |
status: {type: String, required: true, enum: STATUS}, | |
category: {type: String, required: true, enum: CATEGORY}, | |
code: {type: mongoose.Schema.Types.ObjectId, ref: 'Procedure', required: true}, | |
subject: {type: mongoose.Schema.Types.ObjectId, ref: 'Patient', required: true}, | |
effectiveDate: {type: Date, required: true}, | |
issued: {type: Date, required: true}, | |
performer: {type: mongoose.Schema.Types.ObjectId, ref: 'Practitioner', required: true}, | |
request: [{ | |
kind: String, | |
item: {type: mongoose.Schema.Types.ObjectId, refPath: 'request.kind'}, | |
_id: false | |
}], | |
image: [{link: String, comment: String, _id: false}], | |
conclusion: {type: String}, | |
codedDiagnosis: [{type: mongoose.Schema.Types.ObjectId, ref: 'Disease', _id: false}] | |
}); | |
export default mongoose.model('DiagnosticReport', DiagnosticReportSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment