Commit 386179e7 by wkliang

test

parent 1eae4ae6
var APIBase = require("../../api.base");
var system = require("../../../system");
class DiagnosisNeedBusAPI extends APIBase {
constructor () {
super();
this.dnbSve = system.getObject("service.dbneed.diagnosisneedbusSve");
}
async springBoard (pobj, qobj, req) {
// if (!pobj.actionType) {
// return system.getResult(null, "actionType参数不能为空");
// }
// if (pobj.actionType == 'TODO: 认证结果 / 方案') {
// if (!pobj.userInfo) {
// return system.getResult(system.noLogin, "user no login!");
// }
// if (!pobj.appInfo) {
// return system.getResult(system.noLogin, "app is null!");
// }
// }
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess (pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "getList": // 获取列表
opResult = await this.dnbSve.getList(pobj, pobj.actionBody, req);
break;
case "getDetail": // 获取详情
opResult = await this.dnbSve.getDetail(pobj, pobj.actionBody.id);
break;
case "doEAV": // 审核
opResult = await this.dnbSve.doEAV(pobj, pobj.actionBody, req);
break;
default:
opResult = system.getResult(null, "actionType参数错误");
break;
}
return opResult;
}
}
module.exports = DiagnosisNeedBusAPI;
\ No newline at end of file
const Dao = require("../../dao.base");
class diagnosisneedinfoDao extends Dao {
constructor() {
super(Dao.getModelName(diagnosisneedinfoDao));
constructor () {
super('needinfo');
}
async findAndCountAll (query) {
console.log(this.model)
return await this.model.findAndCountAll(query)
}
async update (param, id) {
return await this.model.update(param, { where: { id } })
}
}
module.exports = diagnosisneedinfoDao;
\ No newline at end of file
const System = require('../../../system')
const ServiceBase = require("../../sve.base");
class diagnosisneedbusService extends ServiceBase {
constructor() {
super();
super("dbneed", 'diagnosisneedinfoDao');
this.dniDao = System.getObject("db.dbneed.diagnosisneedinfoDao");
}
async test () {
return 'test'
async getList (pobj, data, req) {
let query = {
offset: ((data.page - 1) * data.pageSize) || 1,
limit: data.pageSize || 10
}
let where = {}
if (data.diagnosisNo) {
where.diagnosisNo = { [this.db.Op.like]: `%${data.diagnosisNo}%` }
}
if (data.status) {
where.status = data.status
}
if (data.publishName) {
where.publishName = { [this.db.Op.like]: `%${data.publishName}%` }
}
if (data.stdate && data.endate) {
where.updatedAt = { [this.db.Op.between]: [data.stdate, data.endate]}
}
if (Object.keys(where).length > 0) {
query.where = where
}
let res = await this.dao.findAndCountAll(query)
return res
}
async getDetail(pobj, id) {
let res = await this.dniDao.findById(id)
return res
}
async doEAV(pobj, data, req) {
let query = {
status: 'ywc',
diagnosisResult: data.diagnosisResult
}
let res = await this.dniDao.update(query, data.id)
}
}
module.exports = diagnosisneedbusService;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment