fuyu 4 years ago
parent
commit
b26a24cf1d
1 changed files with 59 additions and 25 deletions
  1. 59 25
      src/service/html.js

+ 59 - 25
src/service/html.js

@@ -2,7 +2,7 @@
  * @Author: fuyu
  * @Date: 2021-03-26 16:38:25
  * @LastEditors: fuyu
- * @LastEditTime: 2021-03-26 18:10:51
+ * @LastEditTime: 2021-03-26 18:22:25
  * @FilePath: /202103/code/sql_merge/src/service/html.js
  */
 
@@ -41,6 +41,14 @@ export async function getHtml() {
 
   const data = []
   const trs = []
+  let sumoldsum = 0
+  let sumold2 = 0
+  let sumold1 = 0
+  let sumold0 = 0
+  let sumnewsum = 0
+  let sumnew0 = 0
+  let sumnew1 = 0
+  let sumnew2 = 0
   for(let key in map) {
     const tmp = map[key]
     const id = tmp['id']
@@ -54,50 +62,76 @@ export async function getHtml() {
     const oldsum = old0 + old1 + old2
     const newsum = new0 + new1 + new2
     data.push({ id, name, old0, old1, old2, new0, new1, new2, oldsum, newsum})
+    sumoldsum += oldsum
+    sumold2 += old2
+    sumold1 += old1
+    sumold0 += old0
+    sumnewsum += newsum
+    sumnew0 +=  new0
+    sumnew1 += new1
+    sumnew2 +=  new2
     trs.push(`<tr>
     <td>${id}</td>
     <td>${name}</td>
     <td>${oldsum}</td>
     <td>${old2}</td>
-    <td>${old1}</td>
-    <td>${old0}</td>
+    <td class="report">${old1}</td>
+    <td class="undo">${old0}</td>
     <td>${newsum}</td>
     <td>${new0}</td>
     <td>${new1}</td>
     <td>${new2}</td>
     </tr>`)
   }
+  trs.unshift(`<tr>
+  <td>总计</td>
+  <td>总计</td>
+  <td>${sumoldsum}</td>
+  <td>${sumold2}</td>
+  <td class="report">${sumold1}</td>
+  <td class="undo">${sumold0}</td>
+  <td>${sumnewsum}</td>
+  <td>${sumnew0}</td>
+  <td>${sumnew1}</td>
+  <td>${sumnew2}</td>
+  </tr>`)
   // return data
   const tbody = trs.join('')
   return `<html>
     <style>
+    .report {
+      color:#FF8C00
+    }
+    .undo {
+      color:#FF0000
+    }
     table {
       width: 100%;
       font-size: .938em;
       border-collapse: collapse;/*边框会合并为一个单一的边框*/
-  }
-  caption {
-      margin: 1em 0 .7em 0;
-      text-align: center;
-      font-weight: bold;
-      font-size: 120%;
-      letter-spacing: .5px;
-      color: #fff;
-  }
+    }
+    caption {
+        margin: 1em 0 .7em 0;
+        text-align: center;
+        font-weight: bold;
+        font-size: 120%;
+        letter-spacing: .5px;
+        color: #fff;
+    }
 
-  th {
-      text-align: left;
-      padding: .5em .5em;
-      font-weight: bold;
-      background: #66677c;color: #fff;
-  }
+    th {
+        text-align: left;
+        padding: .5em .5em;
+        font-weight: bold;
+        background: #66677c;color: #fff;
+    }
 
-  td {
-      padding: .5em .5em;
-      border-bottom: solid 1px #ccc;
-  }
+    td {
+        padding: .5em .5em;
+        border-bottom: solid 1px #ccc;
+    }
 
-  table,table tr th, table tr td { border:1px solid #0094ff; }/*设置边框的*/
+    table,table tr th, table tr td { border:1px solid #0094ff; }/*设置边框的*/
     </style>
     <table border="0" cellspacing="1" cellpadding="0">
       <thead>
@@ -105,8 +139,8 @@ export async function getHtml() {
       <th>医院名称</th>
       <th>公网总数</th>
       <th>同步完成</th>
-      <th>同步报告</th>
-      <th>未同步</th>
+      <th class="report">同步报告(PACS未同步)</th>
+      <th class="undo">未同步</th>
       <th>内网总数</th>
       <th>未同步</th>
       <th>同步报告</th>