DoctorMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.mapper.cmMapper.DoctorMapper">
  4. <insert id="insertDoctor" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.caimei.model.po.CmBrandDoctorPo">
  5. insert into cm_brand_doctor (authUserId, authId, doctorType, name, certificateNo, clubName, image, status, createTime, createBy,
  6. auditStatus)
  7. values (#{authUserId}, #{authId}, #{doctorType}, #{name}, #{certificateNo}, #{clubName}, #{image}, #{status}, NOW(), #{createBy}, #{auditStatus})
  8. </insert>
  9. <insert id="insertBanner">
  10. insert into cm_brand_doctor_banner (doctorId, banner)
  11. VALUES (#{doctorId}, #{banner})
  12. </insert>
  13. <insert id="insertEquipment">
  14. insert into cm_brand_doctor_equipment(doctorId, name, brand, image)
  15. values (#{doctorId}, #{equipmentName}, #{brand}, #{image})
  16. </insert>
  17. <insert id="insertTag">
  18. insert into cm_brand_doctor_tag (doctorId, tag)
  19. VALUES (#{doctorId}, #{tag})
  20. </insert>
  21. <insert id="insertParam">
  22. insert into cm_brand_doctor_param(doctorId, name, content)
  23. values (#{doctorId}, #{name}, #{content})
  24. </insert>
  25. <update id="updateDoctorStatus">
  26. update cm_brand_doctor
  27. set status = #{status}
  28. where id = #{doctorId}
  29. </update>
  30. <update id="updateDoctorByDoctorId">
  31. update cm_brand_doctor
  32. set authId = #{authId},
  33. doctorType = #{doctorType},
  34. name = #{name},
  35. certificateNo = #{certificateNo},
  36. clubName = #{clubName},
  37. image = #{image},
  38. status = #{status},
  39. auditStatus = #{auditStatus}
  40. where id = #{id}
  41. </update>
  42. <update id="updateDoctorAuditStatus">
  43. update cm_brand_doctor
  44. set status = #{status},
  45. auditStatus = #{auditStatus},
  46. invalidReason = #{invalidReason},
  47. auditBy = #{auditBy},
  48. auditTime = #{auditTime}
  49. where id = #{doctorId}
  50. </update>
  51. <delete id="deleteDoctorByDoctorId">
  52. delete from cm_brand_doctor where id = #{doctorId}
  53. </delete>
  54. <delete id="deleteBanner">
  55. delete from cm_brand_doctor_banner where doctorId = #{doctorId}
  56. </delete>
  57. <delete id="deleteEquipment">
  58. delete from cm_brand_doctor_equipment where doctorId = #{doctorId}
  59. </delete>
  60. <delete id="deleteTag">
  61. delete from cm_brand_doctor_tag where doctorId = #{doctorId}
  62. </delete>
  63. <delete id="deleteParam">
  64. delete from cm_brand_doctor_param where doctorId = #{doctorId}
  65. </delete>
  66. <select id="getDoctorList" resultType="com.caimei.model.vo.DoctorListVo">
  67. select id as doctorId, a.name as doctorName,a.certificateNo, a.status, a.auditStatus, a.createTime, cu.name as createBy,
  68. au.name as auditBy,a.auditTime,a.invalidReason
  69. from cm_brand_doctor a
  70. left join cm_brand_auth_user cu on a.createBy = cu.authUserId
  71. left join cm_brand_auth_user au on a.auditBy = au.authUserId
  72. where a.authUserId = #{authUserId} and doctorType = #{doctorType}
  73. <if test="doctorName != null and doctorName != ''">
  74. and a.name like CONCAT('%',#{doctorName},'%')
  75. </if>
  76. <if test="certificateNo != null and certificateNo != ''">
  77. and a.certificateNo like concat('%',#{certificateNo},'%')
  78. </if>
  79. <if test="status != null">
  80. and a.status = #{status}
  81. </if>
  82. <if test="auditStatus != null">
  83. and a.auditStatus = #{auditStatus}
  84. </if>
  85. <choose>
  86. <when test="listType == 2">
  87. order by (case a.auditStatus when 2 then 2 when 0 then 1 else 0 end) desc, a.createTime desc
  88. </when>
  89. <otherwise>
  90. order by a.createTime desc
  91. </otherwise>
  92. </choose>
  93. </select>
  94. <select id="getDoctorById" resultType="com.caimei.model.po.CmBrandDoctorPo">
  95. select id,
  96. authId,
  97. name,
  98. authUserId,
  99. certificateNo,
  100. clubName,
  101. image,
  102. status
  103. from cm_brand_doctor
  104. where id = #{doctorId}
  105. </select>
  106. <select id="getDoctorIdByCertificateNo" resultType="java.lang.Integer">
  107. select id
  108. from cm_brand_doctor
  109. where certificateNo = #{certificateNo}
  110. and authUserId = #{authUserId}
  111. limit 1
  112. </select>
  113. <select id="getBannerList" resultType="java.lang.String">
  114. select banner from cm_brand_doctor_banner where doctorId = #{doctorId}
  115. </select>
  116. <select id="getEquipmentList" resultType="com.caimei.model.vo.DoctorEquipmentVo">
  117. select name as equipmentName, brand, image
  118. from cm_brand_doctor_equipment
  119. where doctorId = #{doctorId}
  120. </select>
  121. <select id="getWxDoctorList" resultType="com.caimei.model.vo.WxDoctorListVo">
  122. select d.id as doctorId, d.doctorType, d.name as doctorName,d.certificateNo,ifnull(cba.authParty,d.clubName) as clubName,d.image as doctorImage
  123. from cm_brand_doctor d
  124. left join cm_brand_auth_user au on d.authUserId = au.authUserId
  125. left join cm_brand_auth cba on d.authId = cba.id
  126. where
  127. au.status = 1
  128. and d.status = 1
  129. and d.auditStatus = 1
  130. <if test="authUserId != null and authUserId != ''">
  131. and au.authUserId = #{authUserId}
  132. </if>
  133. <if test="authId != null">
  134. and d.authId = #{authId}
  135. </if>
  136. <if test="doctorType != null">
  137. and d.doctorType = #{doctorType}
  138. </if>
  139. <if test="doctorName != null and doctorName != ''">
  140. and d.name like concat('%',#{doctorName},'%')
  141. </if>
  142. and au.status = 1
  143. and d.status = 1
  144. and d.auditStatus = 1
  145. </select>
  146. <select id="getDoctorDetailsById" resultType="com.caimei.model.vo.DoctorFormVo">
  147. select d.id as doctorId,
  148. d.doctorType,
  149. d.name as doctorName,
  150. certificateNo,
  151. ifnull(cba.authParty,d.clubName) as clubName,
  152. image as doctorImage
  153. from cm_brand_doctor d
  154. left join cm_brand_auth_user au on d.authUserId = au.authUserId
  155. left join cm_brand_auth cba on d.authId = cba.id
  156. where d.id = #{doctorId}
  157. and au.status = 1
  158. and d.status = 1
  159. and d.auditStatus = 1
  160. </select>
  161. <select id="getTagList" resultType="java.lang.String">
  162. select tag from cm_brand_doctor_tag where doctorId = #{doctorId}
  163. </select>
  164. <select id="getParamList" resultType="com.caimei.model.vo.ParamVo">
  165. select name, content
  166. from cm_brand_doctor_param
  167. where doctorId = #{doctorId}
  168. </select>
  169. </mapper>