Commit 909e465a by linboxuan

diagnosis add

parent 9d1dd71f
...@@ -21,9 +21,15 @@ class DiagnosisAPI extends APIBase { ...@@ -21,9 +21,15 @@ class DiagnosisAPI extends APIBase {
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
case "manualEvaluation"://提交需求 2020 0807 lin 新增 case "manualEvaluation":
opResult = await this.diagnosisSve.manualEvaluation(pobj, pobj.actionBody, req); opResult = await this.diagnosisSve.manualEvaluation(pobj, pobj.actionBody, req);
break; break;
case "diagnosisInfo":
opResult = await this.diagnosisSve.diagnosisInfo(pobj, pobj.actionBody, req);
break;
case "enterpriseInfo":
opResult = await this.diagnosisSve.enterpriseInfo(pobj, pobj.actionBody, req);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -10,5 +10,17 @@ class diagnosisDao extends Dao { ...@@ -10,5 +10,17 @@ 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 } })
} }
async findOneOrderByCreateAt (uid) {
return await this.model.findOne({
where: {
channel_user_Id: uid
},
order: [
["updated_at", "desc"]
],
raw: true
});
}
} }
module.exports = diagnosisDao; module.exports = diagnosisDao;
\ No newline at end of file
...@@ -45,7 +45,9 @@ module.exports = (db, DataTypes) => { ...@@ -45,7 +45,9 @@ module.exports = (db, DataTypes) => {
} }
}, },
diagnosis_result_name: DataTypes.STRING,//诊断结果名字 通过/未通过/人工审核中 --暂不用 diagnosis_result_name: DataTypes.STRING,//诊断结果名字 通过/未通过/人工审核中 --暂不用
diagnosis_result_data: DataTypes.JSON, // 智能诊断结果返回值 人工目前没用到
status_name: DataTypes.STRING,//状态 dcl/gtz/dqrfa/ygb/ywc status_name: DataTypes.STRING,//状态 dcl/gtz/dqrfa/ygb/ywc
main_class: DataTypes.STRING,// 主营类目(一级分类-二级分类)
qualifications_pic: DataTypes.JSON,// 基础资质json {} qualifications_pic: DataTypes.JSON,// 基础资质json {}
brand_pic: DataTypes.JSON,// 品牌资质json {} brand_pic: DataTypes.JSON,// 品牌资质json {}
industry_pic: DataTypes.JSON,// 行业资质json {} industry_pic: DataTypes.JSON,// 行业资质json {}
......
...@@ -6,8 +6,8 @@ var moment = require('moment') ...@@ -6,8 +6,8 @@ var moment = require('moment')
class DiagnosisService extends ServiceBase { class DiagnosisService extends ServiceBase {
constructor() { constructor() {
super("dbneed", ServiceBase.getDaoName(DiagnosisService)); super("dbneed", ServiceBase.getDaoName(DiagnosisService));
this.diagnosisDao = system.getObject("db.dbneed.diagnosisDao");
} }
async manualEvaluation(pobj) { async manualEvaluation(pobj) {
var actionBody = pobj.actionBody; var actionBody = pobj.actionBody;
var diagnosisNeedNo = await this.getBusUid("n"); var diagnosisNeedNo = await this.getBusUid("n");
...@@ -34,12 +34,63 @@ class DiagnosisService extends ServiceBase { ...@@ -34,12 +34,63 @@ class DiagnosisService extends ServiceBase {
diagnosis_mode: actionBody.diagnosisMode, // 诊断方式,这里由channel项目调用带参数 diagnosis_mode: actionBody.diagnosisMode, // 诊断方式,这里由channel项目调用带参数
diagnosis_result: "rgshz", // 创建订单时 人工审核中 前台用 diagnosis_result: "rgshz", // 创建订单时 人工审核中 前台用
status: "dcl", // 创建订单时 待处理 后台用 status: "dcl", // 创建订单时 待处理 后台用
main_class = actionBody.mainClass,// 运营后台-诊断详情-主营类目
qualifications_pic: actionBody.qualificationsPic, qualifications_pic: actionBody.qualificationsPic,
brand_pic: actionBody.brandPic, brand_pic: actionBody.brandPic,
industry_pic: actionBody.industryPic industry_pic: actionBody.industryPic
} }
if(actionBody.diagnosisMode == "zn") {
nobj.diagnosis_result = actionBody.checkResult.data.isPass == false ? "wtg" : "tg";
nobj.status = "ywc"
nobj.diagnosis_result_data = actionBody.checkResult;// 诊断方式为智能时 channel会传来诊断结果,记录快照
}
await this.dao.create(nobj); await this.dao.create(nobj);
return system.getResultSuccess(); return system.getResultSuccess();
} }
async diagnosisInfo(pobj) {
var actionBody = pobj.actionBody;
let query = {
offset: ((actionBody.page - 1) * actionBody.pageSize) || 0,
limit: actionBody.pageSize || 10,
attributes: [
"diagnosis_no",// 申请编号
"corporate_name",// 公司名称
"publish_mobile",// 联系人手机号
"diagnosis_type_name",// 诊断类型
"diagnosis_mode_name",// 诊断方式
"diagnosis_result_name",// 诊断结果
"updated_at"],// 修改时间
order: [
["updated_at", "desc"]
]
}
let where = {}
if (actionBody.diagnosisNo) {
where.diagnosis_no = { [this.db.Op.like]: `%${actionBody.diagnosis_no}%` }
}
if (actionBody.status) {
where.status = actionBody.status
}
if (actionBody.publishName) {
where.publish_name = { [this.db.Op.like]: `%${actionBody.publish_name}%` }
}
if (actionBody.stdate && actionBody.endate) {
where.updatedAt = { [this.db.Op.between]: [actionBody.stdate, actionBody.endate]}
}
if (actionBody.corporateType) {
where.corporate_type = actionBody.corporateType
}
if (Object.keys(where).length > 0) {
query.where = where
}
let res = await this.dao.findAndCountAll(query)
return system.getResultSuccess(res);
}
async enterpriseInfo(pobj) {
let diagnosisResult = await this.dao.findOneOrderByCreateAt(pobj.userInfo.channel_userid)
return system.getResultSuccess(diagnosisResult);
}
} }
module.exports = DiagnosisService; module.exports = DiagnosisService;
\ 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