Commit c7bae128 authored by 卜远杰's avatar 卜远杰

报表

parent 83761dbc
......@@ -76,11 +76,11 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/reportForm/list')" method="post">
<form id="seachTableForm" action="#springUrl('/a/reportForm/exportExcel')" method="get">
<div class="col-xs-2" >
<input type="text" class="form-control "
id="pharmacist" name="pharmacist" placeholder="药师名称">
id="pharmaName" name="pharmaName" placeholder="药师名称">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control "
......@@ -88,21 +88,21 @@
</div>
<div class="col-xs-2" >
<input type="text" class="form-control "
id="number" name="number" placeholder="订单号">
id="doctorName" name="doctorName" placeholder="医生名称">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control "
id="logisticsCode" name="logisticsCode" placeholder="物流单号">
id="orderCode" name="orderCode" placeholder="订单编码">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control "
id="waybillNumber" name="waybillNumber" placeholder="物流单号">
</div>
<button type="button" class="search btn btn-primary" style="margin-left: 20px">搜索</button>
#if($shiro.hasPermission("qy:reportForm:edit"))
<a href="#springUrl('/a/reportForm/exportExcel')" class="btn btn-primary" style="margin-left: 20px">导出</a>
<button type="submit" class="btn btn-primary">导出</button>
#end
<!-- -->
<!-- <a href="#springUrl('/a/reportForm/form')" class="btn btn-primary">新增</a>-->
<!-- -->
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
<!-- -->
</form>
</div><!-- /.box-header -->
......@@ -110,14 +110,22 @@
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td>
<th>咨询单编码</th>
<th>订单编码</th>
<th>顺风编码</th>
<th>物流编码</th>
<th>战区</th>
<th></th>
<th></th>
<th>医院名称</th>
<th>药师名称</th>
<th>客服名称</th>
<th>订单编号</th>
<th>订单金额</th>
<th>咨询单号</th>
<th>物流单号</th>
<th>物流状态</th>
<th>医生名称</th>
<th>咨询人openId</th>
<th>咨询人姓名</th>
<th>性别</th>
<th>咨询人手机号码</th>
</tr>
</thead>
<tbody id="tablebody">
......@@ -215,75 +223,67 @@
"pagingType": "full_numbers",
"aoColumns": [
{
"mData": "pharmacist"
"mData":"id"
},
{
"mData": "customerName"
"mData": "consultId"
},
{
"mData": "number"
}
,
"mData": "orderCode"
},
{
"mData": "orderAmount"
"mData": "courierNumber"
}
,
{
"mData": "numberCode"
"mData": "waybillNumber"
}
,
{
"mData": "logisticsCode"
"mData": "warZone"
}
,
{
"mData": "logisticsStatus"
"mData": "provinceName"
}
],
"aoColumnDefs": [
,
{
"aTargets": [0],
"mData": "pharmacist",
"mRender": function (a, b, c, d) {
return a;
}
"mData": "cityName"
},{
"aTargets": [1],
"mData": "customerName",
"mRender": function (a, b, c, d) {
return a;
}
"mData":"hospital"
},{
"aTargets": [2],
"mData": "number",
"mRender": function (a, b, c, d) {
return a;
}
"mData":"pharmaName"
},{
"aTargets": [3],
"mData": "orderAmount",
"mRender": function (a, b, c, d) {
return a;
}
"mData":"customerName"
},{
"aTargets": [4],
"mData": "numberCode",
"mRender": function (a, b, c, d) {
return a;
}
"mData":"doctorName"
},{
"aTargets": [5],
"mData": "logisticsCode",
"mRender": function (a, b, c, d) {
return a;
}
"mData":"openId"
},{
"mData":"userName"
},{
"aTargets": [6],
"mData": "logisticsStatus",
"mData":"sex"
},{
"mData":"phone"
}
],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets": [14],
"mData": "id",
"mRender": function (a, b, c, d) {
return a;
if(a == 1){
return "男";
}else if(a == 0){
return "女"
}else{
return "";
}
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cftech</groupId>
<artifactId>reportform-module</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cftech</groupId>
<artifactId>reportform-module</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
......@@ -2,6 +2,10 @@ package com.cftech.reportform.dao;
import com.cftech.reportform.model.ReportForm;
import com.cftech.core.generic.GenericDao;
import com.cftech.reportform.model.ReportFormDetail;
import java.util.List;
import java.util.Map;
/**
* 报表管理Mapper
......@@ -11,4 +15,13 @@ import com.cftech.core.generic.GenericDao;
*/
public interface ReportFormMapper extends GenericDao<ReportForm> {
/**
* 查询报表
* @param params
* @return
*/
List<ReportFormDetail> selectReportDetail(Map<String,Object> params);
}
\ No newline at end of file
......@@ -14,6 +14,31 @@
<result column="update_by" property="updateBy"/>
</resultMap>
<resultMap id="resultMapDetail" type="com.cftech.reportform.model.ReportFormDetail">
<id column="id" property="id"/>
<result column="consultId" property="consultId"/>
<result column="userName" property="userName"/>
<result column="sex" property="sex"/>
<result column="phone" property="phone"/>
<result column="pastRecords" property="pastRecords"/>
<result column="doctorId" property="doctorId"/>
<result column="serviceId" property="serviceId"/>
<result column="openId" property="openId"/>
<result column="drugsId" property="drugsId"/>
<result column="orderId" property="orderId"/>
<result column="pharmaName" property="pharmaName"/>
<result column="customerName" property="customerName"/>
<result column="orderCode" property="orderCode"/>
<result column="allergy" property="allergy"/>
<result column="hospital" property="hospital"/>
<result column="cityName" property="cityName"/>
<result column="provinceName" property="provinceName"/>
<result column="warZone" property="warZone"/>
<result column="courierNumber" property="courierNumber"/>
<result column="waybillNumber" property="waybillNumber"/>
<result column="doctorName" property="doctorName" />
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
......@@ -79,12 +104,20 @@ c.consult_id AS numberCode
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_order o
LEFT JOIN t_qyuser t ON t.id = o.service_id
LEFT JOIN t_qyuser q ON q.id = o.doctor_id
LEFT JOIN t_aidea_consult_sheet c ON c.order_id = o.id
SELECT
COUNT(1)
FROM
t_aidea_consult_sheet a
LEFT JOIN t_order o ON a.order_id = o.id
LEFT JOIN t_qyuser b ON b.id = a.doctor_id
LEFT JOIN t_qyuser c ON c.id = a.service_id
LEFT JOIN t_qyuser v ON v.id = a.past_records
LEFT JOIN t_orgunit g ON g.id = a.allergy
LEFT JOIN t_orgunit k ON g.parent_id = k.id
LEFT JOIN t_orgunit l ON k.parent_id = l.id
LEFT JOIN t_orgunit m ON l.parent_id = m.id
LEFT JOIN t_aidea_waybill w ON w.waybill_no = o.courier_number
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
......@@ -99,6 +132,46 @@ c.consult_id AS numberCode
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<select id="selectReportDetail" parameterType="java.util.Map" resultMap="resultMapDetail">
SELECT
a.id id,
a.consult_id consultId,
CONVERT ( AES_DECRYPT( a.user_name, 'aideakey' ) USING UTF8 ) userName,
a.sex,
CONVERT ( AES_DECRYPT( a.phone, 'aideakey' ) USING UTF8 ) phone,
a.past_records pastRecords,
a.doctor_id doctorId,
a.service_id serviceId,
a.open_id openId,
a.drugs_id drugsId,
a.order_id orderId,
b.`name` pharmaName,
c.`name` customerName,
o.number orderCode,
a.allergy allergy,
g.org_name hospital,
k.org_name cityName,
l.org_name provinceName,
m.org_name warZone,
o.courier_number courierNumber,
w.number waybillNumber,
v.`name` doctorName
FROM
t_aidea_consult_sheet a
LEFT JOIN t_order o ON a.order_id = o.id
LEFT JOIN t_qyuser b ON b.id = a.doctor_id
LEFT JOIN t_qyuser c ON c.id = a.service_id
LEFT JOIN t_qyuser v ON v.id = a.past_records
LEFT JOIN t_orgunit g ON g.id = a.allergy
LEFT JOIN t_orgunit k ON g.parent_id = k.id
LEFT JOIN t_orgunit l ON k.parent_id = l.id
LEFT JOIN t_orgunit m ON l.parent_id = m.id
LEFT JOIN t_aidea_waybill w ON w.waybill_no = o.courier_number
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.reportform.model.ReportForm">
update t_order
<set>
......
package com.cftech.reportform.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
/**
* 报表信息实体类
* @author BuYJ
*/
@Data
public class ReportFormDetail {
/**
* 咨询单ID
*/
private String id;
/**
* 咨询单编码 1
*/
@ExportConfig(value = "咨询单编码", width = 100, showLevel = 1)
private String consultId;
/**
* 订单编码 2
*/
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode;
/**
* 顺风编码 3
*/
@ExportConfig(value = "顺风编码", width = 100, showLevel = 1)
private String courierNumber;
/**
* 物流编码 4
*/
@ExportConfig(value = "物流编码", width = 100, showLevel = 1)
private String waybillNumber;
/**
* 战区 5
*/
@ExportConfig(value = "战区", width = 100, showLevel = 1)
private String warZone;
/**
* 省 6
*/
@ExportConfig(value = "省", width = 100, showLevel = 1)
private String provinceName;
/**
* 市 7
*/
@ExportConfig(value = "市", width = 100, showLevel = 1)
private String cityName;
/**
* 医院名称 8
*/
@ExportConfig(value = "医院名称", width = 100, showLevel = 1)
private String hospital;
/**
* 药师名称 9
*/
@ExportConfig(value = "药师名称", width = 100, showLevel = 1)
private String pharmaName;
/**
* 客服名称 10
*/
@ExportConfig(value = "客服名称", width = 100, showLevel = 1)
private String customerName;
/**
* 医生名称 11
*/
@ExportConfig(value = "医生名称", width = 100, showLevel = 1)
private String doctorName;
/**
* 咨询人openId 12
*/
@ExportConfig(value = "咨询人openId", width = 100, showLevel = 1)
private String openId;
/**
* 咨询人姓名 13
*/
@ExportConfig(value = "咨询人姓名", width = 100, showLevel = 1)
private String userName;
/**
* 性别 14
*/
@ExportConfig(value = "性别", width = 100, showLevel = 1)
private String sex;
/**
* 咨询人手机号码 15
*/
@ExportConfig(value = "咨询人手机号码", width = 100, showLevel = 1)
private String phone;
/**
* 处方医院ID
*/
private String pastRecords;
/**
* 医生ID
*/
private String doctorId;
/**
* 客户ID
*/
private String serviceId;
/**
* 咨询药品ID
*/
private String drugsId;
/**
* 订单ID
*/
private String orderId;
/**
* 处方医院ID
*/
private String allergy;
}
package com.cftech.reportform.service;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.reportform.model.ReportForm;
import com.cftech.core.generic.GenericService;
import com.cftech.reportform.model.ReportFormDetail;
import java.util.List;
import java.util.Map;
/**
* 报表管理Service
*
......@@ -10,5 +17,15 @@ import com.cftech.core.generic.GenericService;
*/
public interface ReportFormService extends GenericService<ReportForm> {
/**
* 查询报表
* @param conds
* @param sort
* @param page
* @param pageSize
* @return
*/
List<ReportFormDetail> selectReportDetail(Conds conds, Sort sort, int page, int pageSize);
}
package com.cftech.reportform.service.impl;
import com.cftech.core.sql.Sort;
import com.cftech.reportform.model.ReportForm;
import com.cftech.reportform.dao.ReportFormMapper;
import com.cftech.reportform.model.ReportFormDetail;
import com.cftech.reportform.service.ReportFormService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
......@@ -10,22 +12,35 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 报表管理ServiceImpl
*
* @author Licc
* @date: 2020-10-16 14:33
*/
* 报表管理ServiceImpl
*
* @author Licc
* @date: 2020-10-16 14:33
*/
@Service("reportFormService")
public class ReportFormServiceImpl extends GenericServiceImpl<ReportForm> implements ReportFormService {
@Autowired
@Qualifier("reportFormMapper")
private ReportFormMapper reportFormMapper;
@Autowired
@Qualifier("reportFormMapper")
private ReportFormMapper reportFormMapper;
@Override
public GenericDao<ReportForm> getGenericMapper() {
return reportFormMapper;
}
@Override
public GenericDao<ReportForm> getGenericMapper() {
return reportFormMapper;
}
@Override
public List<ReportFormDetail> selectReportDetail(Conds conds, Sort sort, int page, int pageSize) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("conds", conds);
params.put("offset", page > 0 ? page : 0);
params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort);
return reportFormMapper.selectReportDetail(params);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.cftech.reportform.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.reportform.model.ReportForm;
import com.cftech.reportform.model.ReportFormDetail;
import com.cftech.reportform.service.ReportFormService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
......@@ -69,53 +70,34 @@ public class ReportFormController {
return "reportForm/reportFormform";
}
// //提交数据(新增、修改)
// @RequiresPermissions(value = REPORTFORM_EDIT)
// @RequestMapping("/formData")
// @ResponseBody
// public JSONObject formData(ReportForm reportForm, Model model, HttpServletRequest request) {
// Long accountsId = UserUtils.getmpaccounts(request);
// JSONObject rtnJson = new JSONObject();
// try {
// if (reportForm != null && reportForm.getId() != null) {
// reportForm.setUpdateBy(UserUtils.getUser().getId());
// reportFormService.update(reportForm);
// rtnJson.put("errorNo", 0);
// } else {
// reportForm.setAccountsId(accountsId);
// reportForm.setDelFlag(false);
// reportForm.setAccountsId(UserUtils.getmpaccounts(request));
// reportForm.setCreateBy(UserUtils.getUser().getId());
// reportForm.setUpdateBy(UserUtils.getUser().getId());
// reportFormService.save(reportForm);
// rtnJson.put("errorNo", 2);
// }
// } catch (Exception e) {
// rtnJson.put("errorNo", 1);
// }
// return rtnJson;
// }
//获取列表数据
@RequiresPermissions(value = REPORTFORM_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ReportForm reportForm, HttpServletRequest request) {
public JSONObject listData(int iDisplayStart, int iDisplayLength, ReportFormDetail reportFormDetail, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("o.del_flag", Constants.DEL_FLAG_0);
conds.equal("o.accounts_id", accountsId);
if (!org.apache.commons.lang3.StringUtils.isEmpty(reportForm.getCustomerName())) {
conds.like("t.`name`", reportForm.getCustomerName());
conds.equal("a.del_flag", Constants.DEL_FLAG_0);
conds.equal("a.accounts_id", accountsId);
if (!StringUtils.isEmpty(reportFormDetail.getPharmaName())){
conds.like("b.`name`",reportFormDetail.getPharmaName());
}
if (!StringUtils.isEmpty(reportFormDetail.getCustomerName())){
conds.like("c.`name`",reportFormDetail.getCustomerName());
}
if (!StringUtils.isEmpty(reportFormDetail.getOrderCode())){
conds.equal("o.number",reportFormDetail.getOrderCode());
}
if (!org.apache.commons.lang3.StringUtils.isEmpty(reportForm.getPharmacist())) {
conds.like("q.`name`", reportForm.getPharmacist());
if (!StringUtils.isEmpty(reportFormDetail.getWaybillNumber())){
conds.equal("w.number",reportFormDetail.getWaybillNumber());
}
if (!org.apache.commons.lang3.StringUtils.isEmpty(reportForm.getNumber())) {
conds.like("o.number", reportForm.getNumber());
if (!StringUtils.isEmpty(reportFormDetail.getDoctorName())){
conds.like("v.`name`",reportFormDetail.getDoctorName());
}
Sort sort = new Sort("o.create_time", OrderType.DESC);
List<ReportForm> list = reportFormService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Sort sort = new Sort("a.create_time", OrderType.DESC);
List<ReportFormDetail> list = reportFormService.selectReportDetail(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = reportFormService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
......@@ -141,13 +123,32 @@ public class ReportFormController {
@RequestMapping("/exportExcel")
@RequiresPermissions(value = REPORTFORM_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
public void exportExcel(HttpServletRequest request, HttpServletResponse response,ReportFormDetail reportFormDetail) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("o.del_flag", 0);
conds.equal("o.accounts_id", accountId);
List<ReportForm> list = reportFormService.fetchSearchByPage(conds, null, 0, 0);
ExcelKit.$Export(ReportForm.class, response).toExcel(list, "报表管理信息");
conds.equal("a.del_flag", Constants.DEL_FLAG_0);
conds.equal("a.accounts_id", accountsId);
if (!StringUtils.isEmpty(reportFormDetail.getPharmaName())){
conds.like("b.`name`",reportFormDetail.getPharmaName());
}
if (!StringUtils.isEmpty(reportFormDetail.getCustomerName())){
conds.like("c.`name`",reportFormDetail.getCustomerName());
}
if (!StringUtils.isEmpty(reportFormDetail.getOrderCode())){
conds.equal("o.number",reportFormDetail.getOrderCode());
}
if (!StringUtils.isEmpty(reportFormDetail.getWaybillNumber())){
conds.equal("w.number",reportFormDetail.getWaybillNumber());
}
if (!StringUtils.isEmpty(reportFormDetail.getDoctorName())){
conds.like("v.`name`",reportFormDetail.getDoctorName());
}
Sort sort = new Sort("a.create_time", OrderType.DESC);
List<ReportFormDetail> list = reportFormService.selectReportDetail(conds, sort, 0, 0);
for (ReportFormDetail obj : list) {
obj.setSex(StringUtils.isEmpty(obj.getSex()) ? "" : obj.getSex().equals("1") ? "男":"女");
}
ExcelKit.$Export(ReportFormDetail.class, response).toExcel(list, "报表管理信息");
}
@RequestMapping("/templateExcel")
......
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