Commit 7b18f95c by wkliang

fix

parent 9d1dd71f
const Dao = require("../../dao.base"); const Dao = require("../../dao.base");
class diagnosisDao extends Dao { class diagnosisDao extends Dao {
constructor() { constructor () {
super(Dao.getModelName(diagnosisDao)); super(Dao.getModelName(diagnosisDao));
} }
async findAndCountAll (query) { async findAndCountAll (query) {
...@@ -10,5 +10,6 @@ class diagnosisDao extends Dao { ...@@ -10,5 +10,6 @@ class diagnosisDao extends Dao {
async update (param, id) { async update (param, id) {
return await this.model.update(param, { where: { id } }) return await this.model.update(param, { where: { id } })
} }
} }
module.exports = diagnosisDao; module.exports = diagnosisDao;
\ No newline at end of file
const System = require('../../../system')
const ServiceBase = require("../../sve.base"); const ServiceBase = require("../../sve.base");
const System = require('../../../system');
class diagnosisneedbusService extends ServiceBase { class diagnosisneedbusService extends ServiceBase {
constructor() { constructor () {
super("dbneed", 'diagnosisDao'); super("dbneed", 'diagnosisDao');
} }
async getList (pobj, data, req) { async getList (pobj, data, req) {
let query = { let query = {
offset: ((data.page - 1) * data.pageSize) || 1, offset: ((data.page - 1) * data.pageSize) || 0,
limit: data.pageSize || 10 limit: data.pageSize || 10,
attributes: [
'id',
'diagnosis_no',
'corporate_type',
'corporate_type_name',
'corporate_name',
'publish_name',
'publish_mobile',
'status',
'status_name'
],
order: [["updated_at", 'desc']]
} }
let where = {} let where = {}
if (data.diagnosisNo) { if (data.diagnosisNo) {
...@@ -20,8 +32,8 @@ class diagnosisneedbusService extends ServiceBase { ...@@ -20,8 +32,8 @@ class diagnosisneedbusService extends ServiceBase {
if (data.publishName) { if (data.publishName) {
where.publish_name = { [this.db.Op.like]: `%${data.publishName}%` } where.publish_name = { [this.db.Op.like]: `%${data.publishName}%` }
} }
if (data.stdate && data.endate) { if (data.updatedAt) {
where.updatedAt = { [this.db.Op.between]: [data.stdate, data.endate]} where.updatedAt = { [this.db.Op.between]: [data.updatedAt.stdate, data.updatedAt.endate] }
} }
if (data.corporateType) { if (data.corporateType) {
where.corporate_type = data.corporateType where.corporate_type = data.corporateType
...@@ -29,21 +41,34 @@ class diagnosisneedbusService extends ServiceBase { ...@@ -29,21 +41,34 @@ class diagnosisneedbusService extends ServiceBase {
if (Object.keys(where).length > 0) { if (Object.keys(where).length > 0) {
query.where = where query.where = where
} }
let res = await this.dao.findAndCountAll(query) try {
return res let res = await this.dao.findAndCountAll(query)
return System.getResultSuccess(res)
} catch (error) {
return System.getResultFail(-1, error.message)
}
} }
async getDetail(pobj, id) { async getDetail (pobj, id) {
let res = await this.dniDao.findById(id) try {
return res let res = await this.dao.findById(id)
return System.getResultSuccess(res)
} catch (error) {
return System.getResultFail(-1, error.message)
}
} }
async doEAV(pobj, data, req) { async doEAV (pobj, data, req) {
let query = { let query = {
status: 'ywc', status: 'ywc',
diagnosisResult: data.diagnosisResult diagnosisResult: data.diagnosisResult
} }
let res = await this.dniDao.update(query, data.id) let res = await this.dao.update(query, data.id)
try {
return System.getResultSuccess(res)
} catch (error) {
return System.getResultFail(-1, error.message)
}
} }
} }
module.exports = diagnosisneedbusService; 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