File size: 892 Bytes
c98875e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type DiagnosticCodeDocument = DiagnosticCode & Document;

@Schema({ timestamps: true })
export class DiagnosticCode {
  @Prop({ required: true, unique: true, uppercase: true, trim: true })
  code: string; // e.g. J18.9

  @Prop({ required: true, trim: true })
  description: string;

  @Prop({ trim: true })
  category: string; // e.g. Diseases of the respiratory system

  @Prop({ trim: true })
  chapter: string; // ICD-10 chapter

  @Prop([String])
  includes: string[];

  @Prop([String])
  excludes: string[];

  @Prop({ default: true })
  billable: boolean;

  @Prop({ default: true })
  isActive: boolean;
}

export const DiagnosticCodeSchema = SchemaFactory.createForClass(DiagnosticCode);
DiagnosticCodeSchema.index({ code: 'text', description: 'text', category: 'text' });