diff --git a/src/controllers/refferal_hospital.ts b/src/controllers/refferal_hospital.ts index dd40367..38cd912 100644 --- a/src/controllers/refferal_hospital.ts +++ b/src/controllers/refferal_hospital.ts @@ -68,6 +68,30 @@ export class RefferalHospitalController { } } + static async option(req: Request, res: Response, next: NextFunction): Promise { + /* + #swagger.tags = ['RefferalHospital'] + #swagger.security = [{ "bearerAuth": [] }] + */ + try { + var query = await RefferalHospitalModel.list(); + + const res_count = query; + const res_list = query.orderBy("refferal_hospital.created_at", "DESC"); + + const current_page = 1; + 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); + } + } + static async export(req: Request, res: Response, next: NextFunction): Promise { /* #swagger.tags = ['RefferalHospital'] diff --git a/src/helpers/orm.ts b/src/helpers/orm.ts index 8b9febd..3f05c86 100644 --- a/src/helpers/orm.ts +++ b/src/helpers/orm.ts @@ -1,7 +1,7 @@ import config from 'config'; import { DataSource } from "typeorm"; import { ILogObj, Logger } from 'tslog'; -import { RegistrationFee,FareType, RoomStock, Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality, Diagnosis, DiagnosticProcedure, Room, ServiceType, ServiceClass, Service, ServiceFare, ServicePackage, Department, DoctorSchedule, MeasurementUnit, ReferenceRange, QueueMonitoring, ExaminationDetail, ExaminationType, User, UserRole, HrmsEmployee, HrmsDepartment, HrmsPosition, HrmsShift, HospitalInformation, ItemOrigin, ItemType, ItemTypeDetail, Unit, ItemCategory, ItemStatus, UsageInstructions, UsageTime, ItemClass, ItemClassDetail, GenericName, Factory, Supplier, FactoryToSupplier, ItemMaster, ItemGroup, PharmacyInfo, ItemPrice, SellingPricePercentage, PatientGroup, PatientGuarantor, InitialStock, DoctorItem, DoctorItemPackage, UserToRoom, RoomToPharmacy, PlanningVerificator, ScheduleSeries, ScheduleException, CardType, PaymentMethod } from 'entity' +import { RefferalHospital,RegistrationFee,FareType, RoomStock, Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality, Diagnosis, DiagnosticProcedure, Room, ServiceType, ServiceClass, Service, ServiceFare, ServicePackage, Department, DoctorSchedule, MeasurementUnit, ReferenceRange, QueueMonitoring, ExaminationDetail, ExaminationType, User, UserRole, HrmsEmployee, HrmsDepartment, HrmsPosition, HrmsShift, HospitalInformation, ItemOrigin, ItemType, ItemTypeDetail, Unit, ItemCategory, ItemStatus, UsageInstructions, UsageTime, ItemClass, ItemClassDetail, GenericName, Factory, Supplier, FactoryToSupplier, ItemMaster, ItemGroup, PharmacyInfo, ItemPrice, SellingPricePercentage, PatientGroup, PatientGuarantor, InitialStock, DoctorItem, DoctorItemPackage, UserToRoom, RoomToPharmacy, PlanningVerificator, ScheduleSeries, ScheduleException, CardType, PaymentMethod } from 'entity' export class OrmHelper { static DB: DataSource = null @@ -53,7 +53,8 @@ export class OrmHelper { FareType, CardType, PaymentMethod, - RegistrationFee + RegistrationFee, + RefferalHospital ], subscribers: [], migrations: [], diff --git a/src/routes/private.ts b/src/routes/private.ts index 2de78c8..622daf6 100644 --- a/src/routes/private.ts +++ b/src/routes/private.ts @@ -432,6 +432,7 @@ export class RoutePrivate { app.get('/api/patient-guarantor/view/:id', PatientGuarantorController.detail) app.get('/api/refferal-hospital/list', RefferalHospitalController.list) + app.get('/api/refferal-hospital/option', RefferalHospitalController.option) app.get('/api/refferal-hospital/export', RefferalHospitalController.export) app.post('/api/refferal-hospital/create', RefferalHospitalController.create) app.put('/api/refferal-hospital/update/:id', RefferalHospitalController.update)