Commit 12fbd04b by wkliang

manualEvaluation return diagnosis_no

parent 6b6764bd
...@@ -4,11 +4,11 @@ const ServiceBase = require("../../sve.base"); ...@@ -4,11 +4,11 @@ const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
var moment = require('moment') var moment = require('moment')
class DiagnosisService extends ServiceBase { class DiagnosisService extends ServiceBase {
constructor() { constructor () {
super("dbneed", ServiceBase.getDaoName(DiagnosisService)); super("dbneed", ServiceBase.getDaoName(DiagnosisService));
} }
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");
if (!actionBody.mobile) { if (!actionBody.mobile) {
...@@ -22,7 +22,7 @@ class DiagnosisService extends ServiceBase { ...@@ -22,7 +22,7 @@ class DiagnosisService extends ServiceBase {
} }
if (!actionBody.diagnosisType) { if (!actionBody.diagnosisType) {
return system.getResultFail(-5007, "诊断类型不能为空"); return system.getResultFail(-5007, "诊断类型不能为空");
} }
var nobj = { var nobj = {
uapp_id: pobj.appInfo.uapp_id, uapp_id: pobj.appInfo.uapp_id,
diagnosis_no: diagnosisNeedNo, // uuid diagnosis_no: diagnosisNeedNo, // uuid
...@@ -39,16 +39,16 @@ class DiagnosisService extends ServiceBase { ...@@ -39,16 +39,16 @@ class DiagnosisService extends ServiceBase {
brand_pic: actionBody.brandPic, brand_pic: actionBody.brandPic,
industry_pic: actionBody.industryPic industry_pic: actionBody.industryPic
} }
if(actionBody.diagnosisMode == "zn") { if (actionBody.diagnosisMode == "zn") {
nobj.diagnosis_result = actionBody.checkResult.data.isPass == false ? "wtg" : "tg"; nobj.diagnosis_result = actionBody.checkResult.data.isPass == false ? "wtg" : "tg";
nobj.status = "ywc" nobj.status = "ywc"
nobj.diagnosis_result_data = actionBody.checkResult;// 诊断方式为智能时 channel会传来诊断结果,记录快照 nobj.diagnosis_result_data = actionBody.checkResult;// 诊断方式为智能时 channel会传来诊断结果,记录快照
} }
await this.dao.create(nobj); await this.dao.create(nobj);
return system.getResultSuccess(); return system.getResultSuccess({ diagnosis_no: diagnosisNeedNo });
} }
async diagnosisInfo(pobj) { async diagnosisInfo (pobj) {
var actionBody = pobj.actionBody; var actionBody = pobj.actionBody;
let query = { let query = {
offset: ((actionBody.page - 1) * actionBody.pageSize) || 0, offset: ((actionBody.page - 1) * actionBody.pageSize) || 0,
...@@ -67,8 +67,8 @@ class DiagnosisService extends ServiceBase { ...@@ -67,8 +67,8 @@ class DiagnosisService extends ServiceBase {
} }
let where = {} let where = {}
if (pobj.userInfo.channel_userid) { if (pobj.userInfo.channel_userid) {
where.channel_user_Id = pobj.userInfo.channel_userid where.channel_user_Id = pobj.userInfo.channel_userid
} }
if (actionBody.diagnosisNo) { if (actionBody.diagnosisNo) {
where.diagnosis_no = { [this.db.Op.like]: `%${actionBody.diagnosisNo}%` } where.diagnosis_no = { [this.db.Op.like]: `%${actionBody.diagnosisNo}%` }
} }
...@@ -85,7 +85,7 @@ class DiagnosisService extends ServiceBase { ...@@ -85,7 +85,7 @@ class DiagnosisService extends ServiceBase {
where.publish_name = { [this.db.Op.like]: `%${actionBody.publish_name}%` } where.publish_name = { [this.db.Op.like]: `%${actionBody.publish_name}%` }
} }
if (actionBody.stdate && actionBody.endate) { if (actionBody.stdate && actionBody.endate) {
where.updated_at = { [this.db.Op.between]: [actionBody.stdate, actionBody.endate]} where.updated_at = { [this.db.Op.between]: [actionBody.stdate, actionBody.endate] }
} }
if (actionBody.corporateTypeName) { if (actionBody.corporateTypeName) {
where.corporate_type_name = actionBody.corporateTypeName where.corporate_type_name = actionBody.corporateTypeName
...@@ -97,24 +97,24 @@ class DiagnosisService extends ServiceBase { ...@@ -97,24 +97,24 @@ class DiagnosisService extends ServiceBase {
return system.getResultSuccess(res); return system.getResultSuccess(res);
} }
async diagnosisDetail(pobj) { async diagnosisDetail (pobj) {
if(!pobj.actionBody.diagnosisNo) { if (!pobj.actionBody.diagnosisNo) {
return system.getResultFail(-5008, "诊断单号不能为空"); return system.getResultFail(-5008, "诊断单号不能为空");
} }
let diagnosisResult = await this.dao.findOneByDiagnosisNo(pobj.actionBody.diagnosisNo) let diagnosisResult = await this.dao.findOneByDiagnosisNo(pobj.actionBody.diagnosisNo)
return system.getResultSuccess(diagnosisResult); return system.getResultSuccess(diagnosisResult);
} }
async enterpriseInfo(pobj) { async enterpriseInfo (pobj) {
let diagnosisResult = await this.dao.findOneOrderByCreateAt(pobj.userInfo.channel_userid) let diagnosisResult = await this.dao.findOneOrderByCreateAt(pobj.userInfo.channel_userid)
if(diagnosisResult) { if (diagnosisResult) {
diagnosisResult.auth_result_name = "未认证" diagnosisResult.auth_result_name = "未认证"
if(diagnosisResult.diagnosis_result == "tg") { if (diagnosisResult.diagnosis_result == "tg") {
diagnosisResult.auth_result_name = "已认证" diagnosisResult.auth_result_name = "已认证"
} }
return system.getResultSuccess(diagnosisResult); return system.getResultSuccess(diagnosisResult);
} else { } else {
return system.getResultSuccess(); return system.getResultSuccess();
} }
} }
} }
......
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