自定义模板配置说明
- 实例
[
{
"description": "健康证配置",
"query": "select o.order_code,ac.cust_name,ac.cust_id_card,date_format(oc.sign_date,'%Y年%m月%d日') sign_date,oc.health_code,cci.item_name work_type,cci2.item_name cust_sex,'abcd' as sign_org,date_format(o.order_exam_time,'%Y年%m月%d日') order_exam_time,concat(year(ifnull(o.order_exam_time,now()))-year(ac.cust_birthday), '岁') cust_age,ifnull(o.order_photo_addr,acx.cust_photo_addr)order_photo_addr from biz_order o join arch_customer ac on ac.id = o.cust_id join biz_order_health_card oc on o.id = oc.order_id join com_classify_item cci on cci.id = o.order_exam_type_id join com_classify_item cci2 on cci2.id = ac.cust_sex_id join arch_customer_x acx on ac.id = acx.id where o.id =?",
"result_type": "row_array",
"query_where_fields": [
"order_id"
],
"columns": [
{
"label": "订单号",
"key": "order_code",
"type": "1",
"width": "",
"height": "",
"data_type": "setValue",
"data_cate": "value"
},
{
"label": "姓名",
"key": "cust_name",
"type": "1",
"width": "",
"height": "",
"data_type": "setValue",
"data_cate": "value"
},
{
"label": "条码",
"key": "order_code",
"type": "3",
"width": "120",
"height": "50",
"data_type": "setValue",
"data_cate": "value"
},
{
"label": "头像照片",
"key": "order_photo_addr",
"type": "2",
"width": "120",
"height": "50",
"data_type": "setValue",
"data_cate": "value"
}
]
},
{
"description": "测试图表类型",
"query": "select count(*) c, date(order_register_date) order_register_date from biz_order where order_exam_time is not null group by date(order_register_date)",
"result_type": "result_array",
"query_where_fields": [],
"columns": [
{
"label": "日登记报表",
"key": "order_register_date",
"type": "5",
"width": "",
"height": "",
"data_type": "setValue",
"data_cate": "value",
"children": {
"categories_column": "order_register_date",
"series_column": [
{
"label": "人数",
"key": "c"
}
]
}
}
]
},
{
"description": "测试文本快",
"query": "select * from arch_customer limit 3",
"result_type": "result_array",
"query_where_fields": [],
"columns": [
{
"label": "个人信息",
"key": "id",
"type": "1",
"width": "",
"height": "",
"data_type": "TxtBlock",
"data_cate": "value",
"children": [
{
"label": "姓名",
"key": "cust_name"
},
{
"label": "性别",
"key": "cust_sex_code"
}
]
}
]
},
{
"description": "测试文本行",
"query": "select * from dict_exam_dept limit 10",
"result_type": "result_array",
"query_where_fields": [],
"columns": [
{
"label": "科室",
"key": "id",
"type": "1",
"width": "",
"height": "",
"data_type": "RowBlock",
"data_cate": "value",
"children": [
{
"label": "科室",
"key": "exam_dept_name"
},
{
"label": "地址",
"key": "exam_dept_code"
}
]
}
]
},
{
"description": "测试图片行",
"query": "select id,order_photo_addr from biz_order where order_photo_addr != ''",
"result_type": "result_array",
"query_where_fields": [],
"columns": [
{
"label": "头像列表",
"key": "order_photo_addr",
"searchName": "头像",
"type": "1",
"width": "250",
"height": "300",
"data_type": "RowImage",
"data_cate": "value"
}
]
},
{
"description": "测试复杂块",
"query": "select a.union_id,a.union_name,b.item_name,a.union_examiner_time,union_summary,b.item_summary from biz_order_package_union a join biz_order_package_item b on a.order_id = b.order_id and a.id = b.order_pkg_union_id where a.order_id = ?",
"result_type": "result_array",
"query_where_fields": [
"order_id"
],
"columns": [
{
"label": "体检结果类型1",
"key": "id",
"type": "",
"width": "",
"hight": "",
"data_type": "ComplexBlock",
"index_key" : "union_id",
"children": {
"columns": [
{
"label": "组合名称",
"key": "union_name",
"type": "1",
"width": "",
"hight": "",
"data_cate": "value"
},
{
"label": "组合名称",
"key": "union_name",
"type": "1",
"width": "",
"hight": "",
"data_cate": "list_data",
"cycle_flag": true,
"times": 2,
"children": [
{
"label": "item",
"key": "item_name",
"type": "1",
"width": "",
"hight": "",
"data_cate": "value"
},
{
"label": "result",
"key": "item_summary",
"type": "1",
"width": "",
"hight": "",
"data_cate": "value"
}
]
},
{
"label": "体检结果",
"key": "union_summary",
"type": "1",
"width": "",
"hight": "",
"data_cate": "value"
},
{
"label": "体检时间",
"key": "union_examiner_time",
"type": "1",
"width": "",
"hight": "",
"data_cate": "value"
}
]
}
}
]
}
]
- 字段说明
description描述 可不填 完全是给自己标示用
query需要执行的sql 若需要绑定参数 请用 ? 绑定
query_where_fields替换 绑定的参数 若为空 则不替换
result_typequery 的返回类型 row_array/result_array 一行/多行
columns列配置
label模板里面的字段名
key查询出来的字段名
type1 文字 2 图片 3 条形码 4 富文本 5 图表
heightwidth当type 为 2 3 时需要设置
data_type数据类型 setValue(文本)/TxtBlock(文本块)/RowImage(图片行)/RowBlock(行块)/ComplexBlock(复杂块)
index_key索引 date_type 为复杂块时需要设置 用于合并一类数据时 其他时候可无
children子列表 date_type 为行块/文本块/复杂块时需要设置 其他时候可无
data_cate数据分类 value /list_data 当为list_data时需要设置children
cycle_flag循环标志 ture/false true 时需要配置times进行配合 循环多行内容到一行times循环次数
使用说明
使用前需将
wwwroot/manager/upload/phpword_template目录下defalut_*.docx复制到文件服务器word_template目录下方能使用