From 5a6a1ae4f22cae6323e41d35c5f32137afddd2d0 Mon Sep 17 00:00:00 2001
From: zjh <zjh@888>
Date: 星期三, 12 六月 2024 16:59:08 +0800
Subject: [PATCH] zjh 本地 2024/06/12 --1

---
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java |   99 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 98 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..ac41402 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,10 @@
 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.Delete;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -81,6 +84,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 +130,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 +177,74 @@
     @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.jcsqdh FROM ltkj_outpinexamapply a WHERE a.cardId=#{cardId}")
+    String getHuoQuJcsqdh(String cardId);
+    @Delete("DELETE FROM ltkj_outpinexamapply WHERE cardId=#{cardId}")
+    String delHuoQuJcsqdh(String cardId);
+
+
+
+    @Select("SELECT a.jysqdh FROM ltkj_outpintestapply a WHERE a.cardId=#{cardId} ")
+    String getHuoQuJysqdh(String cardId);
+    @Delete("DELETE FROM ltkj_outpintestapply WHERE cardId=#{cardId}")
+    String delHuoQuJysqdh(String cardId);
+
+    @Select("SELECT a.ylyzh FROM ltkj_Outpinmedapply a WHERE a.cardId=#{cardId}")
+    String getHuoQuZlsqdh(String cardId);
+
+    @Delete("DELETE FROM ltkj_Outpinmedapply WHERE cardId=#{cardId}")
+    String delHuoQuZlsqdh(String cardId);
 }

--
Gitblit v1.8.0