update: patient_guarantor.ts add faretype relation and update swagger builder

This commit is contained in:
wayanrivan
2026-03-30 09:40:37 +07:00
parent dd6af41733
commit af4e6b7294
3 changed files with 7 additions and 2 deletions

View File

@ -185,6 +185,7 @@ export class PatientGuarantorController {
agreement_no: Joi.string().max(50).required().label('Agreement No.'),
agreement_desc: Joi.string().max(512).optional().label('Agreement Description'),
patient_group_id: Joi.string().guid({ version: 'uuidv4' }).required().label('Patient Group'),
faretype: Joi.string().guid({ version: 'uuidv4' }).required().label('Fare Type'),
});
const param: any = await schema.validateAsync(req.body);
@ -198,6 +199,7 @@ export class PatientGuarantorController {
data.agreement_no = param.agreement_no;
data.agreement_desc = param.agreement_desc;
data.patient_group = param.patient_group_id;
data.faretype = param.faretype;
data.created_by = req.auth.data.name;
data.updated_by = req.auth.data.name;
@ -247,7 +249,8 @@ export class PatientGuarantorController {
zip_code: Joi.string().max(10).required().label('Zip Code'),
agreement_no: Joi.string().max(50).required().label('Agreement No.'),
agreement_desc: Joi.string().max(512).optional().label('Agreement Description'),
patient_group_id: Joi.string().guid({ version: 'uuidv4' }).required().label('Patient Group')
patient_group_id: Joi.string().guid({ version: 'uuidv4' }).required().label('Patient Group'),
faretype: Joi.string().guid({ version: 'uuidv4' }).required().label('Fare Type'),
});
req.body.id = req.params['id'];
@ -267,6 +270,7 @@ export class PatientGuarantorController {
data.agreement_no = param.agreement_no;
data.agreement_desc = param.agreement_desc;
data.patient_group = param.patient_group_id;
data.faretype = param.faretype;
data.created_by = req.auth.data.name;
data.updated_by = req.auth.data.name;

View File

@ -27,7 +27,7 @@ export class PatientGuarantorModel {
}
}
var query = repo.createQueryBuilder("patient_guarantor").leftJoinAndSelect("patient_guarantor.patient_group", "patient_group");
var query = repo.createQueryBuilder("patient_guarantor").leftJoinAndSelect("patient_guarantor.patient_group", "patient_group").leftJoinAndSelect("patient_guarantor.faretype", "faretype");
if (whereAttr.length != 0) {
query = query.where(whereAttr.join(" and "), whereVal);
}

View File

@ -351,6 +351,7 @@ const doc = {
$agreement_no: "AG123456789", // Nomor Perjanjian
$agreement_desc: "Health Insurance Agreement", // Deskripsi Perjanjian (opsional)
$patient_group_id: "2e1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Patient Group (UUID)
$faretype: "3f1a1b33-bbb2-4f33-b2c4-cff5976f3f95", // Fare Type (UUID)
},
refferal_hospital: {
$refferal_hospital_name: "RefferalHospital name",