2020-03-12.sql 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. -- ----------------------------
  2. -- Table structure for KW_CHECK_ITEM
  3. -- ----------------------------
  4. --DROP TABLE "KW_CHECK_ITEM";
  5. CREATE TABLE "KW_CHECK_ITEM" (
  6. "ID" NUMBER NOT NULL,
  7. "TYPE" VARCHAR2(50 BYTE),
  8. "ITEM" VARCHAR2(255 BYTE),
  9. "FIELDS" VARCHAR2(255 BYTE),
  10. "ALIAS" VARCHAR2(255 BYTE),
  11. "SQL" CLOB
  12. )
  13. -- ----------------------------
  14. -- Records of KW_CHECK_ITEM
  15. -- ----------------------------
  16. INSERT INTO "KW_CHECK_ITEM" VALUES ('8', '编排', '考场试卷数大于等于编排考生数', '批次,考区,考点,考场号', 'year_code,org_name,unit_name,room_code', 'select e.year_code,
  17. o.org_code || ''-'' || o.org_name org_name,
  18. eu.unit_code || ''-'' || eu.unit_name unit_name,
  19. r.room_code
  20. from kw_layout l,
  21. kw_layout_volume_course v,
  22. kw_layout_room r,
  23. pl_exam_time e,
  24. kw_exam_point p,
  25. kw_exam_unit eu,
  26. cf_organization o
  27. where l.id = r.layout_id
  28. and v.room_id = r.id
  29. and r.exam_time_id = e.id
  30. and p.id = l.exam_point_id
  31. and eu.id = l.exam_unit_id
  32. and o.id = p.org_id
  33. and e.year_code = ?
  34. and v.bag_capacity < v.stu_num
  35. order by o.org_code, p.exam_code, eu.unit_code, r.room_code
  36. ');
  37. INSERT INTO "KW_CHECK_ITEM" VALUES ('10', '编排', '考场存在相同座位号', '批次,考区,考点,考场号,座位号,准考证,姓名', 'year_code,org_name,unit_name,room_code,seat_no,ticket_no,std_name', 'select ? year_code,o.org_name,eu.unit_name,r.room_code,d.seat_no,d.ticket_no,d.std_name
  38. from kw_layout_detail d,kw_layout k,kw_layout_room r,kw_exam_point p,cf_organization o,kw_exam_unit eu
  39. where k.id=r.layout_id and r.id=d.room_id
  40. and p.id=k.exam_point_id
  41. and eu.id=k.exam_unit_id
  42. and o.id=p.org_id
  43. and k.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  44. and exists(
  45. select * from kw_layout_detail d1,kw_layout k1,kw_layout_room r1 where k1.id=r1.layout_id and r1.id=d1.room_id and k1.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  46. and k.exam_times=k1.exam_times and r1.exam_point_id=r.exam_point_id and r1.exam_unit_id=r.exam_unit_id and d1.room_id=d.room_id and d1.seat_no=d.seat_no
  47. and d1.id<>d.id
  48. )
  49. order by o.org_code,eu.unit_code,r.room_code,d.seat_no
  50. ');
  51. INSERT INTO "KW_CHECK_ITEM" VALUES ('11', '编排', '同时段存在同一考生', '批次,考区,考点,考场号,座位号,准考证,姓名', 'year_code,org_name,unit_name,room_code,seat_no,ticket_no,std_name', 'select ? year_code,o.org_name,eu.unit_name,r.room_code,d.seat_no,d.ticket_no,d.std_name
  52. from kw_layout_detail d,kw_layout k,kw_layout_room r,kw_exam_point p,cf_organization o,kw_exam_unit eu
  53. where k.id=r.layout_id and r.id=d.room_id
  54. and p.id=k.exam_point_id
  55. and eu.id=k.exam_unit_id
  56. and o.id=p.org_id
  57. and k.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  58. and exists(
  59. select * from kw_layout_detail d1,kw_layout k1,kw_layout_room r1 where k1.id=r1.layout_id and r1.id=d1.room_id and k1.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  60. and k.exam_times=k1.exam_times
  61. and d1.reg_id=d.reg_id
  62. and d1.id<>d.id
  63. )
  64. order by o.org_code,eu.unit_code,r.room_code,d.seat_no
  65. ');
  66. INSERT INTO "KW_CHECK_ITEM" VALUES ('12', '编排', '同一考生相同时间在不同考场', '准考证,姓名,场次', 'ticket_no,std_name,exam_times', 'select d.ticket_no,d.std_name,k.exam_times
  67. from kw_layout_detail d,kw_layout k,kw_layout_room r where k.id=r.layout_id and r.id=d.room_id and k.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  68. group by k.exam_times,d.ticket_no,d.std_name
  69. having count(1)>1
  70. order by d.ticket_no
  71. ');
  72. INSERT INTO "KW_CHECK_ITEM" VALUES ('13', '编排', '编排课程与报考课程一致性', '报考课程数,编排课程数', 'enrolcount,layoutcount', 'select enrolcount,layoutcount from (
  73. select
  74. (select count(distinct a.course_id)
  75. from std_enrol a where a.fee_status=1 and a.year_code=? ) enrolcount,
  76. (select count(distinct d.course_id) from kw_layout_detail d,kw_layout k,kw_layout_room r where k.id=r.layout_id and r.id=d.room_id and k.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  77. ) layoutcount
  78. from dual
  79. ) where enrolcount<>layoutcount
  80. ');
  81. INSERT INTO "KW_CHECK_ITEM" VALUES ('9', '编排', '报考科次小于编排科目试卷数', '批次,考区,课程', 'year_code,org_name,course_name', 'select * from (
  82. select a.year_code,a.enrol_agent_id org_id,o.org_code||o.org_name org_name, a.course_id,o.org_code,
  83. pc.course_code||pc.course_name course_name,count(1) total
  84. from std_enrol a
  85. left join cf_organization o on o.id=a.enrol_agent_id
  86. left join pl_course pc on pc.id=a.course_id
  87. where a.fee_status=1 and a.year_code=?
  88. group by a.year_code,a.enrol_agent_id,a.course_id,o.org_code,o.org_name,pc.course_code,pc.course_name
  89. ) c where exists (
  90. select * from (
  91. select p.org_id,
  92. vc.course_id,
  93. sum(bag5)*5+sum(bag15)*15+sum(bag30)*30 total
  94. from (
  95. select
  96. v.id,v.room_id,v.course_id,v.security_code,
  97. case when v.stu_num <=5 and v.stu_num>0 then 1 else 0 end bag5,
  98. case when v.stu_num <=15 and v.stu_num>5 then 1 else 0 end bag15,
  99. case when v.stu_num <=30 and v.stu_num>15 then 1 else 0 end bag30
  100. from kw_layout_volume_course v
  101. ) vc
  102. left join kw_layout_room ro on ro.id=vc.room_id
  103. left join kw_layout ly on ly.id=ro.layout_id
  104. left join kw_exam_point p
  105. on (p.exam_time_id=ly.exam_time_id and p.id=ly.exam_point_id)
  106. where ly.exam_time_id=(select pe.id from pl_exam_time pe where pe.year_code=?)
  107. group by p.org_id,vc.course_id
  108. ) d where d.course_id=c.course_id and d.org_id=c.org_id and d.total<c.total
  109. )
  110. order by c.org_code,c.course_name');
  111. INSERT INTO "KW_CHECK_ITEM" VALUES ('1', '报考', '同一天跨市报考', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select distinct c.* from (
  112. select a.*,o.org_name,o.city_code,m.major_name,pc.course_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  113. from std_enrol a ,cf_organization o,pl_major m,pl_course pc,std_reg_info r ,frame_dict et ,frame_dict st
  114. where a.enrol_agent_id=o.id and r.id=a.std_reg_id
  115. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  116. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  117. and a.major_id=m.id
  118. and a.course_id=pc.id
  119. and a.fee_status=1
  120. and a.status>=4
  121. and a.year_code=201910
  122. ) c where exists
  123. (
  124. select 1
  125. from std_enrol b , cf_organization p
  126. where b.enrol_agent_id=p.id
  127. and b.fee_status=1
  128. and b.status>=4
  129. and b.year_code=c.year_code
  130. and (
  131. (b.std_reg_id=c.std_reg_id and b.exam_batch in(''A'',''B'') and c.exam_batch in(''A'',''B'') and p.city_code <> c.city_code) or
  132. (b.std_reg_id=c.std_reg_id and b.exam_batch in(''C'',''D'') and c.exam_batch in(''C'',''D'') and p.city_code <> c.city_code)
  133. )
  134. )
  135. order by c.ticket_no
  136. ');
  137. INSERT INTO "KW_CHECK_ITEM" VALUES ('6', '编排', '编排与报考一致性', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select a.*,o.org_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  138. from std_enrol a ,cf_organization o,std_reg_info r ,frame_dict et ,frame_dict st
  139. where o.id=a.enrol_agent_id and r.id=a.std_reg_id
  140. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  141. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  142. and o.org_type=4
  143. and a.fee_status=1
  144. and a.status>=4
  145. and a.year_code=201910
  146. and not exists (select 1 from kw_layout_detail d where d.course_id=a.course_id and d.reg_id=a.std_reg_id and d.exam_time_id=a.exam_time_id)
  147. order by a.ticket_no
  148. ');
  149. INSERT INTO "KW_CHECK_ITEM" VALUES ('2', '报考', '报考场次与课程计划场次不同', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select a.*,o.org_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  150. from std_enrol a ,cf_organization o,std_reg_info r ,frame_dict et ,frame_dict st
  151. where o.id=a.enrol_agent_id and r.id=a.std_reg_id
  152. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  153. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  154. and a.fee_status=1
  155. and a.status>=4
  156. and a.year_code=?
  157. and not exists (
  158. select * from pl_merge_publish_plan p where p.year_code=a.year_code and a.course_id=p.course_id and a.exam_batch=p.exam_time
  159. )
  160. order by a.ticket_no
  161. ');
  162. INSERT INTO "KW_CHECK_ITEM" VALUES ('3', '报考', '课程指定', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select a.*,o.org_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  163. from std_enrol a ,cf_organization o,std_reg_info r ,frame_dict et ,frame_dict st
  164. where o.id=a.enrol_agent_id and r.id=a.std_reg_id
  165. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  166. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  167. and o.org_type=4
  168. and a.fee_status=1
  169. and a.status>=4
  170. and a.year_code=?
  171. and exists (
  172. select * from pl_exam_area_course e where e.exam_time_id=a.exam_time_id and e.course_id=a.course_id
  173. )
  174. and not exists (
  175. select * from pl_exam_area_course e where e.exam_time_id=a.exam_time_id and e.course_id=a.course_id and e.org_id=a.enrol_agent_id
  176. )
  177. order by a.ticket_no
  178. ');
  179. INSERT INTO "KW_CHECK_ITEM" VALUES ('4', '报考', '课程限制', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select a.*,o.org_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  180. from std_enrol a ,cf_organization o,std_reg_info r ,frame_dict et ,frame_dict st
  181. where o.id=a.enrol_agent_id and r.id=a.std_reg_id
  182. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  183. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  184. and o.org_type=4
  185. and a.fee_status=1
  186. and a.status>=4
  187. and a.year_code=?
  188. and exists (
  189. select * from pl_exam_area_course_limit e where e.exam_time_id=a.exam_time_id and e.course_id=a.course_id and e.org_id=a.enrol_agent_id
  190. )
  191. order by a.ticket_no
  192. ');
  193. INSERT INTO "KW_CHECK_ITEM" VALUES ('5', '报考', '报考不存在支付成功订单', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select a.*,o.org_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  194. from std_enrol a ,cf_organization o,std_reg_info r ,frame_dict et ,frame_dict st
  195. where o.id=a.enrol_agent_id and r.id=a.std_reg_id
  196. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  197. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  198. and o.org_type=4
  199. and a.fee_status=1
  200. and a.status>=4
  201. and a.year_code=?
  202. and not exists (
  203. select * from pay_bill_union b where b.business_id=a.id and b.bill_status=''success''
  204. )
  205. order by a.ticket_no
  206. ');
  207. INSERT INTO "KW_CHECK_ITEM" VALUES ('7', '编排', '编排场次与报考场次一致性', '批次,准考证,姓名,电话,课程,报考考区,考试场次,报考类型,报考时间,收费标准,报考状态', 'year_code,ticket_no,std_name,sdt_dh,course_code,org_name,exam_batch,enrol_type_name,create_time,fee_price,status_name', 'select a.*,o.org_name,r.std_dh,et.dict_text enrol_type_name,st.dict_text status_name
  208. from std_enrol a ,cf_organization o,std_reg_info r ,frame_dict et ,frame_dict st
  209. where o.id=a.enrol_agent_id and r.id=a.std_reg_id
  210. and et.dict_name=''EnrolType'' and et.dict_value=a.enrol_type
  211. and st.dict_name=''enrol_status'' and st.dict_value=a.status
  212. and o.org_type=4
  213. and a.fee_status=1
  214. and a.status>=4
  215. and a.year_code=?
  216. and not exists (
  217. select * from kw_layout_detail d ,kw_layout_room r,kw_layout l
  218. where d.room_id=r.id and r.layout_id=l.id
  219. and d.exam_time_id=a.exam_time_id
  220. and a.id=d.enrol_id
  221. and a.exam_batch=l.exam_times
  222. )
  223. order by a.ticket_no
  224. ');
  225. COMMIT;
  226. COMMIT;
  227. -- ----------------------------
  228. -- Primary Key structure for table KW_CHECK_ITEM
  229. -- ----------------------------
  230. ALTER TABLE "KW_CHECK_ITEM" ADD CONSTRAINT "SYS_C007498" PRIMARY KEY ("ID");
  231. -- ----------------------------
  232. -- Checks structure for table KW_CHECK_ITEM
  233. -- ----------------------------
  234. ALTER TABLE "KW_CHECK_ITEM" ADD CONSTRAINT "SYS_C007497" CHECK ("ID" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
  235. INSERT INTO "FRAME_RES"("RES_ID", "RES_NAME", "RES_ALIAS", "RES_URL", "RES_PID", "RES_LEVEL", "RES_TYPE", "RES_CSS", "RES_STATUS", "RES_ORDER", "RES_DESC") VALUES ('478', '数据校验', NULL, '/hmsoft/kw/checkitem', '10000', '2', 'Menu', NULL, 'Active', '10', NULL);