<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Api id="__rhwS8aQ0INpYOZvR99C">
  <name>行业考试管理-我的培训-培训记录</name>
  <parentId>__LgZds5MVHW3o08T7UcX</parentId>
  <applicationid>__LgZds5MVHW3o08T7UcX</applicationid>
  <status>published</status>
  <apiGroup></apiGroup>
  <encode>UTF-8</encode>
  <requestType>post</requestType>
  <requestUrl>/train/records</requestUrl>
  <tags></tags>
  <responseType>json</responseType>
  <responseScript><![CDATA[(function(){
  var result = new Packages.java.util.HashMap();
  var jsonStr = getParameter("_content");
  if(isNotNull(jsonStr)){
    var json = JSON.parse(jsonStr);
    var idcard_no = json["idcard_no"]
    var sql="select * from ((select '"+getDomainid()+"' as domainid,"+
        "person.item_train_domain_name,"+//培训单位
        "plan.item_plan,"+//培训计划
        "type.item_point_type,"+//培训类型
        "MAX(CASE WHEN person.item_classroom_type = '理论教室' THEN class.item_class_name ELSE '' END) AS item_computer_class ,"+//理论培训教室
        "MAX(CASE WHEN person.item_classroom_type = '实操教室' THEN class.item_class_name ELSE '' END) AS item_operate_class ,"+//实操培训教室
        "DATE_FORMAT(plan.item_train_start_time, '%Y-%m-%d') as item_train_start_time,"+//培训开始时间
        "DATE_FORMAT(plan.item_train_end_time, '%Y-%m-%d') as item_train_end_time "+//培训结束时间
        "from tlk_train_person person "+
        "inner join tlk_train_class_info class on class.id=person.item_class_id "+
        "inner join tlk_train_classroom classroom on classroom.id=class.item_classroom_id "+
        "inner join tlk_train_plan plan on plan.id=person.item_plan_id "+
        "left join tlk_train_point_type type on type.id = person.item_point_type " +
        "where person.item_idcard_no='"+idcard_no+"'"+
        "group by plan.id,person.item_idcard_no " +
        " order by plan.created desc ) "+
        " UNION ALL " +
        " (select '"+getDomainid()+"' as domainid,"+
        "item_trainingName,"+//培训单位
        " '' as item_plan,"+
        "item_content,"+//培训内容
        " '' AS item_computer_class ,"+//理论培训教室
        " '' AS item_operate_class ,"+//实操培训教室
        "DATE_FORMAT(item_trainingDate, '%Y-%m-%d') as item_train_start_time,"+//培训开始时间
        "DATE_FORMAT(item_trainingDate, '%Y-%m-%d')  as item_train_end_time "+//培训结束时间
        "from companyinfocollect.tlk_training_records where item_idNo='"+idcard_no+"' ))t "
        var datas = queryByDSName("tms",sql); 
    //result.put("sql",sql);
    result.put("data",datas);
    result.put("code","200");
    result.put("msg","OK");
    result.put("state", true);
    return result;
  }
})()]]></responseScript>
</Api>