platform-abnormal.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. $(function () {
  2. var Util = $.Util;
  3. new Vue({
  4. el: "#app",
  5. data: {
  6. isInit1: false,
  7. // dataSource:'',//数据元
  8. dataArr:'',//数据集
  9. metedata:{},
  10. relation:{},
  11. externalParams:JSON.parse(Util.getUrlQueryString('externalParams')) || {},
  12. },
  13. mounted: function () {
  14. this.initData()
  15. // $(".resource-info tr").find("td:eq(0),td:eq(2),td:eq(4)").css("background-color", "#E0ECFF");
  16. // $(".resource-info").find("tr:eq(0)").css("background-color", "#E0ECFF");
  17. },
  18. methods: {
  19. initData: function () {
  20. this.formInit();
  21. var yesterday = new Date(new Date().getTime() - 24 * 3600 * 1000).Format('yyyy-MM-dd');
  22. // $('#start1').val(yesterday);
  23. // $('#end1').val(yesterday);
  24. $("#select1").val('全部');
  25. $("#select2").val('全部');
  26. this.loadGrid1();
  27. this.bindEvents();
  28. },
  29. formInit: function () {
  30. //tab1
  31. var vm = this;
  32. var startTime = vm.externalParams.startTime || "";
  33. var endTime = vm.externalParams.endTime || "";
  34. $("#start1").ligerDateEditor({
  35. width: 105,initValue:startTime
  36. });
  37. $("#end1").ligerDateEditor({
  38. width: 105,initValue:endTime
  39. });
  40. $("#select1").customCombo(commonApi.organizations, {
  41. sorts: "-createDate",
  42. token:sessionStorage.getItem("accessToken"),
  43. });
  44. $("#dataArr").customCombo(questionQuery.adapterDatasetList, {
  45. token:httpRequest.asstoken,
  46. version:'5a6951bff0bb'
  47. },false,false,false,{
  48. valueField: 'stdDatasetCode',//id
  49. textField: 'stdDatasetName',//name
  50. conditionSearchClick: function(g){
  51. var searchParm = g.rules.length > 0 ? g.rules[0].value : '';
  52. var parms = g.grid.get("parms");
  53. if(searchParm){
  54. parms.filters = "stdDatasetName?"+searchParm+' g1;stdDatasetCode?'+searchParm+' g1;';
  55. }else{
  56. parms.filters = "";
  57. }
  58. g.grid.set({
  59. parms: parms,
  60. newPage: 1
  61. });
  62. g.grid.reload();
  63. }
  64. },{
  65. columns: [
  66. {display : '名称', name :'stdDatasetName',width : 210, align: 'left'}
  67. ],
  68. });
  69. $("#dataSource").customCombo(questionQuery.adapterMetadataList, {
  70. token:httpRequest.asstoken,
  71. version:'5a6951bff0bb'
  72. },false,false,false,{
  73. valueField: 'stdMetadataCode',//id
  74. textField: 'stdMetadataName',//name
  75. conditionSearchClick: function(g){
  76. var searchParm = g.rules.length > 0 ? g.rules[0].value : '';
  77. var parms = g.grid.get("parms");
  78. if(searchParm){
  79. parms.filters = "stdMetadataName?"+searchParm+' g1;stdMetadataCode?'+searchParm+' g1;';
  80. }else{
  81. parms.filters = "";
  82. }
  83. g.grid.set({
  84. parms: parms,
  85. newPage: 1
  86. });
  87. g.grid.reload();
  88. }
  89. },{
  90. columns: [
  91. {display : '名称', name :'stdMetadataName',width : 210, align: 'left'}
  92. ],
  93. });
  94. $("#select2").ligerComboBox({
  95. data: [{
  96. value: "全部",
  97. code: null
  98. }, {
  99. value: "字段值为空",
  100. code: "1"
  101. }, {
  102. value: "值域超出",
  103. code: "2"
  104. },
  105. {
  106. value: "类型错误",
  107. code: "3"
  108. },
  109. {
  110. value: "格式错误",
  111. code: "4"
  112. },
  113. {
  114. value: "资源适配错误",
  115. code: "5"
  116. },
  117. {
  118. value: "字典适配错误",
  119. code: "6"
  120. },
  121. {
  122. value: "转换异常错误",
  123. code: "21"
  124. },
  125. ]
  126. });
  127. //tab2
  128. $("#start2").ligerDateEditor({
  129. width: 105
  130. });
  131. $("#end2").ligerDateEditor({
  132. width: 105
  133. });
  134. },
  135. bindEvents: function () {
  136. var vm = this;
  137. $("#grid1").on("click", ".see-detail-btn", function () {
  138. var code = $(this).data("code");
  139. vm.code1 = code;
  140. questionQuery.metadataErrorDetail({id:code}).then(function(res){
  141. var metedata = res && res.obj && res.obj.metedata;
  142. var relation = res && res.obj && res.obj.relation;
  143. if(metedata){
  144. metedata.qc_error_type = metedata.qc_error_type.toString();
  145. switch(metedata.qc_error_type){
  146. case '0':str='验证正常';break;
  147. case '1':str='字段值为空';break;
  148. case '2':str='值域超出';break;
  149. case '3':str='类型错误';break;
  150. case '4':str='格式错误';break;
  151. case '5':str='资源适配错误';break;
  152. case '6':str='字典适配错误';break;
  153. case '21':str='转换异常错误';break;
  154. }
  155. metedata.qc_error_type =str;
  156. }
  157. if(relation){
  158. if(relation.event_type || relation.event_type===0){
  159. relation.event_type = relation.event_type.toString();
  160. switch(relation.event_type){
  161. case '0':relation.event_type='门诊';break;
  162. case '1':relation.event_type='住院';break;
  163. case '2':relation.event_type='体检';break;
  164. }
  165. }
  166. if(relation.card_type){
  167. relation.card_type = relation.card_type.toString();
  168. switch(relation.card_type){
  169. case '1':relation.card_type='社会保障卡';break;
  170. case '2':relation.card_type='医保卡';break;
  171. case '3':relation.card_type='新农合';break;
  172. case '4':relation.card_type='发行正式卡';break;
  173. case '5':relation.card_type='发行临时卡';break;
  174. case '9':relation.card_type='其他卡类别';break;
  175. }
  176. }
  177. }
  178. vm.metedata =metedata;
  179. vm.relation = relation;
  180. }).catch(function(err){
  181. console.log(err)
  182. })
  183. vm.$refs.leftSilder.show();
  184. setTimeout(function () {
  185. $(".left-slider-box").css("right", "5px");
  186. }, 1)
  187. })
  188. },
  189. backClick: function () {
  190. this.$refs.leftSilder.hide()
  191. },
  192. getfilter:function(){
  193. var filterstr='',org_code= $("#select1").ligerGetComboBoxManager().getValue(),
  194. dataArr=$("#dataArr").ligerGetComboBoxManager().getValue(),dataSource=$("#dataSource").ligerGetComboBoxManager().getValue();
  195. filterstr+='qc_step=3;'
  196. if($('#start1').val()){
  197. filterstr +=( 'receive_date>='+ $('#start1').val() +' 00:00:00;')
  198. }
  199. if($('#end1').val()){
  200. filterstr +=( 'receive_date<='+ $('#end1').val() +' 23:59:59;')
  201. }
  202. if($('#select2').val()){
  203. var errType='';
  204. switch($('#select2').val()){
  205. case '验证正常':errType=0;break;
  206. case '字段值为空':errType=1;break;
  207. case '值域超出':errType=2;break;
  208. case '类型错误':errType=3;break;
  209. case '格式错误':errType=4;break;
  210. case '资源适配错误':errType=5;break;
  211. case '字典适配错误':errType=6;break;
  212. case '转换异常错误':errType=21;break;
  213. }
  214. if(errType || errType===0){
  215. filterstr +=( 'qc_error_type='+ errType+';')
  216. }
  217. }
  218. if(dataSource){
  219. filterstr +=( 'metadata='+dataSource +';')
  220. }
  221. if(dataArr){
  222. filterstr +=( 'dataset='+dataArr+';')
  223. }
  224. if(org_code){
  225. filterstr +="org_code=" + org_code + ";";
  226. }
  227. return filterstr
  228. // var str = 'filters: receive_date>=2018-04-01 09:50:00;receive_date<=;org_code=;_id=;event_date>=;event_date<=;patient_name=;demographic_id=;analyze_status=;'
  229. },
  230. loadGrid1: function (isSearch) {
  231. var vm = this;
  232. if (vm.isInit1 && !isSearch) return
  233. vm.isInit1 = true;
  234. var params = {
  235. filters:this.getfilter(),
  236. token:httpRequest.asstoken,
  237. sorts:'-receive_date'
  238. }
  239. $("#grid1").ligerGrid({
  240. url: questionQuery.metadataErrorList,
  241. parms: params,
  242. method: 'get',
  243. pagesizeParmName: 'size',
  244. enabledSort:false,
  245. // checkbox: true,
  246. columns: [
  247. {
  248. display: '上传时间',
  249. name: 'create_date',
  250. align: 'center',
  251. },
  252. {
  253. display: '医疗机构',
  254. name: 'org_name',
  255. align: 'center',
  256. },
  257. {
  258. display: '数据集',
  259. name: 'dataset',
  260. },
  261. {
  262. display: '数据集名称',
  263. name: 'dataset_name',
  264. },
  265. {
  266. display: '数据元',
  267. name: 'metadata',
  268. },
  269. {
  270. display: '数据元名称',
  271. name: 'metadata_name',
  272. },
  273. {
  274. display: '主键',
  275. name: '_id',
  276. },
  277. {
  278. display: '错误原因',
  279. name: 'error_type',
  280. render: function (row) {
  281. var str ='';
  282. row.qc_error_type =row.qc_error_type.toString()
  283. switch(row.qc_error_type){
  284. case '0':str='验证正常';break;
  285. case '1':str='字段值为空';break;
  286. case '2':str='值域超出';break;
  287. case '3':str='类型错误';break;
  288. case '4':str='格式错误';break;
  289. case '5':str='资源适配错误';break;
  290. case '6':str='字典适配错误';break;
  291. case '21':str='转换异常错误';break;
  292. }
  293. return str;
  294. }
  295. },
  296. {
  297. display: '操作',
  298. name: 'operator',
  299. align: 'center',
  300. render: function (row) {
  301. var html = '<a href="#" class="see-detail-btn" data-code="' + row._id + '">查看详情</a>';
  302. return html;
  303. }
  304. }
  305. ]
  306. });
  307. },
  308. downClick:function(){
  309. var vm = this;
  310. var str = questionQuery.archiveDown + vm.detail.pack_id +'?token='+this.token;
  311. window.open(str, '_blank')//档案包下载
  312. },
  313. export1:function(){
  314. if(!$('#start1').val().trim() || !$('#end1').val().trim()){
  315. $.ligerDialog.error('请选择接收时间再导出!');
  316. return
  317. }
  318. var str = exportApi.exportMetadataErrorList +'?filters='+ this.getfilter()+'&token='+httpRequest.asstoken;;
  319. window.open(str)
  320. },
  321. }
  322. })
  323. })