/** * dicom信息 */ module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const ImageSchema = new Schema({ user_id: { type: Schema.Types.ObjectId, index: true, ref: "User" }, StudyInstanceUID: { type: String, required: true }, //关联study SeriesInstanceUID: { type: String, index: true, required: true }, pathUpload: { type: Boolean, default: false }, //dicom是否上传到OSS pngUpload: { type: Boolean, default: false }, //png是否上传到OSS path: String, //dicom在本地系统的路径 pngPath: String, //png在本地系统的路径 pngType: String, //png图像的类型 pngWidth: Number, //png图像的宽 pngHeight: Number, //png图像的高 InstanceNumber: { type: Number, index: true }, //InstanceNumber 图像编号(非全局唯一) SOPInstanceUID: String, //SOPInstanceUID用于区分InstanceNumber SpacingBetweenSlices: String, //SpacingBetweenSlices 层间分辨率 如果这个值存在,zPixelSpacing取它,否则取SliceThickness PixelSpacing: String, //PixelSpacing 像素间分辨率,[x,y] PixelRepresentation: String, //PixelRepresentation像素数据的表现类型:这是一个枚举值,分别为十六进制数0000和0001.0000H = 无符号整数,0001H = 2的补码(简单理解为有符号整数) SamplesPerPixel: String, //采样率 PixelPaddingValue: String, //PixelPaddingValue Columns: String, //Columns 图像列数 imagisizex Rows: String, //Rows 图像行数imagisizey, imagesizez 是series长度 WindowWidth: String, //WindowWiRescaleInterceptdth 默认窗宽 WindowCenter: String, //WindowCenter 默认窗位 RescaleType: String, //RescaleType 斜率截距换算类型 RescaleSlope: String, //RescaleSlope 斜率 RescaleIntercept: String, //RescaleIntercept截距 ImagePosition: String, //图像位置 ImagePositionPatient: String, //图像相对病人的位置 ImageOrientation: String, //图像方位 ImageOrientationPatient: String, //图像相对于病人的方位 SliceLocation: String, //切片位置 BitsAllocated: String, //存储时每个像素分配的位数 BitsStored: String, //存储每个像素使用的位数 HighBit: String, //高位 meta: { createdAt: { type: Date, default: new Date() }, updatedAt: { type: Date, default: new Date() } } }); ImageSchema.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("Image", ImageSchema); };