From 542e3409986e2acb1f4ac3b4ef44b7b31e1367af Mon Sep 17 00:00:00 2001 From: avicenan Date: Mon, 22 Jun 2026 12:36:41 +0900 Subject: [PATCH] fix(patient): new api for create print, provision only --- src/controllers/card_print_queue.ts | 83 ++++++++++++++++++++++------- src/routes/private.ts | 2 + 2 files changed, 65 insertions(+), 20 deletions(-) diff --git a/src/controllers/card_print_queue.ts b/src/controllers/card_print_queue.ts index 8935fec..4884f46 100644 --- a/src/controllers/card_print_queue.ts +++ b/src/controllers/card_print_queue.ts @@ -71,23 +71,7 @@ export class CardPrintQueueController { } } - static async create(req: Request, res: Response, next: NextFunction): Promise { - /* - #swagger.tags = ['CardPrintQueue'] - #swagger.security = [{ - "bearerAuth": [] - }] - #swagger.requestBody = { - required: true, - content: { - "application/json": { - schema: { - $ref: "#/components/schemas/card_print_queue" - } - } - } - } - */ + private static async handleCreate(req: Request, res: Response, type: CardPrintQueueType): Promise { try { const schema = Joi.object().keys({ mrn: Joi.string().max(256).allow("").optional().label("MRN"), @@ -123,9 +107,7 @@ export class CardPrintQueueController { data.patient_id = param.patient_id || null; data.facility_code = param.facility_code || null; data.status = param.status || CardPrintQueueStatus.PENDING; - // data.type = CardPrintQueueType.PROVISION; //test - data.type = CardPrintQueueType.PRINT_PROVISION; //test - // data.type = CardPrintQueueType.PRINT; //test + data.type = type; const authHeader = req.headers.authorization; let rawToken = ""; @@ -148,6 +130,67 @@ export class CardPrintQueueController { } } + static async create(req: Request, res: Response, next: NextFunction): Promise { + /* + #swagger.tags = ['CardPrintQueue'] + #swagger.security = [{ + "bearerAuth": [] + }] + #swagger.requestBody = { + required: true, + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/card_print_queue" + } + } + } + } + */ + return CardPrintQueueController.handleCreate(req, res, CardPrintQueueType.PRINT_PROVISION); + } + + static async createProvision(req: Request, res: Response, next: NextFunction): Promise { + /* + #swagger.tags = ['CardPrintQueue'] + #swagger.security = [{ + "bearerAuth": [] + }] + #swagger.requestBody = { + required: true, + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/card_print_queue" + } + } + } + } + */ + return CardPrintQueueController.handleCreate(req, res, CardPrintQueueType.PROVISION); + } + + static async createPrint(req: Request, res: Response, next: NextFunction): Promise { + /* + #swagger.tags = ['CardPrintQueue'] + #swagger.security = [{ + "bearerAuth": [] + }] + #swagger.requestBody = { + required: true, + content: { + "application/json": { + schema: { + $ref: "#/components/schemas/card_print_queue" + } + } + } + } + */ + return CardPrintQueueController.handleCreate(req, res, CardPrintQueueType.PRINT); + } + + static async detail(req: Request, res: Response, next: NextFunction): Promise { /* #swagger.tags = ['CardPrintQueue'] diff --git a/src/routes/private.ts b/src/routes/private.ts index 24ea985..8c44828 100644 --- a/src/routes/private.ts +++ b/src/routes/private.ts @@ -545,6 +545,8 @@ export class RoutePrivate { app.get("/api/card-print-queue/list", CardPrintQueueController.list); app.post("/api/card-print-queue/create", CardPrintQueueController.create); + app.post("/api/card-print-queue/create/provision", CardPrintQueueController.createProvision); + app.post("/api/card-print-queue/create/print", CardPrintQueueController.createPrint); app.get("/api/card-print-queue/detail/:id", CardPrintQueueController.detail); app.get("/api/payment-method/list", PaymentMethodController.list);