Compare commits
10 Commits
a7c945cb0b
...
f47379d040
| Author | SHA1 | Date | |
|---|---|---|---|
| f47379d040 | |||
| 3614a09004 | |||
| 9a5cee89fb | |||
| 87cf2d7b8b | |||
| 4d1bf535a5 | |||
| f6a903e62e | |||
| 7c025280bb | |||
| 542e340998 | |||
| 5e3940a6f3 | |||
| 64bc274d3f |
@ -21,8 +21,8 @@
|
|||||||
},
|
},
|
||||||
"database": {
|
"database": {
|
||||||
"engine": "postgres",
|
"engine": "postgres",
|
||||||
"host": "127.0.0.1",
|
"host": "147.139.175.69",
|
||||||
"port": "15432",
|
"port": "4137",
|
||||||
"username": "saude_stag",
|
"username": "saude_stag",
|
||||||
"password": "gM*#o>3W4&5X",
|
"password": "gM*#o>3W4&5X",
|
||||||
"database": "saude_stag",
|
"database": "saude_stag",
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"server": {
|
"server": {
|
||||||
"port": "7002",
|
"port": "7002",
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
"host_swagger": "http://10.64.1.10:9080/service-master-data/",
|
"host_swagger": "https://histl.hngv/api/service-master-data/",
|
||||||
"max_body": "50mb",
|
"max_body": "50mb",
|
||||||
"max_upload": 104857600,
|
"max_upload": 104857600,
|
||||||
"morgan": "combined",
|
"morgan": "combined",
|
||||||
@ -26,9 +26,10 @@
|
|||||||
"username": "saude_production",
|
"username": "saude_production",
|
||||||
"password": "y0BZQ6of14OULYnb",
|
"password": "y0BZQ6of14OULYnb",
|
||||||
"database": "saude_production",
|
"database": "saude_production",
|
||||||
"logging": false
|
"synchronize": true,
|
||||||
|
"logging": true
|
||||||
},
|
},
|
||||||
"service": {
|
"service": {
|
||||||
"file": "https://tcelanatl.shiblysolution.id/api/f/"
|
"file": "http://127.0.0.1:7019/api/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,23 +71,7 @@ export class CardPrintQueueController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async create(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
private static async handleCreate(req: Request, res: Response, type: CardPrintQueueType): Promise<Response> {
|
||||||
/*
|
|
||||||
#swagger.tags = ['CardPrintQueue']
|
|
||||||
#swagger.security = [{
|
|
||||||
"bearerAuth": []
|
|
||||||
}]
|
|
||||||
#swagger.requestBody = {
|
|
||||||
required: true,
|
|
||||||
content: {
|
|
||||||
"application/json": {
|
|
||||||
schema: {
|
|
||||||
$ref: "#/components/schemas/card_print_queue"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
try {
|
try {
|
||||||
const schema = Joi.object().keys({
|
const schema = Joi.object().keys({
|
||||||
mrn: Joi.string().max(256).allow("").optional().label("MRN"),
|
mrn: Joi.string().max(256).allow("").optional().label("MRN"),
|
||||||
@ -123,9 +107,7 @@ export class CardPrintQueueController {
|
|||||||
data.patient_id = param.patient_id || null;
|
data.patient_id = param.patient_id || null;
|
||||||
data.facility_code = param.facility_code || null;
|
data.facility_code = param.facility_code || null;
|
||||||
data.status = param.status || CardPrintQueueStatus.PENDING;
|
data.status = param.status || CardPrintQueueStatus.PENDING;
|
||||||
// data.type = CardPrintQueueType.PROVISION; //test
|
data.type = type;
|
||||||
data.type = CardPrintQueueType.PRINT_PROVISION; //test
|
|
||||||
// data.type = CardPrintQueueType.PRINT; //test
|
|
||||||
|
|
||||||
const authHeader = req.headers.authorization;
|
const authHeader = req.headers.authorization;
|
||||||
let rawToken = "";
|
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> {
|
static async detail(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['CardPrintQueue']
|
#swagger.tags = ['CardPrintQueue']
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { MainDisease, Paging } from "entity";
|
import { DiseaseCategory, MainDisease, Paging } from "entity";
|
||||||
import { NextFunction, Response } from "express";
|
import { NextFunction, Response } from "express";
|
||||||
import { Request } from "express-jwt";
|
import { Request } from "express-jwt";
|
||||||
import Joi from "joi";
|
import Joi from "joi";
|
||||||
@ -15,6 +15,8 @@ const log: Logger<ILogObj> = new Logger({
|
|||||||
type: "pretty",
|
type: "pretty",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const diseaseCategoryValues = Object.values(DiseaseCategory);
|
||||||
|
|
||||||
export class MainDiseaseController {
|
export class MainDiseaseController {
|
||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
@ -82,6 +84,10 @@ export class MainDiseaseController {
|
|||||||
const schema = Joi.object().keys({
|
const schema = Joi.object().keys({
|
||||||
name: Joi.string().max(128).required().label("Name"),
|
name: Joi.string().max(128).required().label("Name"),
|
||||||
status: Joi.string().required().label("Status"),
|
status: Joi.string().required().label("Status"),
|
||||||
|
category: Joi.string()
|
||||||
|
.valid(...diseaseCategoryValues)
|
||||||
|
.required()
|
||||||
|
.label("Category"),
|
||||||
});
|
});
|
||||||
|
|
||||||
let param: any = await schema.validateAsync(req.body);
|
let param: any = await schema.validateAsync(req.body);
|
||||||
@ -93,6 +99,7 @@ export class MainDiseaseController {
|
|||||||
let entity = new MainDisease();
|
let entity = new MainDisease();
|
||||||
entity.name = param.name;
|
entity.name = param.name;
|
||||||
entity.status = param.status;
|
entity.status = param.status;
|
||||||
|
entity.category = param.category;
|
||||||
entity.created_by = req.auth.data.name;
|
entity.created_by = req.auth.data.name;
|
||||||
entity.updated_by = req.auth.data.name;
|
entity.updated_by = req.auth.data.name;
|
||||||
await queryRunner.manager.save(entity);
|
await queryRunner.manager.save(entity);
|
||||||
@ -152,6 +159,10 @@ export class MainDiseaseController {
|
|||||||
id: Joi.string().uuid().required().label("Main Disease ID"),
|
id: Joi.string().uuid().required().label("Main Disease ID"),
|
||||||
name: Joi.string().max(128).required().label("Name"),
|
name: Joi.string().max(128).required().label("Name"),
|
||||||
status: Joi.string().required().label("Status"),
|
status: Joi.string().required().label("Status"),
|
||||||
|
category: Joi.string()
|
||||||
|
.valid(...diseaseCategoryValues)
|
||||||
|
.required()
|
||||||
|
.label("Category"),
|
||||||
});
|
});
|
||||||
|
|
||||||
let param: any = await schema.validateAsync(req.body);
|
let param: any = await schema.validateAsync(req.body);
|
||||||
@ -166,6 +177,7 @@ export class MainDiseaseController {
|
|||||||
|
|
||||||
entity.name = param.name;
|
entity.name = param.name;
|
||||||
entity.status = param.status;
|
entity.status = param.status;
|
||||||
|
entity.category = param.category;
|
||||||
entity.updated_by = req.auth.data.name;
|
entity.updated_by = req.auth.data.name;
|
||||||
await queryRunner.manager.save(entity);
|
await queryRunner.manager.save(entity);
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { Language } from "../langs/lang";
|
|||||||
import { ServiceModel } from "../model/service";
|
import { ServiceModel } from "../model/service";
|
||||||
import { RoomServicesModel } from "../model/room_services";
|
import { RoomServicesModel } from "../model/room_services";
|
||||||
import { RoomModel } from "../model/room";
|
import { RoomModel } from "../model/room";
|
||||||
|
import { DepartmentModel } from "../model/department";
|
||||||
import { OrmHelper } from "../helpers/orm";
|
import { OrmHelper } from "../helpers/orm";
|
||||||
|
|
||||||
const log: Logger<ILogObj> = new Logger({
|
const log: Logger<ILogObj> = new Logger({
|
||||||
@ -318,4 +319,88 @@ export class RoomServicesController {
|
|||||||
await queryRunner.release();
|
await queryRunner.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controller - List Ancillary Services (Service-sided)
|
||||||
|
static async listAncillaryServices(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Room Services']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
#swagger.parameters['filter'] = { description: '', in: 'query', type: 'string' }
|
||||||
|
#swagger.parameters['limit'] = { in: 'query', required: true, type: 'number' }
|
||||||
|
#swagger.parameters['page'] = { in: 'query', required: true, type: 'number' }
|
||||||
|
#swagger.parameters['with_deleted'] = { in: 'query', required: true, type: 'boolean' }
|
||||||
|
#swagger.parameters['order_field'] = { in: 'query', required: true, type: 'string' }
|
||||||
|
#swagger.parameters['order_direction'] = { in: 'query', required: true, schema: { '@enum': ['ASC', 'DESC'] } }
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow("").optional().label("Filter"),
|
||||||
|
page: Joi.number().required().min(1).label("Page"),
|
||||||
|
limit: Joi.number().required().min(1).label("Limit"),
|
||||||
|
with_deleted: Joi.bool().required().label("With Deleted"),
|
||||||
|
order_field: Joi.string().required().label("Order Field"),
|
||||||
|
order_direction: Joi.string().allow("asc", "desc").required().label("Order Direction"),
|
||||||
|
});
|
||||||
|
|
||||||
|
let param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
let filter = param.filter && param.filter !== "" ? JSON.parse(param.filter) : {};
|
||||||
|
|
||||||
|
var query = await ServiceModel.list(filter);
|
||||||
|
|
||||||
|
const offset = (param.page - 1) * param.limit;
|
||||||
|
let limit = param.limit;
|
||||||
|
|
||||||
|
const base_query = query
|
||||||
|
.select([
|
||||||
|
"Service.id",
|
||||||
|
"Service.name",
|
||||||
|
"Service.created_at",
|
||||||
|
"Service.created_by",
|
||||||
|
"serviceType.id",
|
||||||
|
"serviceType.name",
|
||||||
|
"serviceFare.id",
|
||||||
|
"serviceFare.fare",
|
||||||
|
"fareType.id",
|
||||||
|
"fareType.name",
|
||||||
|
"room.id",
|
||||||
|
"room.room",
|
||||||
|
])
|
||||||
|
.leftJoin("Service.serviceType", "serviceType")
|
||||||
|
.leftJoin("Service.rooms", "room")
|
||||||
|
.leftJoin("room.department", "department")
|
||||||
|
.innerJoin("Service.servicefare", "serviceFare")
|
||||||
|
.innerJoin("serviceFare.serviceClass", "serviceClass")
|
||||||
|
.innerJoin("serviceFare.faretype", "fareType")
|
||||||
|
.andWhere("department.code = :code", { code: "08" });
|
||||||
|
|
||||||
|
const res_count = base_query.clone();
|
||||||
|
const res_list = base_query
|
||||||
|
.orderBy("Service." + param.order_field, param.order_direction)
|
||||||
|
.skip(offset)
|
||||||
|
.take(limit);
|
||||||
|
|
||||||
|
if (param.with_deleted) {
|
||||||
|
res_count.withDeleted();
|
||||||
|
res_list.withDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
const current_page = param.page;
|
||||||
|
const total_count_data = await res_count.getCount();
|
||||||
|
const list_data = await res_list.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, current_page, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(
|
||||||
|
res,
|
||||||
|
400,
|
||||||
|
401,
|
||||||
|
Language.lang.failed_view,
|
||||||
|
err.message
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,6 @@ import express from 'express';
|
|||||||
|
|
||||||
export class MorganHelper {
|
export class MorganHelper {
|
||||||
static setup(app: express.Application) {
|
static setup(app: express.Application) {
|
||||||
if (process.env.NODE_ENV == 'prod') {
|
|
||||||
app.use(morgan(config.get('server.morgan'), {
|
|
||||||
skip: function (req, res) { return res.statusCode < 400 }
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
app.use(morgan(config.get('server.morgan')));
|
app.use(morgan(config.get('server.morgan')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -96,7 +96,8 @@ import {
|
|||||||
CardPrintQueue,
|
CardPrintQueue,
|
||||||
EmrRegistrationTreatment,
|
EmrRegistrationTreatment,
|
||||||
TreatmentPlanSession,
|
TreatmentPlanSession,
|
||||||
TreatmentPlan
|
TreatmentPlan,
|
||||||
|
PatientPastMedicalDocument
|
||||||
} from "entity";
|
} from "entity";
|
||||||
|
|
||||||
export class OrmHelper {
|
export class OrmHelper {
|
||||||
@ -215,7 +216,8 @@ export class OrmHelper {
|
|||||||
CardPrintQueue,
|
CardPrintQueue,
|
||||||
EmrRegistrationTreatment,
|
EmrRegistrationTreatment,
|
||||||
TreatmentPlanSession,
|
TreatmentPlanSession,
|
||||||
TreatmentPlan
|
TreatmentPlan,
|
||||||
|
PatientPastMedicalDocument
|
||||||
],
|
],
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
migrations: [],
|
migrations: [],
|
||||||
|
|||||||
@ -194,6 +194,7 @@ export class RoutePrivate {
|
|||||||
|
|
||||||
app.get("/api/room-services/list", RoomServicesController.list);
|
app.get("/api/room-services/list", RoomServicesController.list);
|
||||||
app.get("/api/room-services/list-services/:room_id", RoomServicesController.listServices);
|
app.get("/api/room-services/list-services/:room_id", RoomServicesController.listServices);
|
||||||
|
app.get("/api/room-services/list-ancillary-services", RoomServicesController.listAncillaryServices);
|
||||||
app.get("/api/room-services/detail/:id", RoomServicesController.detail);
|
app.get("/api/room-services/detail/:id", RoomServicesController.detail);
|
||||||
app.put("/api/room-services/:id", RoomServicesController.update);
|
app.put("/api/room-services/:id", RoomServicesController.update);
|
||||||
|
|
||||||
@ -544,6 +545,8 @@ export class RoutePrivate {
|
|||||||
|
|
||||||
app.get("/api/card-print-queue/list", CardPrintQueueController.list);
|
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", 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/card-print-queue/detail/:id", CardPrintQueueController.detail);
|
||||||
|
|
||||||
app.get("/api/payment-method/list", PaymentMethodController.list);
|
app.get("/api/payment-method/list", PaymentMethodController.list);
|
||||||
|
|||||||
Reference in New Issue
Block a user