From 5f4847d23506f10f76bc5ba493880bb3b87df12c Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期四, 12 十二月 2024 18:55:15 +0800 Subject: [PATCH] zjh202412012 --- ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 200 insertions(+), 22 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..ab50501 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,11 @@ import java.util.Map; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ltkj.hosp.domain.LtkjJianchajianyanTree; +import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.domain.TjOrder; +import com.ltkj.hosp.vodomain.LineChartsVo; +import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -81,29 +85,57 @@ 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" + - " 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(); + " sum(if(c.tj_type='1', ifnull(c.coun,0),0)) as tdcoun,\n" + + " sum(if(c.tj_type='2', ifnull(c.coun,0),0)) as grcoun,\n" + + " sum(if(c.tj_type='3', 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 deleted=0 AND tj_type=2 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + + " group by date_format(create_time, '%Y-%m-%d')\t\n" + + "\t\t\t\tunion\n" + + " select date_format(create_time, '%Y-%m-%d') dat,tj_type, count(*) coun\n" + + " from tj_order where deleted=0 AND tj_type=1 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + + " group by date_format(create_time, '%Y-%m-%d')\t\t\t\t\t\n" + + "\t\t\t\tunion\n" + + " select date_format(create_time, '%Y-%m-%d') dat, 3 tj_type, count(*) coun\n" + + " from tj_order where deleted=0 AND !ISNULL(report_time) AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)\n" + + " group by date_format(create_time, '%Y-%m-%d')\n" + + " ) c on c.dat =aa.date\n" + + " group by aa.date") + List<LineChartsVo> getLine(); @Select("SELECT * FROM tj_order WHERE tj_number RLIKE #{tjNum} AND deleted='0' ORDER BY create_time DESC") @@ -115,6 +147,9 @@ @Select("SELECT * FROM tj_order WHERE tj_number = #{tjNum} AND deleted='0' ") public TjOrder getOrderByTjNum(String tjNum); + + @Select("SELECT * FROM tj_order WHERE card_id = #{cardId} AND deleted='0' ") + public TjOrder getOrderByCardId(String cardId); List<TjOrder> getTjOrderList(@Param("tjNum")String tjNum, @Param("checkStatus")Integer checkStatus, @@ -150,4 +185,147 @@ @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); + + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} AND a.type='妫�鏌�' GROUP BY a.sqdh") + List<String> getHuoQuJcsqdh(String cardId); + @Delete("DELETE FROM ltkj_jianchajianyan_tree WHERE card_id=#{cardId} AND type='妫�鏌�'") + Boolean delHuoQuJcsqdh(String cardId); + + + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} AND a.type='妫�楠�' GROUP BY a.sqdh") + List<String> getHuoQuJysqdh(String cardId); + + + + @Delete("DELETE FROM ltkj_jianchajianyan_tree WHERE card_id=#{cardId} AND type='妫�楠�'") + Boolean delHuoQuJysqdh(String cardId); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} AND a.type='澶勭疆' GROUP BY a.sqdh") + List<String> getHuoQuZlsqdh(String cardId); + @Delete("DELETE FROM ltkj_jianchajianyan_tree WHERE card_id=#{cardId} AND type='澶勭疆'") + Boolean delHuoQuZlsqdha(String cardId); + + + List<Map<String, Object>> getTjTongJiJieKou(Map<String, Object> map); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} and a.jxbz=#{bldh} AND a.type='妫�鏌�' GROUP BY a.sqdh") + List<String> getHuoQuBlJcsqdh(@Param("cardId") String cardId,@Param("bldh") String bldh); + @Delete("DELETE FROM ltkj_jianchajianyan_tree WHERE card_id=#{cardId} and jxbz=#{bldh} AND type='妫�鏌�'") + Boolean delHuoQuBlJcsqdh(@Param("cardId")String cardId, @Param("bldh")String bldh); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} and a.jxbz=#{bldh} AND a.type='妫�楠�' GROUP BY a.sqdh") + List<String> getHuoQuBlJysqdh(@Param("cardId")String cardId,@Param("bldh") String bldh); + @Delete("DELETE FROM ltkj_jianchajianyan_tree WHERE card_id=#{cardId} and jxbz=#{bldh} AND type='妫�楠�'") + Boolean delHuoQuBlJysqdh(@Param("cardId")String cardId,@Param("bldh") String bldh); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} and a.jxbz=#{bldh} AND a.type='澶勭疆' GROUP BY a.sqdh") + List<String> getHuoQuBlZlsqdh(@Param("cardId")String cardId,@Param("bldh") String bldh); + @Delete("DELETE FROM ltkj_jianchajianyan_tree WHERE card_id=#{cardId} and jxbz=#{bldh} AND type='澶勭疆'") + Boolean delHuoQuZlsqdh(@Param("cardId")String cardId,@Param("bldh") String bldh); + + + List<List<?>> getgetBghsList(Map<String,Object> map); + + + @Select({"<script>","SELECT * FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} AND a.jxbz IN ","<foreach collection='bldh' item='id' open='(' separator=',' close=')'>", + "#{id}", + "</foreach>", + "</script>" }) + List<LtkjJianchajianyanTree> getBuLuXmXinXi(@Param("bldh") List<String> bldh,@Param("cardId")String cardId); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} and a.jxbz=#{bldh} AND a.type='妫�鏌�' AND a.service = 'pacs' GROUP BY a.sqdh") + List<String> getBlJcsqdhByPacsAndBldh(@Param("cardId") String cardId,@Param("bldh") String bldh); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} and a.jxbz=#{bldh} AND a.type='妫�楠�' AND a.service = 'lis' GROUP BY a.sqdh") + List<String> getBlJysqdhByLisAndBldh(@Param("cardId") String cardId,@Param("bldh") String bldh); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} AND a.type='妫�鏌�' AND a.service = 'pacs' GROUP BY a.sqdh") + List<String> getBlJcsqdhByPacs(String cardId); + + @Select("SELECT a.sqdh FROM ltkj_jianchajianyan_tree a WHERE a.card_id=#{cardId} AND a.type='妫�楠�' AND a.service = 'lis' GROUP BY a.sqdh") + List<String> getBlJysqdhByLis(String cardId); + + + @Select("SELECT\n" + + " DISTINCT a.tj_number \n" + + "FROM\n" + + " tj_order_remark a\n" + + " JOIN sys_dept b ON b.dept_id = a.dept_id \n" + + "WHERE\n" + + " a.deleted = 0 \n" + + " AND b.org_type = 1 \n" + + " AND a.type !=1") + List<String> getDingShiTongBuJianYanTjNum(); + + + @Select(" SELECT\n" + + " DISTINCT a.tj_number \n" + + "FROM\n" + + " tj_order_remark a\n" + + " JOIN sys_dept b ON b.dept_id = a.dept_id \n" + + "WHERE\n" + + " a.deleted = 0 \n" + + " AND b.org_type = 2 \n" + + " AND a.type !=1") + List<String> getDingShiTongBuJianChaTjNum(); + + + + + void tjQiandaodengji(Map<String,Object> map); + + void tjLispacstongbujianyi(Map<String, Object> map); } -- Gitblit v1.8.0