fix refferl hospital create use order number
This commit is contained in:
@ -201,8 +201,16 @@ export class RefferalHospitalController {
|
|||||||
|
|
||||||
const param: any = await schema.validateAsync(req.body);
|
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()
|
const data = new RefferalHospital()
|
||||||
data.refferal_hospital_name = param.refferal_hospital_name
|
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;
|
data.created_by = req.auth.data.name;
|
||||||
|
|
||||||
await OrmHelper.DB.manager.save(data);
|
await OrmHelper.DB.manager.save(data);
|
||||||
|
|||||||
Reference in New Issue
Block a user