|
@@ -0,0 +1,443 @@
|
|
|
|
+package com.fs.store.mapper;
|
|
|
|
+
|
|
|
|
+import com.fs.common.annotation.DataSource;
|
|
|
|
+import com.fs.common.enums.DataSourceType;
|
|
|
|
+import com.fs.store.domain.FsInquiryOrder;
|
|
|
|
+import com.fs.store.domain.FsInquiryOrderMsg;
|
|
|
|
+import com.fs.store.domain.FsStoreOrderLogs;
|
|
|
|
+import com.fs.store.param.FsInquiryOrderListPDParam;
|
|
|
|
+import com.fs.store.param.FsInquiryOrderListUParam;
|
|
|
|
+import com.fs.store.param.FsInquiryOrderParam;
|
|
|
|
+import com.fs.store.vo.*;
|
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
|
+import org.apache.ibatis.annotations.Select;
|
|
|
|
+import org.springframework.stereotype.Repository;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 问诊订单Mapper接口
|
|
|
|
+ *
|
|
|
|
+ * @author fs
|
|
|
|
+ * @date 2023-06-12
|
|
|
|
+ */
|
|
|
|
+@Repository
|
|
|
|
+public interface FsInquiryOrderMapper
|
|
|
|
+{
|
|
|
|
+ /**
|
|
|
|
+ * 查询问诊订单
|
|
|
|
+ *
|
|
|
|
+ * @param orderId 问诊订单主键
|
|
|
|
+ * @return 问诊订单
|
|
|
|
+ */
|
|
|
|
+ public FsInquiryOrder selectFsInquiryOrderByOrderId(Long orderId);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询问诊订单列表
|
|
|
|
+ *
|
|
|
|
+ * @param fsInquiryOrder 问诊订单
|
|
|
|
+ * @return 问诊订单集合
|
|
|
|
+ */
|
|
|
|
+ public List<FsInquiryOrder> selectFsInquiryOrderList(FsInquiryOrder fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增问诊订单
|
|
|
|
+ *
|
|
|
|
+ * @param fsInquiryOrder 问诊订单
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ public int insertFsInquiryOrder(FsInquiryOrder fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改问诊订单
|
|
|
|
+ *
|
|
|
|
+ * @param fsInquiryOrder 问诊订单
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ public int updateFsInquiryOrder(FsInquiryOrder fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除问诊订单
|
|
|
|
+ *
|
|
|
|
+ * @param orderId 问诊订单主键
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ public int deleteFsInquiryOrderByOrderId(Long orderId);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量删除问诊订单
|
|
|
|
+ *
|
|
|
|
+ * @param orderIds 需要删除的数据主键集合
|
|
|
|
+ * @return 结果
|
|
|
|
+ */
|
|
|
|
+ public int deleteFsInquiryOrderByOrderIds(Long[] orderIds);
|
|
|
|
+
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select io.*,dc.doctor_name,dc.account as doctor_account,det.dept_name,c.company_name,cu.nick_name company_user_name ," +
|
|
|
|
+ "io.patient_json->>'$.patientName'as patient_name,syu.nick_name user_name" +
|
|
|
|
+ " from fs_inquiry_order io " +
|
|
|
|
+ " LEFT JOIN fs_doctor dc ON io.doctor_id =dc.doctor_id" +
|
|
|
|
+ " LEFT JOIN fs_department det ON det.dept_id =io.department_id " +
|
|
|
|
+ "LEFT JOIN sys_user syu ON syu.user_id =io.audit_user_id " +
|
|
|
|
+ " LEFT JOIN company c ON c.company_id= io.company_id " +
|
|
|
|
+ "LEFT JOIN company_user cu ON cu.user_id=io.company_user_id "+
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> LEFT JOIN fs_user fu ON fu.user_id=io.user_id</if>\n" +
|
|
|
|
+ " where 1=1 " +
|
|
|
|
+ " <if test=\"maps.orderSn != null and maps.orderSn != ''\"> and io.order_sn = #{maps.orderSn}</if>\n" +
|
|
|
|
+ " <if test=\"maps.title != null and maps.title != ''\"> and io.title = #{maps.title}</if>\n" +
|
|
|
|
+ " <if test=\"maps.userId != null \"> and io.user_id = #{maps.userId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorName != null \"> and dc.doctor_name like concat('%', #{maps.doctorName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientId != null \"> and io.patient_id = #{maps.patientId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientName != null \"> and io.patient_json like concat('%',#{maps.patientName},'%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.orderType != null \"> and io.order_type = #{maps.orderType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.payType != null \"> and io.pay_type = #{maps.payType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPay != null \"> and io.is_pay = #{maps.isPay}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorId != null \"> and io.doctor_id = #{maps.doctorId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.status != null \"> and io.status = #{maps.status}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sTime != null \"> and io.start_time >= DATE_FORMAT(#{maps.sTime},'%Y-%m-%d 00:00:00') </if>\n" +
|
|
|
|
+ " <if test=\"maps.eTime != null \"> and io.start_time <= DATE_FORMAT(#{maps.eTime},'%Y-%m-%d 23:59:59') </if>\n" +
|
|
|
|
+ " <if test=\"maps.fsTime != null \"> and io.finish_time >= DATE_FORMAT(#{maps.fsTime},'%Y-%m-%d 00:00:00') </if>\n" +
|
|
|
|
+ " <if test=\"maps.feTime != null \"> and io.finish_time <= DATE_FORMAT(#{maps.feTime},'%Y-%m-%d 23:59:59') </if>\n" +
|
|
|
|
+ " <if test=\"maps.isPing != null \"> and io.is_ping = #{maps.isPing}</if>\n" +
|
|
|
|
+ " <if test=\"maps.departmentId != null \"> and io.department_id = #{maps.departmentId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.inquiryType != null \"> and io.inquiry_type = #{maps.inquiryType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> and fu.phone = #{maps.phone}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyId != null \"> and io.company_id = #{maps.companyId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyUserId != null \"> and io.company_user_id = #{maps.companyUserId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyUserName != null \"> and cu.user_name = #{maps.companyUserName}</if>\n" +
|
|
|
|
+ " <if test=\"maps.inquirySubType != null \"> and io.inquiry_sub_type = #{maps.inquirySubType}</if>\n" +
|
|
|
|
+ " <if test = 'maps.createTimeList != null '> AND date_format(io.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d') AND date_format(io.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d') </if>" +
|
|
|
|
+ " <if test = 'maps.payTimeList != null '> AND date_format(io.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d') AND date_format(io.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d') </if>" +
|
|
|
|
+ " <if test = 'maps.deptId != null '> AND (io.dept_id = #{maps.deptId} OR io.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) </if>" +
|
|
|
|
+ " <if test = 'maps.inquirySubType != null '> and io.inquiry_sub_type =#{maps.inquirySubType} </if>" +
|
|
|
|
+ " <if test = 'maps.doctorAccount != null '> and dc.account =#{maps.doctorAccount} </if>" +
|
|
|
|
+ " <if test = 'maps.companyUserNickName != null and maps.companyUserNickName != \"\" '> and cu.nick_name like concat( #{maps.companyUserNickName}, '%') </if>" +
|
|
|
|
+ " order by io.order_id desc" +
|
|
|
|
+ "</script>"})
|
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
|
+ List<FsInquiryOrderListVO> selectFsInquiryOrderVOList(@Param("maps") FsInquiryOrderParam fsInquiryOrder);
|
|
|
|
+ @Select("select io.*,dc.doctor_name,det.dept_name,op.ping_star,op.ping_content, io.patient_json->>'$.patientName'as patient_name,syu.nick_name user_name,fuc.send_user_id,send.nick_name sendName from fs_inquiry_order io LEFT JOIN fs_doctor dc ON io.doctor_id =dc.doctor_id LEFT JOIN fs_department det ON det.dept_id =io.department_id LEFT JOIN fs_inquiry_order_ping op ON op.order_id=io.order_id LEFT JOIN sys_user syu ON syu.user_id =io.audit_user_id LEFT JOIN fs_user_coupon fuc ON io.user_coupon_id=fuc.id LEFT JOIN sys_user send ON send.user_id=fuc.send_user_id " +
|
|
|
|
+ " where io.order_id=#{orderId}")
|
|
|
|
+ FsInquiryOrderVO selectFsInquiryOrderVOByOrderId(Long orderId);
|
|
|
|
+
|
|
|
|
+ @Select("SELECT * FROM fs_inquiry_order_msg WHERE order_id =#{orderId}")
|
|
|
|
+ List<FsInquiryOrderMsg> selectFsInquiryOrderMsgByOrderId(Long orderId);
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select o.*,d.doctor_name,d.avatar,dt.dept_name from fs_inquiry_order o left join fs_doctor d on d.doctor_id=o.doctor_id LEFT JOIN fs_department dt ON d.dept_id =dt.dept_id " +
|
|
|
|
+ "where 1=1 " +
|
|
|
|
+ "<if test = 'maps.userId != null '> " +
|
|
|
|
+ "and o.user_id = #{maps.userId} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.companyUserId != null '> " +
|
|
|
|
+ "and o.company_user_id = #{maps.companyUserId} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.inquiryType != null and maps.inquiryType>0 '> " +
|
|
|
|
+ "and o.inquiry_type = #{maps.inquiryType} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " order by o.create_time desc "+
|
|
|
|
+ "</script>"})
|
|
|
|
+ List<FsInquiryOrderListUVO> selectFsInquiryOrderListUVO(@Param("maps") FsInquiryOrderListUParam param);
|
|
|
|
+ @Select("SELECT * FROM fs_inquiry_order WHERE order_sn =#{orderSn}")
|
|
|
|
+ FsInquiryOrder selectFsInquiryOrderByOrderSn(String orderSn);
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select o.*,u.avatar from fs_inquiry_order o left join fs_user u on u.user_id=o.user_id " +
|
|
|
|
+ "where o.is_audit=1 " +
|
|
|
|
+ "<if test = 'maps.keyword != null and maps.keyword!=\"\" '> " +
|
|
|
|
+ "and ( o.order_sn like CONCAT('%',#{maps.keyword},'%') || o.patient_json->>'$.patientName' like CONCAT('%',#{maps.keyword},'%') || o.patient_json->>'$.mobile' like CONCAT('%',#{maps.keyword},'%') ) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==0 and maps.isAccept != null and maps.isAccept==1 and maps.isSelf!=null and maps.isSelf==1 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and (o.inquiry_type=1 or o.inquiry_type=2) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==0 and maps.isAccept != null and maps.isAccept==1 and maps.isSelf!=null and maps.isSelf==0 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and (o.inquiry_type=1 or o.inquiry_type=3) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==0 and maps.isAccept != null and maps.isAccept==0 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and 1=0 " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==1 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and o.doctor_id = #{maps.doctorId} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.status != null and maps.status != 0 '> " +
|
|
|
|
+ "and o.status = #{maps.status} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " order by o.create_time desc "+
|
|
|
|
+ "</script>"})
|
|
|
|
+ List<FsInquiryOrderListDVO> selectFsInquiryOrderListDVO(@Param("maps") FsInquiryOrderListDParam param);
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select o.*,u.avatar,c.company_name,c.company_id as companyId,cu.nick_name nickName from fs_inquiry_order o left join fs_user u on u.user_id=o.user_id LEFT JOIN company c ON c.company_id=o.company_id LEFT JOIN company_user cu on o.company_user_id = cu.user_id " +
|
|
|
|
+ "where o.is_audit=1 " +
|
|
|
|
+ "<if test = 'maps.keyword != null and maps.keyword!=\"\" '> " +
|
|
|
|
+ "and ( o.order_sn like CONCAT('%',#{maps.keyword},'%') || o.patient_json->>'$.patientName' like CONCAT('%',#{maps.keyword},'%') || o.patient_json->>'$.mobile' like CONCAT('%',#{maps.keyword},'%') ) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.phone != null and maps.phone!=\"\" '> " +
|
|
|
|
+ "and ( o.patient_json->>'$.mobile' like CONCAT('%',#{maps.phone},'%') ) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.companyId != null '> " +
|
|
|
|
+ "and o.company_id = #{maps.companyId} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.userId != null '> " +
|
|
|
|
+ "and o.user_id = #{maps.userId} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.companyUserNickName != null and maps.companyUserNickName!=\"\" '> " +
|
|
|
|
+ "and cu.nick_name = #{maps.companyUserNickName} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " <if test=\"maps.sTime != null \"> and DATE(o.start_time) >= DATE(#{maps.sTime})</if>\n" +
|
|
|
|
+ " <if test=\"maps.eTime != null \"> and DATE(o.start_time) <= DATE(#{maps.eTime})</if>\n" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==0 and maps.isAccept != null and maps.isAccept==1 and maps.isSelf!=null and maps.isSelf==1 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and (o.inquiry_type=1 or o.inquiry_type=2) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==0 and maps.isAccept != null and maps.isAccept==1 and maps.isSelf!=null and maps.isSelf==0 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and (o.inquiry_type=1 or o.inquiry_type=3) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==0 and maps.isAccept != null and maps.isAccept==0 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} and 1=0 " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.isReceive != null and maps.isReceive==1 '> " +
|
|
|
|
+ "and o.is_receive = #{maps.isReceive} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.doctorId != null and maps.doctorId != 0 '> " +
|
|
|
|
+ "and o.doctor_id = #{maps.doctorId} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.status != null and maps.status != 0 '> " +
|
|
|
|
+ "and o.status = #{maps.status} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " order by o.create_time desc "+
|
|
|
|
+ "</script>"})
|
|
|
|
+ List<FsInquiryOrderListPDVO> selectFsInquiryOrderListPDVO(@Param("maps") FsInquiryOrderListPDParam param);
|
|
|
|
+
|
|
|
|
+ @Select("select ifnull(count(1),0) from fs_inquiry_order where status=3 and doctor_id=#{doctorId} and user_id=#{userId}")
|
|
|
|
+ int checkAcceptOrder(@Param("doctorId") Long doctorId,@Param("userId") Long userId);
|
|
|
|
+ @Select("select ifnull(count(1),0) from fs_inquiry_order where status=2 and is_audit=1 and doctor_id=#{doctorId} ")
|
|
|
|
+ Integer getDoctorDoReceiveOrder(@Param("doctorId")String doctorId);
|
|
|
|
+ @Select("SELECT * FROM fs_inquiry_order_logs WHERE order_id =#{orderId}")
|
|
|
|
+ List<FsStoreOrderLogs> selectFsInquiryOrderLogsList(String orderId);
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select io.*,dc.doctor_name,dc.account,det.dept_name,c.company_name,cu.nick_name company_user_name ," +
|
|
|
|
+ "io.patient_json->>'$.patientName'as patient_name,syu.nick_name user_name," +
|
|
|
|
+// "fuc.send_user_id," +
|
|
|
|
+// "send.nick_name sendName," +
|
|
|
|
+ "IF(fdr.report_id IS NULL, 0, 1) AS isDrugReport " +
|
|
|
|
+ " from fs_inquiry_order io LEFT JOIN fs_doctor dc ON io.doctor_id =dc.doctor_id " +
|
|
|
|
+ " LEFT JOIN fs_department det ON det.dept_id =io.department_id " +
|
|
|
|
+ " LEFT JOIN sys_user syu ON syu.user_id =io.audit_user_id" +
|
|
|
|
+// " LEFT JOIN fs_user_coupon fuc ON io.user_coupon_id=fuc.id" +
|
|
|
|
+// " LEFT JOIN sys_user send ON send.user_id=fuc.send_user_id" +
|
|
|
|
+ " LEFT JOIN company c ON c.company_id= io.company_id" +
|
|
|
|
+ " LEFT JOIN company_user cu ON cu.user_id=io.company_user_id" +
|
|
|
|
+ " LEFT JOIN fs_inquiry_order_report fdr ON fdr.order_id=io.order_id "+
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> LEFT JOIN fs_user fu ON fu.user_id=io.user_id</if>\n" +
|
|
|
|
+ " where 1=1 " +
|
|
|
|
+ " <if test=\"maps.orderSn != null and maps.orderSn != ''\"> and io.order_sn = #{maps.orderSn}</if>\n" +
|
|
|
|
+ " <if test=\"maps.title != null and maps.title != ''\"> and io.title = #{maps.title}</if>\n" +
|
|
|
|
+ " <if test=\"maps.userId != null \"> and io.user_id = #{maps.userId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorName != null \"> and dc.doctor_name like concat('%', #{maps.doctorName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientId != null \"> and io.patient_id = #{maps.patientId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientName != null \"> and io.patient_json like concat('%',#{maps.patientName},'%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.orderType != null \"> and io.order_type = #{maps.orderType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.payType != null \"> and io.pay_type = #{maps.payType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPay != null \"> and io.is_pay = #{maps.isPay}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorId != null \"> and io.doctor_id = #{maps.doctorId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.status != null \"> and io.status = #{maps.status}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sTime != null \"> and io.start_time >= DATE_FORMAT(#{maps.sTime},'%Y-%m-%d 00:00:00')</if>\n" +
|
|
|
|
+ " <if test=\"maps.eTime != null \"> and io.start_time <= DATE_FORMAT(#{maps.eTime},'%Y-%m-%d 23:59:59')</if>\n" +
|
|
|
|
+ " <if test=\"maps.fsTime != null \"> and io.finish_time >= DATE_FORMAT(#{maps.fsTime},'%Y-%m-%d 00:00:00')</if>\n" +
|
|
|
|
+ " <if test=\"maps.feTime != null \"> and io.finish_time <= DATE_FORMAT(#{maps.feTime},'%Y-%m-%d 23:59:59')</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPing != null \"> and io.is_ping = #{maps.isPing}</if>\n" +
|
|
|
|
+ " <if test=\"maps.departmentId != null \"> and io.department_id = #{maps.departmentId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.inquiryType != null \"> and io.inquiry_type = #{maps.inquiryType}</if>\n" +
|
|
|
|
+// " <if test=\"maps.sendName != null \"> and send.nick_name like concat( #{maps.sendName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> and fu.phone = #{maps.phone}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyId != null \"> and io.company_id = #{maps.companyId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyUserId != null \"> and io.company_user_id = #{maps.companyUserId}</if>\n" +
|
|
|
|
+ " <if test = 'maps.createTimeList != null '> AND date_format(io.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d') AND date_format(io.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d') </if>" +
|
|
|
|
+ " <if test = 'maps.payTimeList != null '> AND date_format(io.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d') AND date_format(io.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d') </if>" +
|
|
|
|
+ " <if test = 'maps.inquirySubType != null '> and io.inquiry_sub_type =#{maps.inquirySubType} </if>" +
|
|
|
|
+ " <if test = 'maps.deptId != null '> AND (io.dept_id = #{maps.deptId} OR io.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) </if>" +
|
|
|
|
+ " <if test = 'maps.doctorAccount != null '> and dc.account =#{maps.doctorAccount} </if>" +
|
|
|
|
+ " <if test = 'maps.companyUserNickName != null and maps.companyUserNickName != \"\" '> and cu.nick_name like concat( #{maps.companyUserNickName}, '%') </if>" +
|
|
|
|
+ "<if test='maps.lastOrderId != null '> and io.order_id < #{maps.lastOrderId}</if>"+
|
|
|
|
+ " order by io.order_id desc" +
|
|
|
|
+ " <if test='maps.limitSqlStr != null and maps.limitSqlStr != \"\"' > ${maps.limitSqlStr} </if>" +
|
|
|
|
+ "</script>"})
|
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
|
+ List<FsInquiryOrderExeclListVO> selectFsInquiryOrderExcelListVO(@Param("maps") FsInquiryOrderParam fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select io.*,dc.doctor_name,c.company_name,cu.nick_name company_user_name ,io.patient_json->>'$.patientName'as patient_name," +
|
|
|
|
+ "io.patient_json->>'$.mobile'as patient_tel " +
|
|
|
|
+ "from fs_inquiry_order io " +
|
|
|
|
+ " LEFT JOIN fs_doctor dc ON io.doctor_id =dc.doctor_id " +
|
|
|
|
+ "LEFT JOIN company c ON c.company_id= io.company_id " +
|
|
|
|
+ "LEFT JOIN company_user cu ON cu.user_id=io.company_user_id "+
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> LEFT JOIN fs_user fu ON fu.user_id=io.user_id</if>\n" +
|
|
|
|
+ " where 1=1 " +
|
|
|
|
+ " <if test=\"maps.orderSn != null and maps.orderSn != ''\"> and io.order_sn = #{maps.orderSn}</if>\n" +
|
|
|
|
+ " <if test=\"maps.title != null and maps.title != ''\"> and io.title = #{maps.title}</if>\n" +
|
|
|
|
+ " <if test=\"maps.userId != null \"> and io.user_id = #{maps.userId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorName != null \"> and dc.doctor_name like concat('%', #{maps.doctorName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientId != null \"> and io.patient_id = #{maps.patientId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientName != null \"> and io.patient_json like concat('%',#{maps.patientName},'%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.orderType != null \"> and io.order_type = #{maps.orderType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.payType != null \"> and io.pay_type = #{maps.payType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPay != null \"> and io.is_pay = #{maps.isPay}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorId != null \"> and io.doctor_id = #{maps.doctorId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.status != null \"> and io.status = #{maps.status}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sTime != null \"> and io.start_time >= DATE_FORMAT(#{maps.sTime},'%Y-%m-%d 00:00:00') </if>\n" +
|
|
|
|
+ " <if test=\"maps.eTime != null \"> and io.start_time <= DATE_FORMAT(#{maps.eTime},'%Y-%m-%d 23:59:59') </if>\n" +
|
|
|
|
+ " <if test=\"maps.finishTime != null \"> and (io.finish_time >= DATE_FORMAT(#{maps.finishTime},'%Y-%m-%d 00:00:00') and io.finish_time <= DATE_FORMAT(#{maps.finishTime},'%Y-%m-%d 23:59:59')) </if>\n" +
|
|
|
|
+ " <if test=\"maps.isPing != null \"> and io.is_ping = #{maps.isPing}</if>\n" +
|
|
|
|
+ " <if test=\"maps.departmentId != null \"> and io.department_id = #{maps.departmentId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.inquiryType != null \"> and io.inquiry_type = #{maps.inquiryType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sendName != null \"> and send.nick_name like concat( #{maps.sendName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> and fu.phone = #{maps.phone}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyId != null \"> and io.company_id = #{maps.companyId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyUserId != null \"> and io.company_user_id = #{maps.companyUserId}</if>\n" +
|
|
|
|
+ "<if test = 'maps.createTimeList != null '> " +
|
|
|
|
+ " AND date_format(io.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d') " +
|
|
|
|
+ " AND date_format(io.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d') " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.payTimeList != null '> " +
|
|
|
|
+ " AND date_format(io.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d') " +
|
|
|
|
+ " AND date_format(io.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d') " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.inquirySubType != null '> " +
|
|
|
|
+ "and io.inquiry_sub_type =#{maps.inquirySubType} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.deptId != null '> " +
|
|
|
|
+ " AND (io.dept_id = #{maps.deptId} OR io.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.doctorAccount != null '> " +
|
|
|
|
+ "and dc.account =#{maps.doctorAccount} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " <if test = 'maps.companyUserNickName != null and maps.companyUserNickName != \"\" '> " +
|
|
|
|
+ " and cu.nick_name like concat( #{maps.companyUserNickName}, '%') " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test='maps.lastOrderId !=null '> and io.order_id < #{maps.lastOrderId} </if>" +
|
|
|
|
+ " order by io.order_id desc" +
|
|
|
|
+ " <if test='maps.limitSqlStr != null and maps.limitSqlStr != \"\"' > ${maps.limitSqlStr} </if>" +
|
|
|
|
+ "</script>"})
|
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
|
+ List<FsInquiryFeedbackExportListVO> selectFsInquiryFeedbackExportListVO(@Param("maps") FsInquiryOrderParam fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Select("select * from fs_inquiry_order where patient_json LIKE '%https://htj-1258038825.cos.ap-beijing.myqcloud.com%' order by order_id desc ")
|
|
|
|
+ List<FsInquiryOrder> selectFsInquiryOrderListByUpdate();
|
|
|
|
+ @Select("select * from fs_inquiry_order where order_type=2 AND inquiry_sub_type=3 and patient_json LIKE \"%未就诊%\"")
|
|
|
|
+ List<FsInquiryOrder> selectFsInquiryOrderByOrderIdSub3();
|
|
|
|
+
|
|
|
|
+ @Select("select * from fs_inquiry_order where status = 3 and (inquiry_type = 1 or inquiry_type = 3) AND TIMESTAMPDIFF(HOUR, start_time, NOW()) >= 48 ")
|
|
|
|
+ List<FsInquiryOrder> selectFsInquiryOrderByFinish();
|
|
|
|
+
|
|
|
|
+ @Select("select * from fs_inquiry_order where status = 3 and (inquiry_type = 1 or inquiry_type = 3) and is_send_sms = 0 and TIMESTAMPDIFF(HOUR, start_time, NOW()) > 36 AND TIMESTAMPDIFF(HOUR, start_time, NOW()) < 48 ")
|
|
|
|
+ List<FsInquiryOrder> selectFsInquiryOrderBySendSms();
|
|
|
|
+ @Select("select patient_json->>'$.tongueImages'as patient_name from fs_inquiry_order where inquiry_type=2 and title !='服务问诊' AND patient_json->>'$.tongueImages' !='' and create_time>'2024-08-27'")
|
|
|
|
+ List<String> selectTongueImages();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Select("select order_sn from fs_inquiry_order where order_id=#{orderId}")
|
|
|
|
+ String selectFsInquiryOrderSnByOrderId(long orderId);
|
|
|
|
+
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select count(1) from fs_inquiry_order io " +
|
|
|
|
+ " LEFT JOIN fs_doctor dc ON io.doctor_id =dc.doctor_id" +
|
|
|
|
+ " LEFT JOIN fs_department det ON det.dept_id =io.department_id " +
|
|
|
|
+ " LEFT JOIN sys_user syu ON syu.user_id =io.audit_user_id " +
|
|
|
|
+// "LEFT JOIN fs_user_coupon fuc ON io.user_coupon_id=fuc.id" +
|
|
|
|
+// " LEFT JOIN sys_user send ON send.user_id=fuc.send_user_id " +
|
|
|
|
+ "LEFT JOIN company c ON c.company_id= io.company_id " +
|
|
|
|
+ "LEFT JOIN company_user cu ON cu.user_id=io.company_user_id " +
|
|
|
|
+ "LEFT JOIN fs_inquiry_order_report fdr ON fdr.order_id=io.order_id "+
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> LEFT JOIN fs_user fu ON fu.user_id=io.user_id</if>\n" +
|
|
|
|
+ " where 1=1 " +
|
|
|
|
+ " <if test=\"maps.orderSn != null and maps.orderSn != ''\"> and io.order_sn = #{maps.orderSn}</if>\n" +
|
|
|
|
+ " <if test=\"maps.title != null and maps.title != ''\"> and io.title = #{maps.title}</if>\n" +
|
|
|
|
+ " <if test=\"maps.userId != null \"> and io.user_id = #{maps.userId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorName != null \"> and dc.doctor_name like concat('%', #{maps.doctorName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientId != null \"> and io.patient_id = #{maps.patientId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientName != null \"> and io.patient_json like concat('%',#{maps.patientName},'%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.orderType != null \"> and io.order_type = #{maps.orderType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.payType != null \"> and io.pay_type = #{maps.payType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPay != null \"> and io.is_pay = #{maps.isPay}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorId != null \"> and io.doctor_id = #{maps.doctorId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.status != null \"> and io.status = #{maps.status}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sTime != null \"> and io.start_time >= DATE_FORMAT(#{maps.sTime},'%Y-%m-%d 00:00:00')</if>\n" +
|
|
|
|
+ " <if test=\"maps.eTime != null \"> and io.start_time <= DATE_FORMAT(#{maps.eTime},'%Y-%m-%d 23:59:59') </if>\n" +
|
|
|
|
+ " <if test=\"maps.finishTime != null \"> and (io.finish_time >= DATE_FORMAT(#{maps.finishTime},'%Y-%m-%d 00:00:00') and io.finish_time <= DATE_FORMAT(#{maps.finishTime},'%Y-%m-%d 23:59:59') )</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPing != null \"> and io.is_ping = #{maps.isPing}</if>\n" +
|
|
|
|
+ " <if test=\"maps.departmentId != null \"> and io.department_id = #{maps.departmentId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.inquiryType != null \"> and io.inquiry_type = #{maps.inquiryType}</if>\n" +
|
|
|
|
+// " <if test=\"maps.sendName != null \"> and send.nick_name like concat( #{maps.sendName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> and fu.phone = #{maps.phone}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyId != null \"> and io.company_id = #{maps.companyId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyUserId != null \"> and io.company_user_id = #{maps.companyUserId}</if>\n" +
|
|
|
|
+ " <if test = 'maps.createTimeList != null '> AND date_format(io.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d') AND date_format(io.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d') </if>" +
|
|
|
|
+ " <if test = 'maps.payTimeList != null '> AND date_format(io.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d') AND date_format(io.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d') </if>" +
|
|
|
|
+ " <if test = 'maps.inquirySubType != null '> and io.inquiry_sub_type =#{maps.inquirySubType} </if>" +
|
|
|
|
+ " <if test = 'maps.deptId != null '> AND (io.dept_id = #{maps.deptId} OR io.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) </if>" +
|
|
|
|
+ " <if test = 'maps.doctorAccount != null '> and dc.account =#{maps.doctorAccount} </if>" +
|
|
|
|
+ " <if test = 'maps.companyUserNickName != null and maps.companyUserNickName != \"\" '> and cu.nick_name like concat( #{maps.companyUserNickName}, '%') </if>" +
|
|
|
|
+ " order by io.order_id desc" +
|
|
|
|
+ "</script>"})
|
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
|
+ Long selectFsInquiryOrderExcelListVOCount(@Param("maps") FsInquiryOrderParam fsInquiryOrder);
|
|
|
|
+ @Select({"<script> " +
|
|
|
|
+ "select count(1) from fs_inquiry_order io " +
|
|
|
|
+ " LEFT JOIN fs_doctor dc ON io.doctor_id =dc.doctor_id " +
|
|
|
|
+ " LEFT JOIN company c ON c.company_id= io.company_id " +
|
|
|
|
+ "LEFT JOIN company_user cu ON cu.user_id=io.company_user_id "+
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> LEFT JOIN fs_user fu ON fu.user_id=io.user_id</if>\n" +
|
|
|
|
+ " where 1=1 " +
|
|
|
|
+ " <if test=\"maps.orderSn != null and maps.orderSn != ''\"> and io.order_sn = #{maps.orderSn}</if>\n" +
|
|
|
|
+ " <if test=\"maps.title != null and maps.title != ''\"> and io.title = #{maps.title}</if>\n" +
|
|
|
|
+ " <if test=\"maps.userId != null \"> and io.user_id = #{maps.userId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorName != null \"> and dc.doctor_name like concat('%', #{maps.doctorName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientId != null \"> and io.patient_id = #{maps.patientId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.patientName != null \"> and io.patient_json like concat('%',#{maps.patientName},'%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.orderType != null \"> and io.order_type = #{maps.orderType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.payType != null \"> and io.pay_type = #{maps.payType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPay != null \"> and io.is_pay = #{maps.isPay}</if>\n" +
|
|
|
|
+ " <if test=\"maps.doctorId != null \"> and io.doctor_id = #{maps.doctorId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.status != null \"> and io.status = #{maps.status}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sTime != null \"> and io.start_time >= DATE_FORMAT(#{maps.sTime},'%Y-%m-%d 00:00:00') </if>\n" +
|
|
|
|
+ " <if test=\"maps.eTime != null \"> and io.start_time <= DATE_FORMAT(#{maps.eTime},'%Y-%m-%d 23:59:59')</if>\n" +
|
|
|
|
+ " <if test=\"maps.finishTime != null \"> and (io.finish_time >= DATE_FORMAT(#{maps.finishTime},'%Y-%m-%d 00:00:00') and io.finish_time <= DATE_FORMAT(#{maps.finishTime},'%Y-%m-%d 23:59:59') )</if>\n" +
|
|
|
|
+ " <if test=\"maps.isPing != null \"> and io.is_ping = #{maps.isPing}</if>\n" +
|
|
|
|
+ " <if test=\"maps.departmentId != null \"> and io.department_id = #{maps.departmentId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.inquiryType != null \"> and io.inquiry_type = #{maps.inquiryType}</if>\n" +
|
|
|
|
+ " <if test=\"maps.sendName != null \"> and send.nick_name like concat( #{maps.sendName}, '%')</if>\n" +
|
|
|
|
+ " <if test=\"maps.phone != null and maps.phone != ''\"> and fu.phone = #{maps.phone}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyId != null \"> and io.company_id = #{maps.companyId}</if>\n" +
|
|
|
|
+ " <if test=\"maps.companyUserId != null \"> and io.company_user_id = #{maps.companyUserId}</if>\n" +
|
|
|
|
+ "<if test = 'maps.createTimeList != null '> " +
|
|
|
|
+ " AND date_format(io.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d') " +
|
|
|
|
+ " AND date_format(io.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d') " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.payTimeList != null '> " +
|
|
|
|
+ " AND date_format(io.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d') " +
|
|
|
|
+ " AND date_format(io.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d') " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.inquirySubType != null '> " +
|
|
|
|
+ "and io.inquiry_sub_type =#{maps.inquirySubType} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.deptId != null '> " +
|
|
|
|
+ " AND (io.dept_id = #{maps.deptId} OR io.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) )) " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ "<if test = 'maps.doctorAccount != null '> " +
|
|
|
|
+ "and dc.account =#{maps.doctorAccount} " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " <if test = 'maps.companyUserNickName != null and maps.companyUserNickName != \"\" '> " +
|
|
|
|
+ " and cu.nick_name like concat( #{maps.companyUserNickName}, '%') " +
|
|
|
|
+ "</if>" +
|
|
|
|
+ " order by io.order_id desc" +
|
|
|
|
+ "</script>"})
|
|
|
|
+ @DataSource(DataSourceType.SLAVE)
|
|
|
|
+ Long selectFsInquiryFeedbackExportListVOCount(@Param("maps") FsInquiryOrderParam fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+ int revokeFsInquiryOrder(FsInquiryOrder fsInquiryOrder);
|
|
|
|
+
|
|
|
|
+ @Select("select order_id,patient_json from fs_inquiry_order where order_id > #{orderId} ORDER BY order_id asc limit 500")
|
|
|
|
+ List<FsInquiryOrder> selectFsInquiryOrderPhoneList(FsInquiryOrder order);
|
|
|
|
+
|
|
|
|
+ FsPackageOrderVO selectOrderMsgByPackageOrderId(@Param("packageOrderId") Long packageOrderId);
|
|
|
|
+}
|