fix(patient): new api for create print, provision only

This commit is contained in:
avicenan
2026-06-22 12:36:41 +09:00
parent 5e3940a6f3
commit 542e340998
2 changed files with 65 additions and 20 deletions

View File

@ -71,23 +71,7 @@ export class CardPrintQueueController {
}
}
static async create(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#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<Response> {
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<Response> {
/*
#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<Response> {
/*
#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<Response> {
/*
#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<void | Response> {
/*
#swagger.tags = ['CardPrintQueue']

View File

@ -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);