Skip to content

Commit 5c73559

Browse files
authored
Merge pull request #94 from mdauwal/feat/diagnosis-treatment-system
feat(health): complete implementation of diagnosis, treatment planning, procedures, outcomes, and care templates
2 parents c632936 + ca8ad64 commit 5c73559

36 files changed

+677
-0
lines changed

src/app.module.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ import { FhirModule } from './fhir/fhir.module';
4848
import { ConsentModule } from './consent/consent.module';
4949
import { EncryptionModule } from './modules/encryption/encryption.module';
5050
import { PatientManagementModule } from './patient-management/patient-management.module';
51+
import { Icd10Module } from './icd10/icd10.module';
52+
import { DiagnosisModule } from './diagnosis/diagnosis.module';
53+
import { TreatmentPlanModule } from './treatment-plan/treatment.module';
54+
import { ProcedureModule } from './procedure/procedure.module';
55+
import { OutcomeModule } from './outcomes/outcome.module'
56+
import { CarePlanTemplateModule } from './care-plan-template/care-plan-template.module';
57+
import { DecisionSupportModule } from './decision-support/decision-support.module';
58+
59+
60+
5161

5262
@Module({
5363
imports: [
@@ -119,6 +129,18 @@ import { PatientManagementModule } from './patient-management/patient-management
119129
EncryptionModule,
120130
PrescriptionsModule,
121131
PatientManagementModule,
132+
133+
134+
// ✅ Diagnosis & Treatment System Modules
135+
Icd10Module,
136+
DiagnosisModule,
137+
TreatmentPlanModule,
138+
ProcedureModule,
139+
OutcomeModule,
140+
CarePlanTemplateModule,
141+
DecisionSupportModule,
142+
143+
122144
],
123145
controllers: [AppController],
124146
providers: [AppService, EncryptionService, AuditService],
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Controller, Post, Body, Get, Param } from '@nestjs/common';
2+
import { CarePlanTemplateService } from './care-plan-template.service';
3+
import { CreateCarePlanTemplateDto } from './dto/care-plan-template.dto';
4+
5+
@Controller('care-plan-templates')
6+
export class CarePlanTemplateController {
7+
constructor(private readonly service: CarePlanTemplateService) {}
8+
9+
@Post()
10+
create(@Body() dto: CreateCarePlanTemplateDto) {
11+
return this.service.create(dto);
12+
}
13+
14+
@Get()
15+
findAll() {
16+
return this.service.findAll();
17+
}
18+
19+
@Get(':id')
20+
findOne(@Param('id') id: string) {
21+
return this.service.findOne(id);
22+
}
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Module } from '@nestjs/common';
2+
import { TypeOrmModule } from '@nestjs/typeorm';
3+
import { CarePlanTemplate } from './entities/care-plan-template.entity';
4+
import { CarePlanTemplateService } from './care-plan-template.service';
5+
import { CarePlanTemplateController } from './care-plan-template.controller';
6+
7+
@Module({
8+
imports: [TypeOrmModule.forFeature([CarePlanTemplate])],
9+
providers: [CarePlanTemplateService],
10+
controllers: [CarePlanTemplateController],
11+
})
12+
export class CarePlanTemplateModule {}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Injectable } from '@nestjs/common';
2+
import { InjectRepository } from '@nestjs/typeorm';
3+
import { Repository } from 'typeorm';
4+
import { CarePlanTemplate } from './entities/care-plan-template.entity';
5+
import { CreateCarePlanTemplateDto } from './dto/care-plan-template.dto';
6+
7+
@Injectable()
8+
export class CarePlanTemplateService {
9+
constructor(
10+
@InjectRepository(CarePlanTemplate)
11+
private repo: Repository<CarePlanTemplate>
12+
) {}
13+
14+
create(dto: CreateCarePlanTemplateDto) {
15+
const template = this.repo.create(dto);
16+
return this.repo.save(template);
17+
}
18+
19+
findAll() {
20+
return this.repo.find();
21+
}
22+
23+
findOne(id: string) {
24+
return this.repo.findOneBy({ id });
25+
}
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { IsString } from "class-validator";
2+
3+
export class CreateCarePlanTemplateDto {
4+
@IsString()
5+
name: string;
6+
7+
@IsString()
8+
defaultObjectives: string;
9+
10+
@IsString()
11+
defaultInterventions: string;
12+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
2+
import { IsString } from 'class-validator';
3+
4+
@Entity('care_plan_templates')
5+
export class CarePlanTemplate {
6+
@PrimaryGeneratedColumn('uuid')
7+
id: string;
8+
9+
@Column()
10+
name: string;
11+
12+
@Column('text')
13+
defaultObjectives: string;
14+
15+
@Column('text')
16+
defaultInterventions: string;
17+
18+
@CreateDateColumn()
19+
createdAt: Date;
20+
21+
@UpdateDateColumn()
22+
updatedAt: Date;
23+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Controller, Get, Param } from '@nestjs/common';
2+
import { DecisionSupportService } from './decision-support.service';
3+
4+
@Controller('decision-support')
5+
export class DecisionSupportController {
6+
constructor(private readonly service: DecisionSupportService) {}
7+
8+
@Get(':code')
9+
getRecommendations(@Param('code') code: string) {
10+
return {
11+
icd10Code: code,
12+
recommendations: this.service.getRecommendations(code),
13+
};
14+
}
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Module } from '@nestjs/common';
2+
import { DecisionSupportService } from './decision-support.service';
3+
import { DecisionSupportController } from './decision-support.controller';
4+
5+
@Module({
6+
providers: [DecisionSupportService],
7+
controllers: [DecisionSupportController],
8+
})
9+
export class DecisionSupportModule {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Injectable } from '@nestjs/common';
2+
3+
@Injectable()
4+
export class DecisionSupportService {
5+
private readonly recommendationsMap: Record<string, string[]> = {
6+
'E11.9': [
7+
'Schedule HbA1c test',
8+
'Start Metformin 500mg once daily',
9+
'Refer to endocrinologist',
10+
'Initiate lifestyle counseling',
11+
],
12+
'I10': [
13+
'Start antihypertensive therapy',
14+
'Recommend daily BP monitoring',
15+
'Schedule follow-up in 4 weeks',
16+
],
17+
'J45.909': [
18+
'Prescribe salbutamol inhaler',
19+
'Assess asthma triggers',
20+
'Create asthma action plan',
21+
],
22+
};
23+
24+
getRecommendations(icd10Code: string): string[] {
25+
return this.recommendationsMap[icd10Code] || ['No specific recommendations found.'];
26+
}
27+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Controller, Post, Body, Get, Param } from '@nestjs/common';
2+
import { DiagnosisService } from './diagnosis.service';
3+
import { CreateDiagnosisDto } from './dto/create-diagnosis.dto'
4+
5+
@Controller('diagnoses')
6+
export class DiagnosisController {
7+
constructor(private readonly service: DiagnosisService) {}
8+
9+
@Post()
10+
create(@Body() dto: CreateDiagnosisDto) {
11+
return this.service.create(dto);
12+
}
13+
14+
@Get()
15+
findAll() {
16+
return this.service.findAll();
17+
}
18+
19+
@Get('patient/:patientId')
20+
findByPatient(@Param('patientId') patientId: string) {
21+
return this.service.findByPatient(patientId);
22+
}
23+
24+
@Get(':id')
25+
findOne(@Param('id') id: string) {
26+
return this.service.findOne(id);
27+
}
28+
}

0 commit comments

Comments
 (0)