fix refferl hospital create use order number
This commit is contained in:
@ -134,7 +134,7 @@ export class RefferalHospitalController {
|
||||
|
||||
var query = await RefferalHospitalModel.list(filter);
|
||||
const data = await query.getMany();
|
||||
|
||||
|
||||
const filename = "refferal_hospital.csv";
|
||||
|
||||
res.setHeader('Content-Type', 'text/csv');
|
||||
@ -201,8 +201,16 @@ export class RefferalHospitalController {
|
||||
|
||||
const param: any = await schema.validateAsync(req.body);
|
||||
|
||||
const lastRow = await OrmHelper.DB.getRepository(RefferalHospital).findOne({
|
||||
order: {
|
||||
order_number: "DESC"
|
||||
},
|
||||
where: {}
|
||||
});
|
||||
|
||||
const data = new RefferalHospital()
|
||||
data.refferal_hospital_name = param.refferal_hospital_name
|
||||
data.order_number = lastRow && lastRow.order_number ? String(Number(lastRow.order_number) + 1) : "1";
|
||||
data.created_by = req.auth.data.name;
|
||||
|
||||
await OrmHelper.DB.manager.save(data);
|
||||
|
||||
Reference in New Issue
Block a user