irc_dicom_service/app/model/pacs.js

39 lines
732 B
JavaScript

/**
* Pacs位置
*/
module.exports = app => {
const mongoose = app.mongoose;
const Schema = mongoose.Schema;
const PacsSchema = new Schema({
trialId:String,
task_id: String,
host:String,
port:String,
aet:String,
description:String,
mode: String,
meta: {
createdAt: {
type: Date,
default: new Date()
},
updatedAt: {
type: Date,
default: new Date()
}
}
})
PacsSchema.pre("save", function (next) {
if (this.isNew) {
// 创建时间
this.meta.createdAt = this.meta.updatedAt = new Date();
} else {
this.meta.updatedAt = new Date();
}
next();
});
return mongoose.model("Pacs", PacsSchema);
};