<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__lhwrb7ZYwUBlgIoNJBb">
  <name>资格证考生考试信息</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>get</requestType>
  <requestUrl>/exam/personExamInfo</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[(function(){
  var whereStr =" where b.ITEM_EXAMSTATE = '0' and b.item_examType='3' and b.item_examine='1' ";
  var idCardNo = getParameter("idCardNo"); 
  var examId = getParameter("examId"); 
  var clear = getParameter("clear"); 
  var key = idCardNo+examId;
  if(isNotNull(idCardNo) && isNotNull(examId)){
    if(isNotNull(clear)){
      removeFromRedis(key);
    }
    var datas = getDataFromRedis(key);
    if(isNotNull(datas)){
      return datas;
    }
  }

  if(isNotNull(idCardNo)){
    whereStr +=" and a.ITEM_IDCARDNO = '"+idCardNo+"' ";
  }
  if(isNotNull(examId)){
    whereStr +=" and a.ITEM_EXAMID = '"+examId+"' ";
  }
  var sql = "select '"+getDomainid()+"' as domainid,"+
      "case b.ITEM_SUBJECTID when '1' then '保安员资格证'" + 
      " when '2' then '保安员培训结业考试'"+
      " end as ITEM_SUBJECTID," + //科目
      "b.ITEM_EXAMTYPE," + //考试类型
      "b.ITEM_PAPERID," + //试卷名称
      "b.ITEM_TESTDURATION," + //考试时长
      "b.ITEM_EXAMSTATE," + //考试状态
      "b.ITEM_EXAMNAME," + //考试名称
      "b.ITEM_practical_fail_up," + //体测不合格是否可以补考
      "b.ITEM_examKind," + //考试类型
      "b.item_isPlace,"+//是否开启考场定位
      "b.ITEM_countQuestions," + //总题数
      "a.ITEM_face_on_exam," + //考试中是否人脸
      "b.ITEM_person," + //考点联系人
      "b.ITEM_ATTENTION," + //注意事项
      "b.ITEM_ISSTAMINA," + //是否体能考试
      "b.ITEM_STAMINAADDRESS," + //体能考试地址
      "DATE_FORMAT(b.ITEM_STAMINASTARTDATE, '%Y-%m-%d %H:%i:%S' ) as ITEM_STAMINASTARTDATE," + //体能测试开始时间
      "DATE_FORMAT(b.ITEM_STAMINAENDDATE, '%Y-%m-%d %H:%i:%S' ) as ITEM_STAMINAENDDATE," + //体能测试结束时间
      "b.ITEM_EXAMRULES," + //成绩考核规则
      "case b.ITEM_ISCOMPUTEREXAM when '0' then '否'" + 
      " when '1' then '是'"+
      " end as ITEM_ISCOMPUTEREXAM," + //是否理论考试
      "b.ITEM_THEORETICALADDRESS," + //理论考试地址
      "DATE_FORMAT( b.ITEM_COMPUTERSTARTDATE, '%Y-%m-%d %H:%i:%S' ) as ITEM_COMPUTERSTARTDATE," + //理论考试开始时间
      "DATE_FORMAT( b.ITEM_COMPUTERENDDATE, '%Y-%m-%d %H:%i:%S' ) as ITEM_COMPUTERENDDATE," + //理论考试结束时间
      "b.ITEM_WRITTENRATIO," + //理论分数占比
      "b.ITEM_OPERATERATIO," + //体能分数占比
      "b.ITEM_EXAMSTANDARD," + //成绩合格分数
      "b.ITEM_WRITTENPASSSCORE," + //理论考试合格分数
      "b.ITEM_OPERATEPASSSCORE," + //体能合格分数
      "b.item_placeId,"+//考场id
      "a.ITEM_SECURITYID," + //保安员id
      "a.ITEM_IDCARDNO," + //身份证
      "a.ITEM_NAME," + //姓名
      "a.ITEM_writtenStatus," + //理论考试状态
      "a.ITEM_operateStatus," + //实操考试状态
      "a.ITEM_COMPANY," + //所属公司
      "a.ITEM_MOBILE," + //手机号
      "a.ITEM_zw AS ITEM_seatNumber," + //座位号
      "b.ITEM_placeName," + //考场名称
      "a.ITEM_WRITTENRECORDMORE," +
      "a.ITEM_SUMSCORE," + //总成绩
      "case a.ITEM_TESTSTATE when '0' then '不合格'" + 
      " when '1' then '合格'"+
      " when '-' then '未考试'"+
      " end as ITEM_TESTSTATE," + //考试成绩状态
      "a.ITEM_APPLYID," + //报名id
      "a.ITEM_WRITTENSTATE," + //笔试状态
      "a.ITEM_WRITTENRECORD," + //笔试做题记录
      "a.ITEM_SIGNIN," + //是否签到
      "a.ITEM_operateSignIn," + //体能是否签到
      "a.ITEM_EXAMID," + //考试id
      "a.ID,"+
      "DATE_FORMAT( now(), '%Y-%m-%d %H:%i:%S' ) as ITEM_NOW," + //当前时间
      "a.ITEM_WRITTENSCORE," + //理论成绩
      "a.ITEM_operateScore," + //实操成绩
      "a.ITEM_jumpFace," + //跳过人脸
      "a.ID as ITEM_ID"+
      " from tms.tlk_system_exam_person a"+
      " INNER JOIN"+
      " tms.tlk_system_exam_info b on a.ITEM_EXAMID = b.ID   "+whereStr;
  sql += "  order by b.created desc limit 1000"
  var datas = queryByDSName("tms",sql);
  if(isNotNull(idCardNo) && isNotNull(examId) && isNotNull(datas)){
    setDataToRedis(key,datas,300);
  }

  return datas;
})()
]]></responseScript>
</Api>