AccountingDateMapper.xml 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.boman.web.core.mapper.AccountingDataMapper">
  6. <resultMap type="com.boman.web.core.domain.vo.AccountingDataVo" id="AccountingDataResult">
  7. <result property="id" column="id"/>
  8. <result property="jcsj" column="jcsj"/>
  9. <result property="lxdh" column="lxdh"/>
  10. <result property="address" column="address"/>
  11. <result property="batchNumber" column="batch_number"/>
  12. <result property="focusPerson" column="focus_person"/>
  13. <result property="jcjg" column="jcjg"/>
  14. <result property="fromCity" column="from_city"/>
  15. <result property="jcdd" column="jcdd"/>
  16. <result property="cjdd" column="cjdd"/>
  17. <result property="toCity" column="to_city"/>
  18. <result property="source" column="source"/>
  19. <result property="zjhm" column="zjhm"/>
  20. <result property="cjsj" column="cjsj"/>
  21. <result property="certificateNoType" column="certificate_no_type"/>
  22. <result property="xm" column="xm"/>
  23. <result property="transit" column="transit"/>
  24. <result property="collectorName" column="collector_name"/>
  25. <result property="cjqxqh" column="cjqxqh"/>
  26. <result property="cjssxq" column="cjssxq"/>
  27. <result property="mainKey" column="main_key"/>
  28. <result property="modifyDate" column="modify_date"/>
  29. <result property="createBy" column="create_by"/>
  30. <result property="createTime" column="create_time"/>
  31. <result property="updateBy" column="update_by"/>
  32. <result property="updateTime" column="update_time"/>
  33. <result property="isDel" column="is_del"/>
  34. <result property="hjh" column="hjh"/>
  35. <!--以下是返回是需要使用-->
  36. <result property="phoneNum" column="phone_num"/>
  37. <result property="province" column="province"/>
  38. <result property="city" column="city"/>
  39. <result property="region" column="region"/>
  40. <result property="villageTowns" column="village_towns"/>
  41. <result property="village" column="village"/>
  42. <result property="nowIn" column="now_in"/>
  43. <result property="nowInSelect" column="nowInSelect"/>
  44. <result property="domicileSelect" column="domicileSelect"/>
  45. <result property="isNucleicAcid" column="isNucleicAcid"/>
  46. <result property="provinceXjd" column="provinceXjd"/>
  47. <result property="cityXjd" column="cityXjd"/>
  48. <result property="regionXjd" column="regionXjd"/>
  49. <result property="villageTownsXjd" column="villageTownsXjd"/>
  50. <result property="villageXjd" column="villageXjd"/>
  51. <result property="nowXjd" column="nowXjd"/>
  52. </resultMap>
  53. <sql id="selectAccountingDataVo">
  54. select id,
  55. jcsj,
  56. lxdh,
  57. address,
  58. batch_number,
  59. focus_person,
  60. jcjg,
  61. from_city,
  62. jcdd,
  63. cjdd,
  64. to_city,
  65. source,
  66. zjhm,
  67. cjsj,
  68. certificate_no_type,
  69. xm,
  70. transit,
  71. collector_name,
  72. cjqxqh,
  73. cjssxq,
  74. main_key,
  75. modify_date,
  76. create_by,
  77. create_time,
  78. update_by,
  79. update_time
  80. from accounting_data
  81. </sql>
  82. <select id="nucleicAcidJcd" resultMap="AccountingDataResult"
  83. parameterType="com.boman.web.core.domain.vo.AccountingDataVo">
  84. <include refid="selectAccountingDataVo"/>
  85. <where>
  86. 1=1
  87. <if test="zjhm != null and zjhm != ''">and zjhm = #{zjhm}</if>
  88. <if test="xm != null and xm != ''">and xm like concat(#{xm}, '%')</if>
  89. <if test="lxdh != null and lxdh != ''">and lxdh = #{lxdh}</if>
  90. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  91. DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  92. </if>
  93. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  94. DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  95. </if>
  96. <if test="cjssxq != null and cjssxq != ''">and cjssxq like concat('%',#{cjssxq}, '%')</if>
  97. <if test="cjqxqh != null and cjqxqh != ''">and cjqxqh = #{cjqxqh}</if>
  98. </where>
  99. order by cjsj desc
  100. </select>
  101. <select id="nucleicAcidZd" resultMap="AccountingDataResult"
  102. parameterType="com.boman.web.core.domain.vo.AccountingDataVo">
  103. <include refid="selectAccountingDataVo"/>
  104. <where>
  105. 1=1
  106. <if test="zjhm != null and zjhm != ''">and zjhm = #{zjhm}</if>
  107. <if test="xm != null and xm != ''">and xm like concat(#{xm}, '%')</if>
  108. <if test="lxdh != null and lxdh != ''">and lxdh = #{lxdh}</if>
  109. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  110. DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  111. </if>
  112. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  113. DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  114. </if>
  115. <if test="cjqxqh != null and cjqxqh != ''">and cjqxqh = #{cjqxqh}</if>
  116. <if test="cjdd != null and cjdd != ''">and cjdd = #{cjdd}</if>
  117. </where>
  118. </select>
  119. <select id="selectAccountingDataHjList" parameterType="com.boman.web.core.domain.vo.AccountingDataVo"
  120. resultMap="AccountingDataResult">
  121. SELECT
  122. r.id,r.user_name as xm,r.id_card as
  123. zjhm,r.province,r.city,r.region,r.village_towns,r.village,r.now_in,r.phone_num,d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj
  124. FROM czrk r left join `accounting_data` d on r.id_card = d.zjhm
  125. <where>
  126. r.is_del = 'N'
  127. and r.status = '1'
  128. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  129. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  130. <if test="lxdh != null and lxdh != ''">and r.phone_num = #{lxdh}</if>
  131. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  132. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  133. </if>
  134. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  135. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  136. </if>
  137. <if test="provinceId != null and provinceId != ''">and r.province_id = #{provinceId}</if>
  138. <if test="cityId != null and cityId != ''">and r.city_id = #{cityId}</if>
  139. <if test="regionId != null and regionId != ''">and r.region_id = #{regionId}</if>
  140. <if test="villageTownsId != null and villageTownsId != ''">and r.village_towns_id = #{villageTownsId}</if>
  141. <if test="villageId != null and villageId != ''">and r.village_id = #{villageId}</if>
  142. </where>
  143. order by d.cjsj DESC,r.create_time DESC
  144. </select>
  145. <select id="selectNoAccountingDataHjList" parameterType="com.boman.web.core.domain.vo.AccountingDataVo"
  146. resultMap="AccountingDataResult">
  147. select cz.id,cz.user_name as xm,cz.id_card as
  148. zjhm,cz.province,cz.city,cz.region,cz.village_towns,cz.village,cz.now_in,cz.phone_num from czrk cz
  149. where id_card not in (
  150. SELECT
  151. r.id_card
  152. FROM czrk r left join `accounting_data` d on r.id_card = d.zjhm
  153. <where>
  154. r.is_del = 'N'
  155. and r.status = '1'
  156. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  157. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  158. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  159. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  160. </if>
  161. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  162. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  163. </if>
  164. <if test="provinceId != null and provinceId != ''">and r.province_id = #{provinceId}</if>
  165. <if test="cityId != null and cityId != ''">and r.city_id = #{cityId}</if>
  166. <if test="regionId != null and regionId != ''">and r.region_id = #{regionId}</if>
  167. <if test="villageTownsId != null and villageTownsId != ''">and r.village_towns_id = #{villageTownsId}</if>
  168. <if test="villageId != null and villageId != ''">and r.village_id = #{villageId}</if>
  169. </where>
  170. )
  171. and cz.is_del = 'N'
  172. and cz.status = '1'
  173. <if test="zjhm != null and zjhm != ''">and cz.id_card = #{zjhm}</if>
  174. <if test="lxdh != null and lxdh != ''">and cz.phone_num = #{lxdh}</if>
  175. <if test="xm != null and xm != ''">and cz.user_name like concat(#{xm}, '%')</if>
  176. <if test="provinceId != null and provinceId != ''">and cz.province_id = #{provinceId}</if>
  177. <if test="cityId != null and cityId != ''">and cz.city_id = #{cityId}</if>
  178. <if test="regionId != null and regionId != ''">and cz.region_id = #{regionId}</if>
  179. <if test="villageTownsId != null and villageTownsId != ''">and cz.village_towns_id = #{villageTownsId}</if>
  180. <if test="villageId != null and villageId != ''">and cz.village_id = #{villageId}</if>
  181. order by cz.create_time DESC
  182. </select>
  183. <select id="selectAccountingDataJzdzList" parameterType="com.boman.web.core.domain.vo.AccountingDataVo"
  184. resultMap="AccountingDataResult">
  185. select r.user_name as xm, r.phone_num, r.id_card as zjhm,
  186. z.province as provinceXjd , z.city as cityXjd,z.region as regionXjd , z.town as villageTownsXjd, z.village as
  187. villageXjd,z.now_in,d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj
  188. from czrk r left join czrk_jzdz z on r.id =z.czrk_id
  189. left join `accounting_data` d on r.id_card = d.zjhm
  190. <where>
  191. r.is_del = 'N'
  192. and r.status = '1'
  193. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  194. <if test="lxdh != null and lxdh != ''">and r.phone_num = #{lxdh}</if>
  195. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  196. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  197. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  198. </if>
  199. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  200. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  201. </if>
  202. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  203. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  204. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  205. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  206. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  207. </where>
  208. order by d.cjsj DESC,r.create_time DESC
  209. </select>
  210. <select id="selectNoAccountingDataJzdzList" parameterType="com.boman.web.core.domain.vo.AccountingDataVo"
  211. resultMap="AccountingDataResult">
  212. select rz.user_name as xm, rz.phone_num, rz.id_card as zjhm,
  213. zj.province as provinceXjd , zj.city as cityXjd,zj.region as regionXjd , zj.town as villageTownsXjd, zj.village
  214. as
  215. villageXjd,zj.now_in
  216. from czrk rz left join czrk_jzdz zj on rz.id =zj.czrk_id
  217. where rz.id_card not in (
  218. select r.id_card
  219. from czrk r left join czrk_jzdz z on r.id =z.czrk_id
  220. left join `accounting_data` d on r.id_card = d.zjhm
  221. <where>
  222. r.is_del = 'N'
  223. and r.status = '1'
  224. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  225. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  226. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  227. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  228. </if>
  229. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  230. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  231. </if>
  232. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  233. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  234. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  235. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  236. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  237. </where>
  238. )
  239. and rz.is_del = 'N'
  240. and rz.status = '1'
  241. <if test="zjhm != null and zjhm != ''">and rz.id_card = #{zjhm}</if>
  242. <if test="lxdh != null and lxdh != ''">and rz.phone_num = #{lxdh}</if>
  243. <if test="xm != null and xm != ''">and rz.user_name like concat(#{xm}, '%')</if>
  244. <if test="provinceIdXjd != null and provinceIdXjd != ''">and zj.province_id = #{provinceIdXjd}</if>
  245. <if test="cityIdXjd != null and cityIdXjd != ''">and zj.city_id = #{cityIdXjd}</if>
  246. <if test="regionIdXjd != null and regionIdXjd != ''">and zj.region_id = #{regionIdXjd}</if>
  247. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and zj.town_id = #{villageTownsIdXjd}</if>
  248. <if test="villageIdXjd != null and villageIdXjd != ''">and zj.village_id = #{villageIdXjd}</if>
  249. order by rz.create_time DESC
  250. </select>
  251. <select id="detailedInfoByIdCard" resultMap="AccountingDataResult">
  252. select r.user_name as xm, r.phone_num, r.id_card as zjhm,
  253. z.province as provinceXjd , z.city as cityXjd,z.region as regionXjd , z.town as villageTownsXjd, z.village as
  254. villageXjd,z.now_in as nowXjd,d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj,
  255. r.province,r.city,r.region,r.village_towns,r.village,r.now_in
  256. from czrk r left join czrk_jzdz z on r.id =z.czrk_id
  257. left join `accounting_data` d on r.id_card = d.zjhm
  258. <where>
  259. r.is_del = 'N'
  260. and r.status = '1'
  261. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  262. <if test="cjsj != null and cjsj != '' and cjsj != 'null'">
  263. and d.cjsj = #{cjsj}
  264. </if>
  265. </where>
  266. limit 1
  267. </select>
  268. <insert id="insertAccountingData" useGeneratedKeys="true" keyProperty="id">
  269. insert into accounting_data
  270. <trim prefix="(" suffix=")" suffixOverrides=",">
  271. <if test="id != null">id,</if>
  272. <if test="jcsj != null">jcsj,</if>
  273. <if test="lxdh != null">lxdh,</if>
  274. <if test="address != null">address,</if>
  275. <if test="batchNumber != null">batch_number,</if>
  276. <if test="focusPerson != null">focus_person,</if>
  277. <if test="jcjg != null">jcjg,</if>
  278. <if test="fromCity != null">from_city,</if>
  279. <if test="jcdd != null">jcdd,</if>
  280. <if test="cjdd != null">cjdd,</if>
  281. <if test="toCity != null">to_city,</if>
  282. <if test="source != null">source,</if>
  283. <if test="zjhm != null">zjhm,</if>
  284. <if test="cjsj != null">cjsj,</if>
  285. <if test="certificateNoType != null">certificate_no_type,</if>
  286. <if test="xm != null">xm,</if>
  287. <if test="collectorName != null">collector_name,</if>
  288. <if test="cjqxqh != null">cjqxqh,</if>
  289. <if test="cjssxq != null">cjssxq,</if>
  290. <if test="createBy != null">create_by,</if>
  291. create_time
  292. </trim>
  293. <trim prefix="values (" suffix=")" suffixOverrides=",">
  294. <if test="id != null">#{id},</if>
  295. <if test="jcsj != null">#{jcsj},</if>
  296. <if test="lxdh != null">#{lxdh},</if>
  297. <if test="address != null">#{address},</if>
  298. <if test="batchNumber != null">#{batchNumber},</if>
  299. <if test="focusPerson != null">#{focusPerson},</if>
  300. <if test="jcjg != null">#{jcjg},</if>
  301. <if test="fromCity != null">#{fromCity},</if>
  302. <if test="jcdd != null">#{jcdd},</if>
  303. <if test="cjdd != null">#{cjdd},</if>
  304. <if test="toCity != null">#{toCity},</if>
  305. <if test="source != null">#{source},</if>
  306. <if test="zjhm != null">#{zjhm},</if>
  307. <if test="cjsj != null">#{cjsj},</if>
  308. <if test="certificateNoType != null">#{certificateNoType},</if>
  309. <if test="xm != null">#{xm},</if>
  310. <if test="collectorName != null">#{collectorName},</if>
  311. <if test="cjqxqh != null">#{cjqxqh},</if>
  312. <if test="cjssxq != null">#{cjssxq},</if>
  313. <if test="createBy != null">#{createBy},</if>
  314. sysdate()
  315. </trim>
  316. </insert>
  317. <select id="selectById" parameterType="String" resultType="int">
  318. select count(1)
  319. from accounting_data
  320. where zjhm = #{zjhm} and cjsj = #{cjsj}
  321. </select>
  322. <select id="getExportHj" resultMap="AccountingDataResult">
  323. SELECT
  324. r.id,r.user_name as xm,r.id_card as zjhm,r.code as hjh,r.is_nucleicAcid as isNucleicAcid,
  325. r.province,r.city,r.region,r.village_towns,r.village,r.now_in,r.phone_num,
  326. d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj,
  327. z.province as provinceXjd , z.city as cityXjd,z.region as regionXjd , z.town as villageTownsXjd, z.village as
  328. villageXjd,z.now_in
  329. FROM czrk r
  330. left join `accounting_data` d on r.id_card = d.zjhm
  331. left join czrk_jzdz z on r.id =z.czrk_id
  332. <where>
  333. r.is_del = 'N'
  334. and r.status = '1'
  335. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  336. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  337. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  338. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  339. </if>
  340. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  341. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  342. </if>
  343. <if test="provinceId != null and provinceId != ''">and r.province_id = #{provinceId}</if>
  344. <if test="cityId != null and cityId != ''">and r.city_id = #{cityId}</if>
  345. <if test="regionId != null and regionId != ''">and r.region_id = #{regionId}</if>
  346. <if test="villageTownsId != null and villageTownsId != ''">and r.village_towns_id = #{villageTownsId}</if>
  347. <if test="villageId != null and villageId != ''">and r.village_id = #{villageId}</if>
  348. </where>
  349. order by d.cjsj DESC,r.create_time DESC
  350. </select>
  351. <select id="getExportHjNo" resultMap="AccountingDataResult">
  352. SELECT
  353. zr.id,zr.user_name as xm,zr.id_card as zjhm,zr.code as hjh,zr.is_nucleicAcid as isNucleicAcid,
  354. zr.province,zr.city,zr.region,zr.village_towns,zr.village,zr.now_in,zr.phone_num,
  355. zj.province as provinceXjd , zj.city as cityXjd,zj.region as regionXjd , zj.town as villageTownsXjd, zj.village
  356. as
  357. villageXjd,zj.now_in
  358. FROM czrk zr
  359. left join czrk_jzdz zj on zr.id =zj.czrk_id
  360. where zr.id_card not in (
  361. SELECT
  362. r.id_card
  363. FROM czrk r
  364. left join `accounting_data` d on r.id_card = d.zjhm
  365. <where>
  366. r.is_del = 'N'
  367. and r.status = '1'
  368. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  369. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  370. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  371. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  372. </if>
  373. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  374. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  375. </if>
  376. <if test="provinceId != null and provinceId != ''">and r.province_id = #{provinceId}</if>
  377. <if test="cityId != null and cityId != ''">and r.city_id = #{cityId}</if>
  378. <if test="regionId != null and regionId != ''">and r.region_id = #{regionId}</if>
  379. <if test="villageTownsId != null and villageTownsId != ''">and r.village_towns_id = #{villageTownsId}</if>
  380. <if test="villageId != null and villageId != ''">and r.village_id = #{villageId}</if>
  381. </where>
  382. )
  383. and zr.is_del = 'N'
  384. and zr.status = '1'
  385. <if test="zjhm != null and zjhm != ''">and zr.id_card = #{zjhm}</if>
  386. <if test="xm != null and xm != ''">and zr.user_name like concat(#{xm}, '%')</if>
  387. <if test="provinceId != null and provinceId != ''">and zr.province_id = #{provinceId}</if>
  388. <if test="cityId != null and cityId != ''">and zr.city_id = #{cityId}</if>
  389. <if test="regionId != null and regionId != ''">and zr.region_id = #{regionId}</if>
  390. <if test="villageTownsId != null and villageTownsId != ''">and zr.village_towns_id = #{villageTownsId}</if>
  391. <if test="villageId != null and villageId != ''">and zr.village_id = #{villageId}</if>
  392. order by zr.create_time DESC
  393. </select>
  394. <select id="exportCz" resultMap="AccountingDataResult">
  395. select
  396. r.id,r.user_name as xm,r.id_card as zjhm,r.code as hjh,r.is_nucleicAcid as isNucleicAcid,
  397. r.province,r.city,r.region,r.village_towns,r.village,r.now_in,r.phone_num,
  398. d.lxdh,d.jcsj,d.jcdd,d.cjdd,d.cjsj,
  399. z.province as provinceXjd , z.city as cityXjd,z.region as regionXjd , z.town as villageTownsXjd, z.village as
  400. villageXjd,z.now_in
  401. from czrk r
  402. left join czrk_jzdz z on r.id =z.czrk_id
  403. left join `accounting_data` d on r.id_card = d.zjhm
  404. <where>
  405. r.is_del = 'N'
  406. and r.status = '1'
  407. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  408. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  409. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  410. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  411. </if>
  412. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  413. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  414. </if>
  415. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  416. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  417. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  418. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  419. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  420. </where>
  421. order by d.cjsj DESC,r.create_time DESC
  422. </select>
  423. <select id="exportCzjNo" resultMap="AccountingDataResult">
  424. select
  425. zr.id,zr.user_name as xm,zr.id_card as zjhm,zr.code as hjh,zr.is_nucleicAcid as isNucleicAcid,
  426. zr.province,zr.city,zr.region,zr.village_towns,zr.village,zr.now_in,zr.phone_num,
  427. zj.province as provinceXjd , zj.city as cityXjd,zj.region as regionXjd , zj.town as villageTownsXjd, zj.village
  428. as
  429. villageXjd,zj.now_in
  430. from czrk zr
  431. left join czrk_jzdz zj on zr.id =zj.czrk_id
  432. where zr.id_card not in (
  433. select
  434. r.id_card
  435. from czrk r
  436. left join czrk_jzdz z on r.id =z.czrk_id
  437. left join `accounting_data` d on r.id_card = d.zjhm
  438. <where>
  439. r.is_del = 'N'
  440. and r.status = '1'
  441. <if test="zjhm != null and zjhm != ''">and r.id_card = #{zjhm}</if>
  442. <if test="xm != null and xm != ''">and r.user_name like concat(#{xm}, '%')</if>
  443. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  444. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  445. </if>
  446. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  447. DATE_FORMAT(d.cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  448. </if>
  449. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  450. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  451. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  452. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  453. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  454. </where>
  455. )
  456. and zr.is_del = 'N'
  457. and zr.status = '1'
  458. <if test="zjhm != null and zjhm != ''">and zr.id_card = #{zjhm}</if>
  459. <if test="xm != null and xm != ''">and zr.user_name like concat(#{xm}, '%')</if>
  460. <if test="provinceIdXjd != null and provinceIdXjd != ''">and zj.province_id = #{provinceIdXjd}</if>
  461. <if test="cityIdXjd != null and cityIdXjd != ''">and zj.city_id = #{cityIdXjd}</if>
  462. <if test="regionIdXjd != null and regionIdXjd != ''">and zj.region_id = #{regionIdXjd}</if>
  463. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and zj.town_id = #{villageTownsIdXjd}</if>
  464. <if test="villageIdXjd != null and villageIdXjd != ''">and zj.village_id = #{villageIdXjd}</if>
  465. order by zr.create_time DESC
  466. </select>
  467. <select id="getAccountingDataOne" resultMap="AccountingDataResult">
  468. select id, cjsj, lxdh, create_date, modify_date
  469. FROM accounting_data
  470. order by cjsj desc limit 1;
  471. </select>
  472. <select id="getAllData" resultMap="AccountingDataResult">
  473. select id, cjsj, lxdh, create_date, zjhm, xm
  474. FROM accounting_data
  475. </select>
  476. <select id="thirdNucleicAcid" resultMap="AccountingDataResult">
  477. SELECT
  478. sfzhm as zjhm
  479. ,xm as xm
  480. ,sjhm as lxdh
  481. ,cjsj as cjsj
  482. ,jgcjss as jcsj
  483. ,jcdd as jcdd
  484. ,jcjg as jcjg
  485. ,cjdd as cjdd
  486. ,sjly as cjssxq
  487. FROM
  488. ods_qss_hsjcxx_all
  489. WHERE
  490. 1 = 1
  491. and sjly != '东软系统'
  492. AND (
  493. cjsj > #{startTime}
  494. AND #{endTime} >= cjsj
  495. )
  496. UNION
  497. SELECT
  498. s.id_card_no AS zjhm,
  499. s.user_name AS xm,
  500. s.user_phone AS lxdh,
  501. s.collect_datetime AS cjsj,
  502. r.testing_datetime AS jcsj,
  503. t.testing_site_name AS jcdd,
  504. (
  505. CASE
  506. WHEN r.sign_name = 'negative' THEN
  507. '0'
  508. ELSE
  509. '1'
  510. END
  511. ) AS jcjg,
  512. s.collect_site_name AS cjdd,
  513. c.town AS cjssxq
  514. FROM `tb_whole_testing_sample_921` s
  515. LEFT JOIN tb_whole_testing_result_921 r ON s.id = r.id
  516. LEFT JOIN tb_whole_collect_site_city c ON s.collect_site_code = c.id
  517. LEFT JOIN tb_testing_site_921 t ON t.testing_site_code = r.testing_site_code
  518. where s.create_datetime > #{startTime} and #{endTime}>=s.create_datetime
  519. </select>
  520. <select id="tongjiHjZ" resultType="java.lang.Integer">
  521. SELECT count(1)
  522. from (
  523. SELECT ANY_VALUE(concat(r.id_card, '\t'))
  524. FROM czrk r
  525. left join `accounting_data` d on r.id_card = d.zjhm
  526. where r.is_del = 'N'
  527. and r.status = '1'
  528. and d.cjsj > #{startTime}
  529. and #{endTime} >= d.cjsj
  530. and r.village_towns_id = #{areaId}
  531. GROUP BY zjhm) a;
  532. </select>
  533. <select id="tongjiCzZ" resultType="java.lang.Integer">
  534. SELECT count(1)
  535. from (select ANY_VALUE(r.id_card)
  536. from czrk_jzdz z
  537. left join czrk r on r.id = z.czrk_id
  538. left join `accounting_data` d on r.id_card = d.zjhm
  539. where r.is_del = 'N'
  540. and r.status = '1'
  541. and d.cjsj > #{startTime}
  542. and #{endTime} >= d.cjsj
  543. and z.town_id = #{areaId}
  544. GROUP BY zjhm) a;
  545. </select>
  546. <select id="tongjiHjC" resultType="java.lang.Integer">
  547. SELECT count(1)
  548. from (
  549. SELECT ANY_VALUE(concat(r.id_card, '\t'))
  550. FROM czrk r
  551. left join `accounting_data` d on r.id_card = d.zjhm
  552. where r.is_del = 'N'
  553. and r.status = '1'
  554. and d.cjsj > #{startTime}
  555. and #{endTime} >= d.cjsj
  556. and r.village_id = #{areaId}
  557. GROUP BY zjhm) a;
  558. </select>
  559. <select id="tongjiCzC" resultType="java.lang.Integer">
  560. SELECT count(1)
  561. from (select ANY_VALUE(r.id_card)
  562. from czrk_jzdz z
  563. left join czrk r on r.id = z.czrk_id
  564. left join `accounting_data` d on r.id_card = d.zjhm
  565. where r.is_del = 'N'
  566. and r.status = '1'
  567. and d.cjsj > #{startTime}
  568. and #{endTime} >= d.cjsj
  569. and z.village_id = #{areaId}
  570. GROUP BY zjhm) a;
  571. </select>
  572. <select id="selectWanShiTongList" resultMap="AccountingDataResult">
  573. SELECT
  574. sfzhm as zjhm
  575. ,xm as xm
  576. ,sjhm as lxdh
  577. ,cjsj as cjsj
  578. ,jgcjss as jcsj
  579. ,jcdd as jcdd
  580. ,jcjg as jcjg
  581. ,sjly as cjdd
  582. FROM
  583. ods_qss_hsjcxx_all
  584. <where> 1=1
  585. <if test="zjhm != null and zjhm != ''">and sfzhm = #{zjhm}</if>
  586. <if test="params.startTime != null and params.startTime != '' and params.startTime != 'null'">and
  587. DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &gt;= DATE_FORMAT(#{params.startTime},'%Y-%m-%d %H:%i:%s')
  588. </if>
  589. <if test="params.endTime != null and params.endTime != '' and params.endTime != 'null'">and
  590. DATE_FORMAT(cjsj,'%Y-%m-%d %H:%i:%s') &lt;= DATE_FORMAT(#{params.endTime},'%Y-%m-%d %H:%i:%s')
  591. </if>
  592. </where>
  593. order by cjsj desc
  594. </select>
  595. <select id="selectWanShiTongInfo" resultMap="AccountingDataResult">
  596. SELECT
  597. sfzhm as zjhm
  598. ,xm as xm
  599. ,sjhm as lxdh
  600. ,cjsj as cjsj
  601. ,jgcjss as jcsj
  602. ,jcdd as jcdd
  603. ,jcjg as jcjg
  604. ,sjly as cjdd
  605. FROM
  606. ods_qss_hsjcxx_all
  607. WHERE
  608. 1 = 1
  609. AND cjsj like concat(#{cjsj}, '%')
  610. AND sfzhm = #{zjhm}
  611. limit 1
  612. </select>
  613. <select id="detailedJcd" resultMap="AccountingDataResult">
  614. <include refid="selectAccountingDataVo"/>
  615. where id = #{id}
  616. </select>
  617. <select id="selectRepeat" resultType="java.lang.Integer"
  618. parameterType="com.boman.web.core.domain.vo.AccountingDataVo">
  619. select count(1) from accounting_data
  620. <where>
  621. 1=1
  622. <if test="zjhm != null and zjhm != ''">and zjhm = #{zjhm}</if>
  623. <if test="xm != null and xm != ''">and xm = #{xm}</if>
  624. <if test="lxdh != null and lxdh != ''">and lxdh = #{lxdh}</if>
  625. <if test="cjsj != null and cjsj != '' and cjsj != 'null'">and
  626. cjsj = #{cjsj}
  627. </if>
  628. </where>
  629. </select>
  630. </mapper>