zhouna 3 years ago
parent
commit
7570ed0003
1 changed files with 45 additions and 31 deletions
  1. 45 31
      src/js/qcScore.js

+ 45 - 31
src/js/qcScore.js

@@ -5,6 +5,7 @@ require('./modal.js');
 const { post, getUrlArgObject, setBoxHeight, getCookie, getLocal, initScroll } = require('./utils.js');
 const { api, ywCheckApi } = require('./api.js');
 let checkOk = require('./../images/checkOk.png')
+const loadingImg = require("./../images/loading.gif")
 const adLogo = require("../images/adlogo.png")
 if (localStorage.getItem('toLogin') === '1') {
   window.location.href = '../login.html';
@@ -45,12 +46,6 @@ $(function () {
     });
   }
   $("body").on("click", ".refreshBtn", function () {
-    // $(".flaw-box").html('')
-    // $(".patient-info").html('')
-    // $("#subMenu").html('')
-    
-    // console.log(global_activeTab);
-    // getRecordDetailUpdate2()
     supplementData()
   });
   function showAppealDetailEvent() {
@@ -233,38 +228,57 @@ $(function () {
       }
     });
   }
-  function getRecordDetailUpdate2() {
-    post(api.getRecordDetail, { 'behospitalCode': global_id }).then(function (res) {
-      if (res.data.code === '0') {
-        const data = res.data.data;
-        const { beHospital, result, msg, checkStatus, drgs } = data;
-        // global_check = checkStatus
-        // const info=Object.assign(beHospital,result);
-        // initMenu(JSON.parse(result.menuData));
-        // $(".subMenu >li:first-child.page,.menu-mini>ul>li:first-child.page").addClass("active");
-        // global_activeTab=$(".sub-menu .page.active").attr("code");
-        // initPatientInfo(info);
-        initContent(result.pageData,1);
-        initScoreItem(msg);
-        global_flawData = msg;
-        global_flawDataPay = drgs;
-        // setBoxHeight();
-        // changePay()
-      }
-    });
-  }
+  //补录数据,接口来自技术服务部
   function supplementData() {
-    post(api.supplementData, { 'behospitalCode': global_id,'behospitalNum':1 }).then(function (res) {
-      if (res.data.code === '0') {
-        $("#contentInfo").html('')
-        getRecordDetailUpdate2()
+    //重新拉数据接口
+    post(api.supplementData, { 'behospitalCode': global_id,'behospitalNum':'' }).then(function (res) {
+      const {code,data}=res.data;
+      if (code === '0') {
+        if(data==='0'){ //0表示数据已更新,-1表示数据未更新
+          //数据更新后先评分(评分成功后)再重新获取详情即刷新页面
+		  recordScore();
+        }else{
+		  $.alerModal({ "message": '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
+		}
       }else{
         $.alerModal({ "message": '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
       }
     });
   }
 
-  
+  function loading() {
+	const str = `
+    <div class="loadingBox">
+            <div class="mask"></div>
+            <img class="loadingImg" src=${loadingImg}  alt="loading" />
+        </div>
+    `
+	$("body", parent.document).append(str)
+  }
+  function hideLoading() {
+	$(".loadingBox", parent.document).remove()
+  }
+//评分
+  function recordScore() {
+	const param = {
+	  behospitalCode: global_id
+	};
+	loading();
+	post(api.recordScore, param).then(res => {
+	  if (res.data.code === '0') {
+		  hideLoading();
+		  //评分成功,刷新病历详情页面
+          window.parent.location.reload()
+	  } else {
+		hideLoading()
+        $.alerModal({ "message": res.data.msg || '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
+	  }
+	}).catch(() => {
+	  hideLoading()
+		$.alerModal({ "message": '刷新失败,请重试~', type: "tip", win: 'default', time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
+	})
+  }
+
   function changePay() {
     $(document).on('click', ".titleSpecial span", function () {
       let type = $(this).attr("data-type")