From ee251679ac9031b7dd4cc0c4ddc0934e3e466e3f Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期二, 28 五月 2024 18:04:49 +0800 Subject: [PATCH] 添加根据查询条件查集合长度 --- ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java | 79 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 1 deletions(-) diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java index a3a5d06..6f92c49 100644 --- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java +++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java @@ -5,7 +5,9 @@ import java.util.Map; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.domain.TjOrder; +import com.ltkj.hosp.vodomain.LineChartsVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -81,6 +83,30 @@ List<TjOrder> getOrderList1(); +// @Select("select aa.date,\n" + +// " sum(if(c.tj_type='鍥㈤槦', ifnull(c.coun,0),0)) as tdcoun,\n" + +// " sum(if(c.tj_type='涓汉', ifnull(c.coun,0),0)) as grcoun,\n" + +// " sum(if(c.tj_type='鎶ュ憡', ifnull(c.coun,0),0)) as bgcoun \n" + +// " from (\n" + +// " SELECT date_sub(CURDATE(),interval @i:=@i+1 day) as date\n" + +// " from (select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + +// " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + +// " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + +// " select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all select 1 union all \n" + +// " select 1 union all select 1) as a,\n" + +// " (select @i:= -1) b) aa \n" + +// " left join (\n" + +// " select date_format(create_time, '%Y-%m-%d') dat, tj_type, count(*) coun\n" + +// " from tj_order where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + +// " group by date_format(create_time, '%Y-%m-%d'),tj_type\n" + +// " union\n" + +// " select date_format(report_time, '%Y-%m-%d') dat, '鎶ュ憡' tj_type, count(*) coun\n" + +// " from tj_order where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + +// " group by date_format(report_time, '%Y-%m-%d')\n" + +// " ) c on c.dat =aa.date\n" + +// "group by aa.date") +// List<Map<Object, Object>> getLine(); + @Select("select aa.date,\n" + " sum(if(c.tj_type='鍥㈤槦', ifnull(c.coun,0),0)) as tdcoun,\n" + " sum(if(c.tj_type='涓汉', ifnull(c.coun,0),0)) as grcoun,\n" + @@ -103,7 +129,7 @@ " group by date_format(report_time, '%Y-%m-%d')\n" + " ) c on c.dat =aa.date\n" + "group by aa.date") - List<Map<Object, Object>> getLine(); + List<LineChartsVo> getLine(); @Select("SELECT * FROM tj_order WHERE tj_number RLIKE #{tjNum} AND deleted='0' ORDER BY create_time DESC") @@ -150,4 +176,55 @@ @Select("SELECT * FROM tj_order WHERE deleted='0' and user_id = #{userId} AND !ISNULL(finish_time) " + "and !ISNULL(confirm_time) ") List<TjOrder> getCsTjOrderListByCusId1(Long userId); + + + @Select("SELECT GROUP_CONCAT( DISTINCT b.pro_name SEPARATOR ';' ) aa FROM tj_order_remark a" + + " LEFT JOIN tj_project b ON a.pro_id=b.pro_id WHERE a.deleted=0 AND a.tj_number= #{tjNum} AND a.type !=2") + String getHistoryTjOrderProByTjNum(String tjNum); + + + @Select("SELECT * FROM tj_order WHERE deleted='0' and user_id =#{userId}" + + " AND !ISNULL(finish_time) ORDER BY create_time DESC LIMIT 1") + TjOrder getLastTjOrderListByCusId(Long userId); + + + //瀛樺偍杩囩▼涓撶敤鎺ュ彛(鎬绘) + List<List<?>> getCunChuGuoChengCustomerList(Map<String,Object> map); + + + //瀛樺偍杩囩▼涓撶敤鎺ュ彛(鍒濆) + List<List<?>> getCsCunChuGuoChengCustomerList(Map<String,Object> map); + + + @Select("SELECT count(*) FROM tj_order a WHERE a.deleted=0 and a.card_id=#{cardId}") + int selectTjOrderByCardId(String cardId); + + + @Select("SELECT a.card_id FROM tj_order a WHERE a.deleted=0") + List<String> selectTjOrderByCardId1(); + + + @Select("SELECT a.order_id FROM tj_order_detail a WHERE a.order_id=#{orderId} AND !ISNULL(a.flowing_water_id) GROUP BY a.order_id ") + String isPayByTjNum(String orderId); + + /** + * 鏌ヨ瀵兼鍗曡鎯� + * @param tjNumber 浣撴鍗曞彿 + * @return + */ + @Select("SELECT @num := @num + 1 AS xh, d.dept_name ksmc, d.official_web ksdz, e.tjxm FROM sys_dept d JOIN ( select aa.ksmc,GROUP_CONCAT( DISTINCT aa.pro_name ORDER BY aa.pro_name DESC SEPARATOR ';' ) tjxm from ( SELECT (case when f.ksmc in ('涓存瀹�','鍖栭獙瀹�','','') or c.pro_name like '%娴嬪畾%' then '妫�楠岀' when c.pro_name like '%蹇冪數鍥�%' then '蹇冪數鍥惧' when f.ksmc='x鍏夊' or c.pro_name like '%X绾挎憚褰�%' then '鏀惧皠绉�' when c.pro_name like '%鑹茶%' then '鐪肩' \t\t\t\twhen c.pro_name like '%瓒�%' or c.pro_name like '%澶氭櫘鍕�%' then 'B瓒呭' when (replace(f.ksmc,' ','')='' or f.ksmc is null) and c.dept_id<>'100' then d.dept_name when c.pro_name like '%CT%' then 'CT瀹�' else '浣撴涓績' end ) ksmc, c.pro_name FROM tj_order a JOIN tj_order_detail b ON b.order_id = a.order_id JOIN tj_project c ON c.pro_id = b.pro_id left join his_mxfyxm e on e.mxfyxmbm=c.his_xmbm left join ltkj_his_dept f on f.ksbm = CONCAT('00',(case when e.hsks is null then '' else e.hsks end)) join sys_dept d on d.dept_id=c.dept_id WHERE a.tj_number = #{tjNumber} ) aa GROUP BY ksmc ) e ON e.ksmc = d.dept_name , (SELECT @num := 0) a WHERE d.parent_id = '100' ORDER BY xh") + List<Map<String ,String >> selectDjdInfo(@Param("tjNumber")String tjNumber); + + /** + * 鏌ヨ瀵兼鍗曠敤鎴蜂俊鎭� + * @param tjNumber + * @return + */ + @Select("select c.tj_number tjh,a.cus_name tjname, b.dict_label sex,a.create_time tjsj,ifnull(d.cn_name,'') dwmc,a.cus_phone lxdh\n" + + "from tj_order c \n" + + " join tj_customer a on a.cus_id= c.user_id \n" + + " join (select dict_value,dict_label from sys_dict_data where dict_type='sys_user_sex') b on b.dict_value = a.cus_sex\n" + + " left join dict_comp d on d.drug_manufacturer_id = c.firm_id\n" + + "where c.tj_number=#{tjNumber}") + Map<String ,Object > selectDjdUserInfo(@Param("tjNumber")String tjNumber); } -- Gitblit v1.8.0