Commit e14771a4 by wkliang

Merge branch 'center-order' of gitlab.gongsibao.com:jiangyong/zhichan into center-order

parents 7124e522 6a74a04a
...@@ -28,6 +28,9 @@ class DiagnosisAPI extends APIBase { ...@@ -28,6 +28,9 @@ class DiagnosisAPI extends APIBase {
case "diagnosisInfo": case "diagnosisInfo":
opResult = await this.diagnosisSve.diagnosisInfo(pobj, pobj.actionBody, req); opResult = await this.diagnosisSve.diagnosisInfo(pobj, pobj.actionBody, req);
break; break;
case "diagnosisDetail":
opResult = await this.diagnosisSve.diagnosisDetail(pobj, pobj.actionBody, req);
break;
case "enterpriseInfo": case "enterpriseInfo":
opResult = await this.diagnosisSve.enterpriseInfo(pobj, pobj.actionBody, req); opResult = await this.diagnosisSve.enterpriseInfo(pobj, pobj.actionBody, req);
break; break;
......
...@@ -31,5 +31,18 @@ class diagnosisDao extends Dao { ...@@ -31,5 +31,18 @@ class diagnosisDao extends Dao {
raw: true raw: true
}); });
} }
async findOneByDiagnosisNo (diagnosisNo) {
return await this.model.findOne({
where: {
diagnosis_no: diagnosisNo
},
attributes: [
"diagnosis_no",
"diagnosis_result_name",
"diagnosis_result_data"],
raw: true
});
}
} }
module.exports = diagnosisDao; module.exports = diagnosisDao;
\ No newline at end of file
...@@ -18,10 +18,10 @@ class DiagnosisService extends ServiceBase { ...@@ -18,10 +18,10 @@ class DiagnosisService extends ServiceBase {
return system.getResultFail(-5005, "企业名称不能为空"); return system.getResultFail(-5005, "企业名称不能为空");
} }
if (!actionBody.corporateType) { if (!actionBody.corporateType) {
return system.getResultFail(-5005, "店铺类型不能为空"); return system.getResultFail(-5006, "店铺类型不能为空");
} }
if (!actionBody.diagnosisType) { if (!actionBody.diagnosisType) {
return system.getResultFail(-5005, "诊断类型不能为空"); return system.getResultFail(-5007, "诊断类型不能为空");
} }
var nobj = { var nobj = {
uapp_id: pobj.appInfo.uapp_id, uapp_id: pobj.appInfo.uapp_id,
...@@ -66,6 +66,9 @@ class DiagnosisService extends ServiceBase { ...@@ -66,6 +66,9 @@ class DiagnosisService extends ServiceBase {
] ]
} }
let where = {} let where = {}
if (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}%` }
} }
...@@ -94,6 +97,14 @@ class DiagnosisService extends ServiceBase { ...@@ -94,6 +97,14 @@ class DiagnosisService extends ServiceBase {
return system.getResultSuccess(res); return system.getResultSuccess(res);
} }
async diagnosisDetail(pobj) {
if(!pobj.actionBody.diagnosisNo) {
return system.getResultFail(-5008, "诊断单号不能为空");
}
let diagnosisResult = await this.dao.findOneByDiagnosisNo(pobj.actionBody.diagnosisNo)
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) {
......
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