Initial commit: HealthCarePregnant project documentation and platform

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
selfrelease
2026-06-18 09:48:05 +08:00
commit eab91174db
301 changed files with 42491 additions and 0 deletions
@@ -0,0 +1,37 @@
import { Controller, Post, Get, Body, Param } from '@nestjs/common';
import { EmotionService } from './emotion.service';
import { CreateEmotionDto, EmotionCheckin } from './emotion.types';
import { RequireCaps } from '../../common/auth/capabilities.decorator';
import { CurrentUser } from '../../common/auth/current-user.decorator';
import { RequestUser } from '../../common/auth/request-user';
@Controller('emotions')
export class EmotionController {
constructor(private readonly service: EmotionService) {}
@Post()
@RequireCaps('emotion:create')
async create(
@CurrentUser() user: RequestUser,
@Body() dto: CreateEmotionDto,
): Promise<EmotionCheckin> {
// 强制关联为当前登录孕妇患者 ID
const patientId = user.role === 'patient' ? user.id : dto.patientId;
return this.service.create({
...dto,
patientId,
});
}
@Get('patient/:patientId')
@RequireCaps('emotion:read')
async getByPatient(@Param('patientId') patientId: string): Promise<EmotionCheckin[]> {
return this.service.listByPatient(patientId);
}
@Get()
@RequireCaps('emotion:read')
async getAll(): Promise<EmotionCheckin[]> {
return this.service.listAll();
}
}