Browse Source

病案首页编辑功能ing

xiezhiming 10 months ago
parent
commit
0d092353b1
5 changed files with 979 additions and 102 deletions
  1. 13 13
      src/html/qcScore.html
  2. 184 0
      src/js/dept/qcScore.json
  3. 606 17
      src/js/qcScore.js
  4. 131 27
      src/js/utils.js
  5. 45 45
      webpack.config.js

+ 13 - 13
src/html/qcScore.html

@@ -40,23 +40,23 @@
     </script>
     <script type="text/html" id="infoTmpl">
         <!-- <button class="refreshBtn">刷新</button> -->
-        <span>病案号:${fileCode}</span>
-        <span>姓名:${name}</span>
-        <span>性别:${sex}</span>
-        <span>年龄:${age}</span>
-        <span>科室:${behDeptName}</span>
-        <span class="level">病历等级:${level}</span>
-        <span class="score">病历得分:${scoreRes}</span>
-        {{if showCheckBtns}}
-        <span class="ywCheck">${checkState===1 ? "重新核查" : "完成核查"}</span>
-        {{/if}}
+    <span>病案号:${fileCode}</span>
+    <span>姓名:${name}</span>
+    <span>性别:${sex}</span>
+    <span>年龄:${age}</span>
+    <span>科室:${behDeptName}</span>
+    <span class="level">病历等级:${level}</span>
+    <span class="score">病历得分:${scoreRes}</span>
+    {{if showCheckBtns}}
+    <span class="ywCheck">${checkState===1 ? "重新核查" : "完成核查"}</span>
+    {{/if}}
     </script>
     <script type="text/html" id="tableTmpl">
          {{if k==="出院诊断"}}
          <table class="embed-table">
              <tr>
                  <td>
-                     <table>
+                     <table class="table-1">
                          <tr>
                              <th>出院诊断</th>
                              <th>疾病编码</th>
@@ -76,7 +76,7 @@
                      </table>
                  </td>
                  <td>
-                     <table>
+                     <table class="table-2">
                          <tr>
                              <th>出院诊断</th>
                              <th>疾病编码</th>
@@ -109,7 +109,7 @@
 -->
          </table>
          {{else}}
-             <table>
+             <table class="opera-table">
          <tr>
              <th rowspan="2">手术及操作编码</th>
              <th rowspan="2">手术及操作日期</th>

+ 184 - 0
src/js/dept/qcScore.json

@@ -0,0 +1,184 @@
+{
+      "dockModeType": "0",
+      "homePages": [
+          {
+              "homePageId": "6512",
+              "hospitalId": 4,
+              "behospitalCode": "6478199_3",
+              "hospitalCode": "475027-6",
+              "hospitalName": "测试医院",
+              "orgCode": "12",
+              "payType": "全自费",
+              "healthCard": null,
+              "behospitalNum": "2",
+              "fileCode": "0000668967",
+              "name": "李1",
+              "sex": "女",
+              "birthday": "1959-11-03",
+              "age": 60,
+              "ageUnit": "岁",
+              "nationality": "中国",
+              "newbornMonth": "1",
+              "newbornDay": "1",
+              "newbornWeight": null,
+              "newbornBehospitalWeight": null,
+              "bornAddress": "安徽省淮北市濉溪县",
+              "bornPlace": "安徽省淮北市",
+              "nation": "汉族",
+              "identityCardNo": null,
+              "jobType": "工人",
+              "marriage": "已婚",
+              "curAddress": "浙江省",
+              "curPhone": "13800000000",
+              "curPostCode": "313100",
+              "residenceAddress": "安徽省淮北市",
+              "residencePostCode": "235100",
+              "workAddress": null,
+              "workPhone": null,
+              "workPostCode": null,
+              "contactName": null,
+              "contactRelation": null,
+              "contactAddress": null,
+              "contactPhone": null,
+              "behospitalWay": null,
+              "behospitalDate": "2020-05-26 12:40:30",
+              "behospitalDept": null,
+              "behospitalWard": null,
+              "behospitalBedId": null,
+              "behospitalBedCode": null,
+              "changeDept": null,
+              "leaveHospitalDate": "2020-05-26 12:40:30",
+              "leaveHospitalDept": null,
+              "leaveHospitalWard": null,
+              "leaveHospitalBedId": null,
+              "leaveHospitalBedCode": null,
+              "behospitalDayNum": null,
+              "outpatientEmrDiagnose": null,
+              "outpatientEmrDiagnoseCode": null,
+              "poisonFactor": null,
+              "poisonFactorCode": null,
+              "pathologyDiagnose": null,
+              "pathologyDiagnoseCode": null,
+              "pathologyDiagnoseId": null,
+              "isMedAllergy": null,
+              "medAllergyName": null,
+              "autopsy": null,
+              "bloodType": null,
+              "rh": null,
+              "deptDirector": null,
+              "directorDoctor": null,
+              "attendingDoctor": null,
+              "behospitalDoctor": null,
+              "responseNurse": null,
+              "studyDoctor": null,
+              "practiceDoctor": null,
+              "encodeMan": null,
+              "homePageQuality": null,
+              "qcDoctor": null,
+              "qcNurse": null,
+              "qcDate": "2020-05-26 12:40:30",
+              "leaveHospitalType": null,
+              "acceptOrgCode": null,
+              "againBehospitalPlan": null,
+              "againBehospitalGoal": null,
+              "tbiBeforeDay": null,
+              "tbiBeforeHour": null,
+              "tbiBeforeMinute": null,
+              "tbiAfterDay": null,
+              "tbiAfterHour": null,
+              "tbiAfterMinute": null,
+              "totalFee": null,
+              "ownFee": null,
+              "generalFee": null,
+              "serviceFee": null,
+              "nurseFee": null,
+              "otherFee": null,
+              "pathologyFee": null,
+              "labFee": null,
+              "pacsFee": null,
+              "clinicDiagnoseFee": null,
+              "notOperationFee": null,
+              "clinicPhysicFee": null,
+              "operationTreatFee": null,
+              "anaesthesiaFee": null,
+              "operationFee": null,
+              "healthTypeFee": null,
+              "chnTreatFee": null,
+              "westernMedFee": null,
+              "antibiosisFee": null,
+              "chnMedFee": null,
+              "chnHerbFee": null,
+              "bloodFee": null,
+              "albumenFee": null,
+              "globulinFee": null,
+              "bloodFactorFee": null,
+              "cellFactorFee": null,
+              "checkMaterialFee": null,
+              "treatMaterialFee": null,
+              "operationMaterialFee": null,
+              "otherTypeFee": null,
+              "singleDiagManage": null,
+              "clinicPathwayManage": null,
+              "isOutpatientBehospital": null,
+              "isLeaveBehospital": null,
+              "isOperationBeforeAfter": null,
+              "isClinicPathology": null,
+              "isRadiatePathology": null,
+              "rescueNum": null,
+              "rescueSuccessNum": null,
+              "isAutoLeavehospital": "否",
+              "returnToType": "好转",
+              "leaveDiags": [
+                  {
+                      "homePageId": "6512",
+                      "hospitalId": 4,
+                      "diagnoseOrderNo": "1",
+                      "diagnoseType": "主要诊断",
+                      "diagnoseTypeShort": "主",
+                      "diagnoseName": "多发性肋骨骨折",
+                      "behospitalType": "有",
+                      "leaveHospitalType": "治愈",
+                      "pathologyDiagnose": null,
+                      "icdCode": "S22.400"
+                  
+        },
+                  {
+                      "homePageId": "6512",
+                      "hospitalId": 4,
+                      "diagnoseOrderNo": "2",
+                      "diagnoseType": "门诊诊断",
+                      "diagnoseTypeShort": "次",
+                      "diagnoseName": "肋骨骨折",
+                      "behospitalType": "有",
+                      "leaveHospitalType": "其他",
+                      "pathologyDiagnose": null,
+                      "icdCode": "S22.300"
+                  
+        }
+              
+      ],
+              "operations": [
+                  {
+                      "homePageId": "6512",
+                      "hospitalId": 4,
+                      "operationOrderNo": "1",
+                      "operationDate": "2020-04-26 10:20:06",
+                      "operationCode": "97.8905",
+                      "operationDoctorId": "1264",
+                      "firstAssistantId": null,
+                      "secondAssistantId": null,
+                      "cutLevel": null,
+                      "healingLevel": null,
+                      "operationName": "胃镜检查",
+                      "operationLevel": "5",
+                      "anaesthesiaName": "静脉麻醉",
+                      "shamOperationName": "胃镜检查"
+                  
+        }
+              
+      ]
+          
+    }
+      
+  ]
+}

+ 606 - 17
src/js/qcScore.js

@@ -2,11 +2,12 @@ require("../css/qcScore.less");
 const $ = require('jquery');
 require('jquery-templates');
 require('./modal.js');
-const { post, getUrlArgObject, setBoxHeight, getCookie, getLocal, initScroll } = require('./utils.js');
+const { post, post1, 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")
+const adLogo = require("../images/adlogo.png");
+const { resolve, reject } = require("bluebird");
 if (localStorage.getItem('toLogin') === '1') {
   window.location.href = '../login.html';
 }
@@ -17,6 +18,9 @@ if (localStorage.getItem('toLogin') === '1') {
  *
 */
 let data_type = 2
+
+
+
 $(function () {
   const hideLogo = getUrlArgObject("hideLg");
   if (hideLogo) {
@@ -43,6 +47,9 @@ $(function () {
   let global_flaws = [];  //缺陷条目列表缓存
   let global_selectedFlaw = {};    //新增时选中的条目信息
   let isPlacefile = getCookie('isPlacefile')
+  let global_diagList
+  let global_operaList
+
   getAllModules();
   let showCheckBtns = global_code === "YH-ZKHC-HCRWLB";
   window.document.title = (showCheckBtns ? "质控核查-" : "质控评分-") + getUrlArgObject("name");
@@ -214,6 +221,17 @@ $(function () {
         initScoreItem(msg);
         global_flawData = msg;
         global_flawDataPay = drgs;
+
+        const pageData = JSON.parse(result.pageData)
+
+        const list2 = pageData.病案首页
+        const diagList = JSON.parse(list2[0].出院诊断)
+        const operaList = JSON.parse(list2[0].手术信息)
+        global_diagList = diagList;
+        global_operaList = operaList;
+
+
+
         setBoxHeight();
         changePay()
       } else {
@@ -974,7 +992,7 @@ $(function () {
     const module = global_modules[mid].moduleDetail;
     const key = global_modules[mid].modeName.replace(/[^\u4e00-\u9fa5|a-zA-Z0-9]+/g, '');
     let hml = '<div class="content-item" code="' + key + '">' +
-      '<h2 class="title">' +'<button class="save">编辑</button>'+ global_modules[mid].modeName + '(' + mid + ')</h2>' +
+      '<h2 class="title">' + '<button class="save">编辑</button>' + global_modules[mid].modeName + '(' + mid + ')</h2>' +
       (n > 1 ? '<div class="container">' : '<div class="container content-hts">');
 
 
@@ -1023,8 +1041,8 @@ $(function () {
     const retractClass = retract === 1 ? 'text-indent' : '';
     // const lineHml = ('<p class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' +   extractVars(val) + '</p>');
     // const txtHml = ('<p style="display: inline;vertical-align: middle;" class="' + posClass + ' ' + boldClass + ' ' + retractClass + '">' + extractVars(val) + '</p>');
-    const lineHml = ('<p class="' + posClass + ' ' + boldClass + ' ' + retractClass + '" contenteditable="true">' + extractVars(val) + '</p >');
-    const txtHml = ('<p style="display: inline;vertical-align: middle;" class="' + posClass + ' ' + boldClass + ' ' + retractClass + '" contenteditable="true">' + extractVars(val) + '</p >');
+    const lineHml = ('<p class="' + posClass + ' ' + boldClass + ' ' + retractClass + '" contenteditable="false">' + extractVars(val) + '</p >');
+    const txtHml = ('<p style="display: inline;vertical-align: middle;" class="' + posClass + ' ' + boldClass + ' ' + retractClass + '" contenteditable="false">' + extractVars(val) + '</p >');
 
     let hml = addLine || monoLine ? `<div class="cont ${posClass}" style="width: 100%;" id="anchor${id}">` : `<div class="cont" id="anchor${id}">`;
     hml = hml + `<span class="label">${name}</span>` + (addLine ? lineHml : txtHml) + `</div>`;
@@ -1040,12 +1058,12 @@ $(function () {
     const regexp = /(【(.+?)】)/g;
     for (let i = 0; i < questionMapping.length;) {
       if (questionMapping[i + 1]) {
-        tdVal = "<td id='anchor" + questionMapping[i].id + "'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td id='anchor" + questionMapping[i + 1].id + "'>" + questionMapping[i + 1].name + extractVars(questionMapping[i + 1].val) + "</td>";
+        tdVal = "<td id='anchor" + questionMapping[i].id + "' contenteditable='true'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td id='anchor" + questionMapping[i + 1].id + "' contenteditable='true'>" + questionMapping[i + 1].name + extractVars(questionMapping[i + 1].val) + "</td>";
       } else {
-        tdVal = "<td id='anchor" + questionMapping[i].id + "'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td></td>";
+        tdVal = "<td id='anchor" + questionMapping[i].id + "' contenteditable='true'>" + questionMapping[i].name + extractVars(questionMapping[i].val) + "</td><td contenteditable='true'></td>";
       }
       if (i == 0) {
-        hml = hml + `<tr><td rowspan="${colNum}" id='anchor${id}'>${name}</td>${tdVal}`;
+        hml = hml + `<tr><td rowspan="${colNum}" id='anchor${id}' contenteditable='true'>${name}</td>${tdVal}`;
       } else {
         hml = hml + `<tr>${tdVal}`;
       }
@@ -1122,25 +1140,596 @@ $(function () {
     });
   }
   var isEditing = false;
-  $('p, .embed-table .table-1 td, .opera-table td,.embed-table .table-2 td').attr('contenteditable', isEditing);
+  // $().attr('contenteditable', isEditing);
+
   $("body").on("click", ".save", function () {
     isEditing = !isEditing; // 切换状态
     if (isEditing) {
+      console.log("编辑中");
       $(this).text('保存');
+      // $('p, .embed-table .table-1 td, .opera-table td,.embed-table .table-2 td').off("input")
+
     } else {
+
+      let state = saveOrUpdate()
+      if (state === true) {
+        console.log("保存成功");
+      } else {
+        console.log("保存失败");
+      }
       $(this).text('编辑');
-      // let state = saveOrUpdate()
-      // if (state === true) {
-      //   console.log("保存成功");
-      // } else {
-      //   console.log("保存失败");
-      // }
+    }
+    $('p, .embed-table .table-1 td, .opera-table td,.embed-table .table-2 td').attr('contenteditable', isEditing);
+  });
+  function saveOrUpdate() {
+    /**病案首页编号*/
+    const homePageId = $('.patient-info span').eq(0).text().match(/\d+/)[0]
+
+    /**医院ID*/
+    const hospitalId = getUrlArgObject("hid")
+    /**病人住院ID*/
+    const behospitalCode = getUrlArgObject("id")
+    /**组织机构代码*/
+    const hospitalCode = ""
+    /**医疗机构名称*/
+    const hospitalName = ""
+    /**医疗机构代码*/
+    const orgCode = ""
+    /**医疗付费方式*/
+    const payType = ""
+    /**健康卡号*/
+    const healthCard = ""
+    /**住院次数*/
+    const behospitalNum = ""
+    /**病案号*/
+    const fileCode = ""
+    /**病人姓名*/
+    const name = $('#anchor2242 p').text()
+    /**病人性别*/
+    const sex = $('#anchor22322 p').text()
+    /**病人出生日期*/
+    const birthday = $('#anchor22323 p').text()
+    /**病人年龄*/
+    const age = $('#anchor22325 p').text().replace("岁", "")
+    /**年龄单位*/
+    const ageUnit = "岁"
+    /**国籍*/
+    const nationality = $('#anchor22324 p').text()
+    /**新生儿出生月数*/
+    const newbornMonth = ""
+    /**新生儿出生天数*/
+    const newbornDay = ""
+    /**新生儿出生体重*/
+    const newbornWeight = $('#anchor2244 p').text().replace("克", "")
+    /**新生儿入院体重*/
+    const newbornBehospitalWeight = $('#anchor2245 p').text().replace("克", "")
+    /**出生地*/
+    const bornAddress = $('#anchor2246 p').text()
+    /**籍贯*/
+    const bornPlace = $('#anchor2247 p').text()
+    /**民族*/
+    const nation = $('#anchor2248 p').text()
+    /**身份证号*/
+    const identityCardNo = $('#anchor2249 p').text()
+    /**职业*/
+    const jobType = $('#anchor2250 p').text()
+    /**婚姻状态*/
+    const marriage = $('#anchor2251 p').text()
+    /**现住址*/
+    const curAddress = $('#anchor2252 p').text()
+    /**现住址电话*/
+    const curPhone = $('#anchor22328 p').text()
+    /**现住址邮编*/
+    const curPostCode = $('#anchor22329 p').text()
+    /**户口地址*/
+    const residenceAddress = $('#anchor2253 p').text()
+    /**户口地址邮编*/
+    const residencePostCode = $('#anchor2254 p').text()
+    /**工作单位*/
+    const workAddress = $('#anchor2255 p').text()
+    /**工作单位电话*/
+    const workPhone = $('#anchor22326 p').text()
+    /**工作单位邮编*/
+    const workPostCode = $('#anchor22327 p').text()
+    /**联系人姓名*/
+    const contactName = $('#anchor2256 p').text()
+    /**联系人关系*/
+    const contactRelation = $('#anchor22330 p').text()
+    /**联系人地址*/
+    const contactAddress = $('#anchor22331 p').text()
+    /**联系人电话*/
+    const contactPhone = $('#anchor22332 p').text()
+
+    /**入院途径*/
+    const behospitalWay = $('#anchor2257 p').text()
+    /**入院时间*/
+    const behospitalDate = $('#anchor2258 p').text()
+    /**入院科别*/
+    const behospitalDept = $('#anchor22333 p').text()
+    /**入院病房*/
+    const behospitalWard = $('#anchor22334 p').text()
+    /**入院床位序号*/
+    const behospitalBedId = ""
+    /**入院床位号码*/
+    const behospitalBedCode = ""
+    /**转科科别*/
+    const changeDept = $('#anchor22335 p').text()
+    /**出院时间*/
+    const leaveHospitalDate = $('#anchor2259 p').text()
+    /**出院科别*/
+    const leaveHospitalDept = $('#anchor22336 p').text()
+    /**出院病房*/
+    const leaveHospitalWard = $('#anchor22337 p').text()
+    /**出院床位序号*/
+    const leaveHospitalBedId = ""
+    /**出院床位号码*/
+    const leaveHospitalBedCode = ""
+    /**实际住院天数*/
+    const behospitalDayNum = $('#anchor22338 p').text()
+    /**门急诊诊断*/
+    const outpatientEmrDiagnose = $('#anchor2260 p').text()
+    /**门急诊诊断编码*/
+    const outpatientEmrDiagnoseCode = $('#anchor2261 p').text()
+    /**损伤中毒因素*/
+    const poisonFactor = $('#anchor2263 p').text()
+    /**损伤中毒因素编码*/
+    const poisonFactorCode = $('#anchor2264 p').text()
+    /**病理诊断*/
+    const pathologyDiagnose = $('#anchor2265 p').text()
+    /**病理诊断编码*/
+    const pathologyDiagnoseCode = $('#anchor2266 p').text()
+    /**病理诊断编号*/
+    const pathologyDiagnoseId = $('#anchor2267 p').text()
+    /**有无药物过敏*/
+    const isMedAllergy = $('#anchor2268 p').text();
+    /** 过敏药物 */
+    const medAllergyName = $('#anchor2269 p').text();
+    /** 死亡患者尸检 */
+    const autopsy = $('#anchor2270 p').text();
+    /** 血型 */
+    const bloodType = $('#anchor2271 p').text();
+    /** Rh */
+    const rh = $('#anchor2272 p').text();
+    /** 科主任 */
+    const deptDirector = $('#anchor2273 p').text();
+    /** 主任医师 */
+    const directorDoctor = $('#anchor2274 p').text();
+    /** 主治医师 */
+    const attendingDoctor = $('#anchor2275 p').text();
+    /** 住院医师 */
+    const behospitalDoctor = $('#anchor2276 p').text();
+    /** 责任护士 */
+    const responseNurse = $('#anchor2277 p').text();
+    /** 进修医师 */
+    const studyDoctor = $('#anchor2278 p').text();
+    /** 实习医师 */
+    const practiceDoctor = $('#anchor2279 p').text();
+    /** 编码员 */
+    const encodeMan = $('#anchor2280 p').text();
+    /** 病案质量 */
+    const homePageQuality = $('#anchor2281 p').text();
+    /** 质控医师 */
+    const qcDoctor = $('#anchor2282 p').text();
+    /** 质控护士 */
+    const qcNurse = $('#anchor2283 p').text();
+    /** 质控日期 */
+    const qcDate = $('#anchor2284 p').text();
+    /** 离院方式 */
+    const leaveHospitalType = $('#anchor2286 p').text();
+    /** 接收机构名称 */
+    const acceptOrgCode = $('#anchor2287 p').text();
+    /** 31天内再住院计划 */
+    const againBehospitalPlan = $('#anchor2288 p').text();
+    /** 再住院目的 */
+    const againBehospitalGoal = $('#anchor2289 p').text();
+
+    /** 颅脑损伤患者昏迷前天数 */
+    const tbiBeforeDay = '';
+    /** 颅脑损伤患者昏迷前小时 */
+    const tbiBeforeHour = '';
+    /** 颅脑损伤患者昏迷前分钟 */
+    const tbiBeforeMinute = '';
+    /** 颅脑损伤患者昏迷后天数 */
+    const tbiAfterDay = '';
+    /** 颅脑损伤患者昏迷后小时 */
+    const tbiAfterHour = '';
+    /** 颅脑损伤患者昏迷后分钟 */
+    const tbiAfterMinute = '';
+
+    /** 总费用 */
+    const totalFee = $('#anchor2291 p').text().match(/总费用(\d+\.?\d+)/)[1] || '';
+    /** 自付金额 */
+    const ownFee = $('#anchor2291 p').text().match(/自付金额(\d+\.?\d+)/)[1] || '';
+    /** 一般医疗服务费 */
+    const generalFee = $('#anchor2292 p').text().match(/一般医疗服务费:(\d+\.?\d+)/)[1] || '';
+
+    const str_anchor2292 = $('#anchor2292 p').text()
+    const matchs_anchor2292 = str_anchor2292.match(/一般治疗服务费:(\d+\.?\d+)/)
+    /** 一般治疗服务费 */
+    const serviceFee = matchs_anchor2292 ? matchs_anchor2292[1] : "";
+    /** 护理费 */
+    const nurseFee = $('#anchor2292 p').text().match(/护理费:(\d+\.?\d+)/)[1] || '';
+    /** 其他费用 */
+    const otherFee = $('#anchor2292 p').text().match(/其他费用:(\d+\.?\d+)/)[1] || '';
+    /** 病理诊断费 */
+    const pathologyFee = $('#anchor2293 p').text().match(/病理诊断费:(\d+\.?\d+)/)[1] || '';
+    /** 实验室诊断费 */
+
+    const labFee = $('#anchor2293 p').text().match(/实验室诊断费:(\d+\.?\d+)/)[1] || '';
+    /** 影像学诊断费 */
+    const pacsFee = $('#anchor2293 p').text().match(/影像学诊断费:(\d+\.?\d+)/)[1] || '';
+    /** 临床诊断项目费 */
+    const clinicDiagnoseFee = $('#anchor2293 p').text().match(/临床诊断项目费:(\d+\.?\d+)/)[1] || '';
+    /** 非手术治疗项目费 */
+    const notOperationFee = $('#anchor2294 p').text().match(/非手术治疗项目费:(\d+\.?\d+)/)[1] || '';
+    /** 临床物理治疗费 */
+    const clinicPhysicFee = $('#anchor2294 p').text().match(/临床物理治疗费:(\d+\.?\d+)/)[1] || '';
+    /** 手术治疗费 */
+    const operationTreatFee = $('#anchor2294 p').text().match(/临床物理治疗费:(\d+\.?\d+)/)[1] || '';
+    /** 麻醉费 */
+    const anaesthesiaFee = $('#anchor2294 p').text().match(/麻醉费:(\d+\.?\d+)/)[1] || '';
+    /** 手术费 */
+    const operationFee = $('#anchor2294 p').text().match(/手术费:(\d+\.?\d+)/)[1] || '';
+
+    let matchs_anchor2295 = $('#anchor2295 p').text().match(/康复费:(\d+\.?\d+)/)
+    /** 康复类 */
+    const healthTypeFee = matchs_anchor2295 ? matchs_anchor2295[1] : '';
+    /** 中医治疗费 */
+    const chnTreatFee = $('#anchor2296 p').text().match(/中医治疗费:(\d+\.?\d+)/)[1] || '';
+    /** 西药费 */
+    const westernMedFee = $('#anchor2297 p').text().match(/西药费:(\d+\.?\d+)/)[1] || '';
+    /** 抗菌药物费用 */
+    const antibiosisFee = $('#anchor2297 p').text().match(/抗菌药物费用:(\d+\.?\d+)/)[1] || '';
+    /** 中成药费 */
+    const chnMedFee = $('#anchor2298 p').text().match(/中成药费:(\d+\.?\d+)/)[1] || '';
+    /** 中草药费 */
+    const chnHerbFee = $('#anchor2298 p').text().match(/中草药费:(\d+\.?\d+)/)[1] || '';
+    /** 血费 */
+    const bloodFee = $('#anchor2299 p').text().match(/血费:(\d+\.?\d+)/)[1] || '';
+    /** 白蛋白类制品费 */
+    const albumenFee = $('#anchor2299 p').text().match(/白蛋白类制品费:(\d+\.?\d+)/)[1] || '';
+    /** 球蛋白类制品费 */
+    const globulinFee = $('#anchor2299 p').text().match(/球蛋白类制品费:(\d+\.?\d+)/)[1] || '';
+    /** 凝血因子类制品费 */
+    const bloodFactorFee = $('#anchor2299 p').text().match(/凝血因子类制品费:(\d+\.?\d+)/)[1] || '';
+    /** 细胞因子类制品费 */
+    const cellFactorFee = $('#anchor2299 p').text().match(/细胞因子类制品费:(\d+\.?\d+)/)[1] || '';
+
+    //耗材类 
+    let str_anchor2300 = $('#anchor2300 p').text()
+
+    let matchs_anchor2300_1 = str_anchor2300.match(/检查用一次性医用耗材费:(\d+\.?\d+)/)
+    let matchs_anchor2300_2 = str_anchor2300.match(/治疗用一次性医用耗材费:(\d+\.?\d+)/)
+    let matchs_anchor2300_3 = str_anchor2300.match(/手术用一次性医用耗材费:(\d+\.?\d+)/)
+
+    /** 检查用一次性医用材料费 */
+    const checkMaterialFee = matchs_anchor2300_1 ? matchs_anchor2300_1[1] : "";
+    /** 治疗用一次性医用材料费 */
+    const treatMaterialFee = matchs_anchor2300_2 ? matchs_anchor2300_2[1] : '';
+    /** 手术用一次性医用材料费 */
+    const operationMaterialFee = matchs_anchor2300_3 ? matchs_anchor2300_3[1] : '';
+
+
+    /** 其他类其他费 */
+    const otherTypeFee = $('#anchor2301 p').text().match(/其他费:(\d+\.?\d+)/)[1] || '';
+    /** 单病种管理 */
+    const singleDiagManage = $('#anchor2302 p').text();
+    /** 临床路径管理 */
+    const clinicPathwayManage = $('#anchor2303 p').text();
+
+    /**诊断符合情况*/
+    const str_anchor2304 = $('#anchor2304 p').text()
+    const split_anchor2304 = str_anchor2304.split(/\d+\./g);
+    const results_anchor2304 = {}
+    split_anchor2304.forEach(el => {
+      if (el) {
+        const [item, status] = el.split(':');
+        results_anchor2304[item.trim()] = status.trim();
+      }
+    });
+    /** 门诊与住院 */
+    const isOutpatientBehospital = results_anchor2304["门诊与出院"] || "";
+    /** 入院与出院 */
+    const isLeaveBehospital = results_anchor2304["入院与出院"] || "";
+    /** 术前与术后 */
+    const isOperationBeforeAfter = results_anchor2304["术前与术后"] || "";
+    /** 临床与病理 */
+    const isClinicPathology = results_anchor2304["临床与病理"] || "";
+    /** 放射与病理 */
+    const isRadiatePathology = results_anchor2304["放射与病理"] || "";
 
+    /** 病人抢救次数 */
+    const rescueNum = $('#anchor2305 p').text().match(/\d+/g)[0] || "";
+    /** 病人抢救成功次数 */
+    const rescueSuccessNum = $('#anchor2305 p').text().match(/\d+/g)[1] || "";
 
+    /** 是否为自动出院 */
+    const isAutoLeavehospital = '';
+    /** 转归情况 */
+    const returnToType = $('#anchor2306 p').text();
+    /** 住院期间身体约束 */
+    const isPhysicalRestraint = $('#anchor2594 p').text();
+    /** 颅脑损伤患者昏迷时间(入院前) */
+    const tbiBehospitalBeforeTime = $('#anchor2582 p').text();
+    /** 颅脑损伤患者昏迷时间(入院后) */
+    const tbiBehospitalAfterTime = $('#anchor2583 p').text();
+    /** 住院期间是否发生跌倒或坠床 */
+    const isFallBed = $('#anchor2593 p').text();
+    /** 医院感染 */
+    const isNosocomialInfection = $('#anchor2589 p').text();
+    /** 入住ICU情况 */
+    const isIntoIcu = $('#anchor2586 p').text();
+    /** 并发症情况 */
+    const isComplications = $('#anchor2588 p').text();
+    /** 是否发生压疮 */
+    const isPressureSore = $('#anchor2591 p').text();
+    /** 是否住院期间发生压疮 */
+    const isBehospitalPressureSore = $('#anchor2592 p').text();
+    /** 非计划再次手术 */
+    const isUnplannedReoperation = $('#anchor2587 p').text();
+    /** 治疗结果 */
+    const treatmentResults = '';
+    /** 并发症 */
+    const complicationsResults = $('#anchor2588 p').text();
+    /** 感染部位 */
+    const infectionSite = '';
+    /** 住院期间有无告病危 */
+    const isBeInDanger = $('#anchor2585 p').text();
+    /** 出院诊断 */
+    const leaveDiags = addLeaveDiags()
+    /** 住院手术 */
+    const operations = addoperations()
 
+    let param = {
+      "dockModeType": "3",
+      "homePages": [
+        {
+          "homePageId": homePageId,
+          "hospitalId": hospitalId,
+          "behospitalCode": behospitalCode,
+          "hospitalCode": hospitalCode,
+          "hospitalName": hospitalName,
+          "orgCode": orgCode,
+          "payType": payType,
+          "healthCard": healthCard,
+          "behospitalNum": behospitalNum,
+          "fileCode": fileCode,
+          "name": name,
+          "sex": sex,
+          "birthday": birthday,
+          "age": age,
+          "ageUnit": ageUnit,
+          "nationality": nationality,
+          "newbornMonth": newbornMonth,
+          "newbornDay": newbornDay,
+          "newbornWeight": newbornWeight,
+          "newbornBehospitalWeight": newbornBehospitalWeight,
+          "bornAddress": bornAddress,
+          "bornPlace": bornPlace,
+          "nation": nation,
+          "identityCardNo": identityCardNo,
+          "jobType": jobType,
+          "marriage": marriage,
+          "curAddress": curAddress,
+          "curPhone": curPhone,
+          "curPostCode": curPostCode,
+          "residenceAddress": residenceAddress,
+          "residencePostCode": residencePostCode,
+          "workAddress": workAddress,
+          "workPhone": workPhone,
+          "workPostCode": workPostCode,
+          "contactName": contactName,
+          "contactRelation": contactRelation,
+          "contactAddress": contactAddress,
+          "contactPhone": contactPhone,
+          "behospitalWay": behospitalWay,
+          "behospitalDate": behospitalDate,
+          "behospitalDept": behospitalDept,
+          "behospitalWard": behospitalWard,
+          "behospitalBedId": behospitalBedId,
+          "behospitalBedCode": behospitalBedCode,
+          "changeDept": changeDept,
+          "leaveHospitalDate": leaveHospitalDate,
+          "leaveHospitalDept": leaveHospitalDept,
+          "leaveHospitalWard": leaveHospitalWard,
+          "leaveHospitalBedId": leaveHospitalBedId,
+          "leaveHospitalBedCode": leaveHospitalBedCode,
+          "behospitalDayNum": behospitalDayNum,
+          "outpatientEmrDiagnose": outpatientEmrDiagnose,
+          "outpatientEmrDiagnoseCode": outpatientEmrDiagnoseCode,
+          "poisonFactor": poisonFactor,
+          "poisonFactorCode": poisonFactorCode,
+          "pathologyDiagnose": pathologyDiagnose,
+          "pathologyDiagnoseCode": pathologyDiagnoseCode,
+          "pathologyDiagnoseId": pathologyDiagnoseId,
+          "isMedAllergy": isMedAllergy,
+          "medAllergyName": medAllergyName,
+          "autopsy": autopsy,
+          "bloodType": bloodType,
+          "rh": rh,
+          "deptDirector": deptDirector,
+          "directorDoctor": directorDoctor,
+          "attendingDoctor": attendingDoctor,
+          "behospitalDoctor": behospitalDoctor,
+          "responseNurse": responseNurse,
+          "studyDoctor": studyDoctor,
+          "practiceDoctor": practiceDoctor,
+          "encodeMan": encodeMan,
+          "homePageQuality": homePageQuality,
+          "qcDoctor": qcDoctor,
+          "qcNurse": qcNurse,
+          "qcDate": qcDate,
+          "leaveHospitalType": leaveHospitalType,
+          "acceptOrgCode": acceptOrgCode,
+          "againBehospitalPlan": againBehospitalPlan,
+          "againBehospitalGoal": againBehospitalGoal,
+          "tbiBeforeDay": tbiBeforeDay,
+          "tbiBeforeHour": tbiBeforeHour,
+          "tbiBeforeMinute": tbiBeforeMinute,
+          "tbiAfterDay": tbiAfterDay,
+          "tbiAfterHour": tbiAfterHour,
+          "tbiAfterMinute": tbiAfterMinute,
+          "totalFee": totalFee,
+          "ownFee": ownFee,
+          "generalFee": generalFee,
+          "serviceFee": serviceFee,
+          "nurseFee": nurseFee,
+          "otherFee": otherFee,
+          "pathologyFee": pathologyFee,
+          "labFee": labFee,
+          "pacsFee": pacsFee,
+          "clinicDiagnoseFee": clinicDiagnoseFee,
+          "notOperationFee": notOperationFee,
+          "clinicPhysicFee": clinicPhysicFee,
+          "operationTreatFee": operationTreatFee,
+          "anaesthesiaFee": anaesthesiaFee,
+          "operationFee": operationFee,
+          "healthTypeFee": healthTypeFee,
+          "chnTreatFee": chnTreatFee,
+          "westernMedFee": westernMedFee,
+          "antibiosisFee": antibiosisFee,
+          "chnMedFee": chnMedFee,
+          "chnHerbFee": chnHerbFee,
+          "bloodFee": bloodFee,
+          "albumenFee": albumenFee,
+          "globulinFee": globulinFee,
+          "bloodFactorFee": bloodFactorFee,
+          "cellFactorFee": cellFactorFee,
+          "checkMaterialFee": checkMaterialFee,
+          "treatMaterialFee": treatMaterialFee,
+          "operationMaterialFee": operationMaterialFee,
+          "otherTypeFee": otherTypeFee,
+          "singleDiagManage": singleDiagManage,
+          "clinicPathwayManage": clinicPathwayManage,
+          "isOutpatientBehospital": isOutpatientBehospital,
+          "isLeaveBehospital": isLeaveBehospital,
+          "isOperationBeforeAfter": isOperationBeforeAfter,
+          "isClinicPathology": isClinicPathology,
+          "isRadiatePathology": isRadiatePathology,
+          "rescueNum": rescueNum,
+          "rescueSuccessNum": rescueSuccessNum,
+          "isAutoLeavehospital": isAutoLeavehospital,
+          "returnToType": returnToType,
+          "leaveDiags": leaveDiags,
+          "operations": operations
+        }
+      ]
     }
-    $('p, .embed-table .table-1 td, .opera-table td,.embed-table .table-2 td').attr('contenteditable', isEditing);
-  });
+    console.log("param:", param)
+    let state = 1
+    post1(api.sendHomePageIng, param).then(res => {
+      if (res.data.code == '0') {
+        // window.parent.location.reload()
+        console.log("成功");
+      } else {
+        state = 0
+        console.log("失败");
+      }
+
+    }).catch((e) => {
+      state = 0
+      console.log("失败1");
+    })
+
+
+    if (state === 1) {
+      return true
+    } else {
+      return false
+    }
+  }
+
+  /**
+   *取表格里的数据-出院诊断
+  */
+  function addLeaveDiags() {
+    let leaveDiagsArry = []
+    let i = 0//顺序号
+    $('.embed-table tbody tr').each(function (rowIndex) {//遍历每一行
+      if (rowIndex > 0 && $(this).find('th').length === 0) {
 
+        let diagsObj = {
+          "behospitalType": "",
+          "diagnoseName": "",
+          "diagnoseOrderNo": "",
+          "diagnoseType": "",
+          "diagnoseTypeShort": "",
+          "behospitalCode": global_id,
+          "hospitalId": global_hid,
+          "icdCode": "",
+          "leaveHospitalType": "",
+          "pathologyDiagnose": "",
+          "homePageId": ""
+        };
+        diagsObj.diagnoseName = $(this).find('td').eq(0).text()
+        diagsObj.icdCode = $(this).find('td').eq(1).text()
+        diagsObj.behospitalType = $(this).find('td').eq(2).text()
+        diagsObj.leaveHospitalType = $(this).find('td').eq(3).text()
+        diagsObj.diagnoseOrderNo = global_diagList[i].诊断序号
+        diagsObj.homePageId = $('.patient-info span').eq(0).text().match(/\d+/)[0]
+
+
+        if (rowIndex === 2) {
+          diagsObj.diagnoseType = "主要诊断"
+          diagsObj.diagnoseTypeShort = "主"
+        } else {
+          diagsObj.diagnoseType = "次要诊断"
+          diagsObj.diagnoseTypeShort = "次"
+        }
+
+        leaveDiagsArry.push(diagsObj)
+        i = i + 1
+      }
+    });
+    return leaveDiagsArry
+  }
+  /**
+   * 取表格里的数据-手术情况
+   * @return {} operationsArry 表格的数据
+  */
+  function addoperations() {
+    let operationsArry = []
+    let i = 0//顺序号
+    $('.opera-table tbody tr').each(function (rowIndex) {//遍历每一行
+      if (rowIndex > 1 && $(this).find('th').length === 0) {
+        i = i + 1
+        let operationObj = {
+          "anaesthesiaName": "",
+          "cutLevel": "",
+          "firstAssistantId": "",
+          "healingLevel": "",
+          "homePageId": "",
+          "hospitalId": global_hid,
+          "operationCode": "",
+          "operationDate": "",
+          "operationDoctorId": "",
+          "operationLevel": "",
+          "operationName": "",
+          "operationOrderNo": "",
+          "secondAssistantId": "",
+          "shamOperationName": ""
+        }
+        operationObj.operationOrderNo = i
+        operationObj.homePageId = $('.patient-info span').eq(0).text().match(/\d+/)[0]
+        operationObj.operationCode = $(this).find('td').eq(0).text()
+        operationObj.operationDate = $(this).find('td').eq(1).text()
+        operationObj.operationLevel = $(this).find('td').eq(2).text()
+        operationObj.operationName = $(this).find('td').eq(3).text()
+        operationObj.operationDoctorId = $(this).find('td').eq(4).text()
+        operationObj.firstAssistantId = $(this).find('td').eq(5).text()
+        operationObj.secondAssistantId = $(this).find('td').eq(6).text()
+        operationObj.cutLevel = $(this).find('td').eq(7).text()
+        operationObj.healingLevel = $(this).find('td').eq(8).text()
+        operationObj.anaesthesiaName = $(this).find('td').eq(9).text()
+        operationObj.anaesthesiaName = $(this).find('td').eq(10).text()
+
+        operationsArry.push(operationObj)
+      }
+
+    });
+    return operationsArry
+  }
 });
 
+
+

+ 131 - 27
src/js/utils.js

@@ -76,7 +76,7 @@ const pageMap = {
   "YH-SSXX-SSFQ": 'appealInit.html', //申诉发起列表
 
   "YH-XXTZ": 'messageNoti.html', //申诉发起列表
-  
+
   "YH-RZGL-CZRZ": 'operationalLogs.html', //操作日志
   "YH-RZGL-DLRZ": 'loginLogs.html', //登录日志
 };
@@ -185,7 +185,109 @@ const post = function (url, data, opts) {
       })),
       contentType: 'application/json; charset=UTF-8',
       beforeSend: function (xmlHttp) {
-		xmlHttp.setRequestHeader('isPlacefile', isPlacefile);
+        xmlHttp.setRequestHeader('isPlacefile', isPlacefile);
+        if (url.indexOf("sys/user/getHospitalMark") === -1) {
+          xmlHttp.setRequestHeader('If-Modified-Since', '0');
+          xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
+          xmlHttp.setRequestHeader('Authorization', token ? 'Bearer ' + token : '');
+        }
+      },
+      success: function (resq) {
+        const doc = parent ? parent.document : document;
+        //console.log($(doc).find(".alertModal:visible"))
+        //失效后不点知道了直接刷新处理:跳回登录页
+        if (localStorage.getItem('toLogin') === '1' && $(doc).find(".alertModal:visible").length === 0) {
+          (parent || window).location.href = 'login.html';
+        }
+        let res = resq;
+        if (typeof resq === 'string') {
+          res = JSON.parse(resq);
+        }
+        const code = res.code;
+        const isOut = code === '10020011' || code === '10020012' || code === '10020013';
+        if (isOut) {
+          //登录信息失效处理
+          unloginPop(res.msg);
+        } else if (code === '00020007') {
+          toast(res.msg)
+        } else {
+          resolve({
+            data: res
+          });
+        }
+      },
+      error: function (error) {
+        if (error.status === 403 || error.status === 401) {
+          setCookie('behosDateStart', '');
+          setCookie('behosDateEnd', '');
+          if (!token && window.location.href.indexOf('login') == -1) {
+          } else {
+            if ($(".alertModal:visible").length) {
+              return;
+            }
+            $.alerModal({
+              "message": "没有该权限" + error.status,
+              type: "tip",
+              time: '1000',
+              isFather: true,
+              fatherWrapper: $("#mainBox", parent.document)
+            });
+          }
+        } else if (error.status === 500 || error.status === 501 || error.status === 404) {
+          $.alerModal({
+            "message": '接口错误',
+            type: "tip",
+            time: '1000',
+            isFather: true,
+            fatherWrapper: $("#mainBox", parent.document)
+          });
+        }
+        reject(error);
+      },
+    });
+  });
+};
+
+const post1 = function (url, data, opts) {
+  const token = localStorage.getItem('accessToken');
+  if (localStorage.getItem('toLogin') === '1' && token) {
+    //如果前面已经被标记为登录失效,接下来的请求都不发送
+    return new Promise(() => { });
+  }
+  let isPlacefile = getCookie('isPlacefile') || 1;
+  if (!token && window.location.href.indexOf('login') == -1) {
+    setCookie('behosDateStart', '');
+    setCookie('behosDateEnd', '');
+  }
+  for (let i = 0; i < $('.typeFilter').children().length; i++) {
+    if (
+      $('.typeFilter')
+        .children()
+        .eq(i)
+        .html() == '出院日期:' &&
+      isPlacefile == 0
+    ) {
+      $('.typeFilter')
+        .children()
+        .eq(i)
+        .html('入院日期:');
+    }
+  }
+  let need = window.location.href.indexOf('localhost') != -1;
+
+
+  return new Utils((resolve, reject) => {
+    abortAjax = $.ajax({
+      method: 'post',
+      url: (need ? baseUrl : '') + url,
+      async: true,
+      cache: false,
+      processData: false,
+      data: JSON.stringify(data),
+
+      contentType: 'application/json; charset=UTF-8',
+      beforeSend: function (xmlHttp) {
+        xmlHttp.setRequestHeader('isPlacefile', isPlacefile);
         if (url.indexOf("sys/user/getHospitalMark") === -1) {
           xmlHttp.setRequestHeader('If-Modified-Since', '0');
           xmlHttp.setRequestHeader('Cache-Control', 'no-cache');
@@ -208,7 +310,7 @@ const post = function (url, data, opts) {
         if (isOut) {
           //登录信息失效处理
           unloginPop(res.msg);
-        }else if(code === '00020007'){
+        } else if (code === '00020007') {
           toast(res.msg)
         } else {
           resolve({
@@ -233,7 +335,7 @@ const post = function (url, data, opts) {
               fatherWrapper: $("#mainBox", parent.document)
             });
           }
-        } else if (error.status === 500 || error.status === 501 || error.status === 404 ) {
+        } else if (error.status === 500 || error.status === 501 || error.status === 404) {
           $.alerModal({
             "message": '接口错误',
             type: "tip",
@@ -248,6 +350,7 @@ const post = function (url, data, opts) {
   });
 };
 
+
 //登录失效弹窗处理
 function unloginPop(msg) {
   /*const isOut = code === '10020011' || code === '10020012' || code === '10020013';
@@ -296,9 +399,9 @@ const expJson = (url, data) => {
     window.location.href = '../login.html';
   }
   let isPlacefile = getCookie('isPlacefile') || 1;
-  let excelName = encodeURIComponent(getCookie('excelName').replace(/\//g,"_"))||""
-  console.log(1,excelName)
-  console.log(2,decodeURIComponent(excelName))
+  let excelName = encodeURIComponent(getCookie('excelName').replace(/\//g, "_")) || ""
+  console.log(1, excelName)
+  console.log(2, decodeURIComponent(excelName))
   let need = window.location.href.indexOf('localhost') != -1;
   return axios({
     method: 'post',
@@ -307,8 +410,8 @@ const expJson = (url, data) => {
     contentType: 'application/vnd.ms-excel',
     responseType: 'blob', //必须添加,否则会乱码
     headers: {
-	  excelName:excelName,
-	  isPlacefile:isPlacefile,
+      excelName: excelName,
+      isPlacefile: isPlacefile,
       Authorization: 'Bearer ' + token,
     },
   });
@@ -699,25 +802,25 @@ function getLogoParam() {
 }
 
 //防抖
-function debounce(func, wait,immediate) {//func是要执行的函数,wait是毫秒数,immediate是是否要执行的参数,true立即执行,false延后执行
-        let timerout;
-        return function () {
-            let context = this;
-            let args = arguments;
-            clearTimeout(timerout)
-            if (immediate){
-                let callNow = !timerout;
-                timerout = setTimeout(() => {
-                    timerout = null;
-                }, wait);
-                if (callNow) func.apply(context, args);
-            } else{
-                timerout = setTimeout(function() {
-                    func.apply(context, args);
-                }, wait);
-            }
-        }
+function debounce(func, wait, immediate) {//func是要执行的函数,wait是毫秒数,immediate是是否要执行的参数,true立即执行,false延后执行
+  let timerout;
+  return function () {
+    let context = this;
+    let args = arguments;
+    clearTimeout(timerout)
+    if (immediate) {
+      let callNow = !timerout;
+      timerout = setTimeout(() => {
+        timerout = null;
+      }, wait);
+      if (callNow) func.apply(context, args);
+    } else {
+      timerout = setTimeout(function () {
+        func.apply(context, args);
+      }, wait);
     }
+  }
+}
 
 function toast(msg) {
   return $.alerModal({
@@ -757,6 +860,7 @@ module.exports = {
   pageMap,
   exportTimeLimit,
   post,
+  post1,
   getUrlArgObject,
   getUrlArgObjectNew,
   isIe8,

+ 45 - 45
webpack.config.js

@@ -13,7 +13,7 @@ const proxyHost = "http://173.18.12.195:5858";
 // const proxyHost = "http://192.168.3.117:5858";//铁钢
 // const proxyHost = "http://192.168.3.113:5858";//王峰
 
-let entries = {vendor:'lodash'},plugines = [];
+let entries = { vendor: 'lodash' }, plugines = [];
 function getentries() {
   let entryFiles = glob.sync('./src/js/**/*.js')
   let htmls = glob.sync('./src/html/**/*.html');
@@ -110,53 +110,53 @@ module.exports = {
   module: {
     noParse: /WdatePicker/,
     rules: [{
-        test: /.js$/,
-        enforce: 'post',
-        loader: 'es3ify-loader'
-      },
-      {
-        test: /\.m?js$/,
-        exclude: /(node_modules|bower_components)/,
-        use: {
-          loader: 'babel-loader',
-          options: {
-           presets: ['@babel/preset-env'],
-           //plugins:["@babel/plugin-transform-runtime"]
-          }
+      test: /.js$/,
+      enforce: 'post',
+      loader: 'es3ify-loader'
+    },
+    {
+      test: /\.m?js$/,
+      exclude: /(node_modules|bower_components)/,
+      use: {
+        loader: 'babel-loader',
+        options: {
+          presets: ['@babel/preset-env'],
+          //plugins:["@babel/plugin-transform-runtime"]
         }
+      }
+    },
+    {
+      test: /\.css$/,
+      use: [{
+        loader: MiniCssExtractPlugin.loader
       },
-      {
-        test: /\.css$/,
-        use: [{
-            loader: MiniCssExtractPlugin.loader
-          },
-          'css-loader'
-        ]
-      },
-      {
-        test: /\.less$/,
-        use: [{
-            loader: MiniCssExtractPlugin.loader
-          },
-          'css-loader', 'less-loader'
-        ]
+        'css-loader'
+      ]
+    },
+    {
+      test: /\.less$/,
+      use: [{
+        loader: MiniCssExtractPlugin.loader
       },
-      {
-        test: /\.(png|gif|jpg|jpeg|svg|eot|ttf|woff|woff2)$/,
-        use: [{
-          loader: 'url-loader',
-          options: {
-            limit: 10240,
-            esModule: false,
-            name: '[name].[ext]',
-            outputPath: 'images/'
-          }
-        }],
-        exclude: /node_modules/
-      }, {
-        test: /.html$/,
-        use: 'html-withimg-loader'
-      }
+        'css-loader', 'less-loader'
+      ]
+    },
+    {
+      test: /\.(png|gif|jpg|jpeg|svg|eot|ttf|woff|woff2)$/,
+      use: [{
+        loader: 'url-loader',
+        options: {
+          limit: 10240,
+          esModule: false,
+          name: '[name].[ext]',
+          outputPath: 'images/'
+        }
+      }],
+      exclude: /node_modules/
+    }, {
+      test: /.html$/,
+      use: 'html-withimg-loader'
+    }
     ]
   },
   // devtool: 'cheap-module-eval-source-map', //开发环境cheap-module-eval-source-map   //生产环境cheap-module-source-map