Merge branch 'develop' of github.com:Frappet/bma-ehr-kpi into develop
This commit is contained in:
commit
b671316601
3 changed files with 61 additions and 14 deletions
|
|
@ -69,6 +69,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
kpiUserEvaluation.lastName = x.lastName
|
||||
})
|
||||
.catch((x) => {});
|
||||
kpiUserEvaluation.evaluationStatus = requestBody.evaluationStatus
|
||||
kpiUserEvaluation.evaluationResults = requestBody.evaluationResults
|
||||
kpiUserEvaluation.createdUserId = request.user.sub;
|
||||
kpiUserEvaluation.createdFullName = request.user.name;
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
|
|
@ -111,6 +113,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
}
|
||||
|
||||
if (kpiUserEvaluation) {
|
||||
kpiUserEvaluation.evaluationStatus = requestBody.evaluationStatus
|
||||
kpiUserEvaluation.evaluationResults = requestBody.evaluationResults
|
||||
kpiUserEvaluation.lastUpdateUserId = request.user.sub;
|
||||
kpiUserEvaluation.lastUpdateFullName = request.user.name;
|
||||
this.kpiUserEvalutionRepository.merge(kpiUserEvaluation, requestBody);
|
||||
|
|
@ -130,7 +134,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async GetKpiUserEvaluationById(@Path() id: string) {
|
||||
const KpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["id", "profileId", "prefix", "firstName", "lastName", "kpiPeriodId"],
|
||||
select: ["id", "profileId", "prefix", "firstName", "lastName", "kpiPeriodId", "evaluationStatus", "evaluationResults", "createdAt"],
|
||||
})
|
||||
if (!KpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
|
|
@ -151,23 +155,23 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async listKpiUserEvaluation(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("period") period?: string,
|
||||
@Query("keyword") keyword?: string,
|
||||
@Query("kpiPeriodId") kpiPeriodId?: string,
|
||||
// @Query("keyword") keyword?: string,
|
||||
) {
|
||||
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
.andWhere(
|
||||
keyword == undefined
|
||||
? "1=1"
|
||||
: [
|
||||
{ prefix: Like(`%${keyword}%`) },
|
||||
{ firstName: Like(`%${keyword}%`) },
|
||||
{ lastName: Like(`%${keyword}%`) },
|
||||
],
|
||||
)
|
||||
.andWhere(period ? "kpiPeriod.durationKPI LIKE :period" : "1=1", { period: `%${period}%` })
|
||||
// .leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
// .andWhere(
|
||||
// keyword == undefined
|
||||
// ? "1=1"
|
||||
// : [
|
||||
// { prefix: Like(`%${keyword}%`) },
|
||||
// { firstName: Like(`%${keyword}%`) },
|
||||
// { lastName: Like(`%${keyword}%`) },
|
||||
// ],
|
||||
// )
|
||||
.andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", { kpiPeriodId: `%${kpiPeriodId}%` })
|
||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
|
|
@ -180,6 +184,9 @@ export class KpiUserEvaluationController extends Controller {
|
|||
firstname: item.firstName,
|
||||
lastname: item.lastName,
|
||||
kpiPeriodId: item.kpiPeriodId,
|
||||
evaluationStatus: item.evaluationStatus,
|
||||
evaluationResults: item.evaluationResults,
|
||||
createdAt: item.createdAt,
|
||||
}));
|
||||
return new HttpSuccess({ data: mapData, total });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue