Bläddra i källkod

量表打印功能实现

hurixing 1 år sedan
förälder
incheckning
7944d4e962

+ 4 - 1
src/components/Chart/DynamicChart.vue

@@ -30,7 +30,7 @@ export default {
     },
     height: {
       type: [String, Number],
-      default: '400px',
+      default: '200px',
     },
   },
   computed: {
@@ -119,6 +119,9 @@ export default {
         xAxis: {
           type: 'category',
           data: this.chartData.map(item => item.name), // X 轴显示能力名称
+          axisLabel: {
+            fontSize: 8, // 适当缩小字体
+          }
         },
         yAxis: {
           type: 'value',

+ 1 - 1
src/views/patient/list/cePingInfo.vue

@@ -47,7 +47,7 @@
 
             <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
               <template slot-scope="scope">
-                <el-button size="mini" v-if="scope.row.type != 'AD8'" type="text" @click="getPrintReviewResultDetail(scope.row)">打印</el-button>
+                <el-button size="mini" v-if="scope.row.type == 'MMSE' || scope.row.type == 'MOCA'" type="text" @click="getPrintReviewResultDetail(scope.row)">打印</el-button>
                 <el-button size="mini" v-if="scope.row.type != 'AD8'" type="text" @click="handelInfo(scope.row)">报告详情</el-button>
               </template>
             </el-table-column>

+ 14 - 8
src/views/patient/list/print/mmsePrint.vue

@@ -101,8 +101,14 @@
                         <!-- 画图 -->
                         <div style="display: flex; flex-direction: column;">
                             <span>画图:</span>
-                            <div style="width: 80px; height: 80px;">
-                                <img v-if="reviewPrint.url1 != null" :src="reviewPrint.url1" style="width: 80px; height: 80px;">
+                            <div style="width: 175px; height: 80px; overflow: hidden; display: flex; justify-content: center; align-items: center;">
+                                <img 
+                                v-if="reviewPrint.url1" 
+                                :src="reviewPrint.url1" 
+                                style="
+                                    width: 90%;
+                                    height: 90%;
+                                ">
                             </div>
                         </div>
                     </div>
@@ -136,12 +142,12 @@
                 </div>
 
                 <div style="text-align: left;">
-                    <div style="display: flex; justify-content: space-between; align-items: center;">
+                    <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: -10px;">  <!-- 减少底部间距 -->
                         <p style="margin-left: 40px;"><strong>参考结论:</strong>{{patientStatus() === 1 ? '不正确状态': '正确状态'}}</p>
-                        <p style="margin-right: 60px;"><strong>日期:</strong>{{formatDate(reviewTime)}}</p>
-                    </div>
-                    <div style="text-align: right; margin-right: 120px;">
-                        <p><strong>测评师签字:</strong></p>
+                        <div style="text-align: right; margin-right: 60px; line-height: 1.2;">  <!-- 调整行距 -->
+                            <p style="margin: 2px 0;"><strong>日期:</strong>{{formatDate(reviewTime)}}</p>  <!-- 压缩段落间距 -->
+                            <p style="margin: 2px 0;margin-right: 75px;"><strong>测评师签字:</strong></p>  <!-- 压缩段落间距 -->
+                        </div>
                     </div>
                 </div>
 
@@ -291,7 +297,7 @@ export default {
 }
 
 @page {
-  size: A4;
+  size: auto A4 landscape;
   margin: 10mm;
 }
 

+ 71 - 65
src/views/patient/list/print/mocaPrint.vue

@@ -1,7 +1,7 @@
 <template>
     <div>
         <div id="printMe" class="printMe" style="text-align: center;">
-        <h1 style="font-size: 28px;">德州市第七人民医院</h1>
+        <h1 style="font-size: 28px;">{{reviewPrint.orgName}}</h1>
         <h3 style="font-size: 24px;">MoCA蒙特利尔认知评估量表</h3>
         <hr style="margin: 0px 0;">
         <div style="text-align: left; display: flex; gap: 20px; flex-wrap: wrap;">
@@ -16,7 +16,7 @@
             <tr>
               <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="3">视空间与执行能力({{calculateSum(32,33,38,39,40)}}/5)</th>
               <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="3">命名({{calculateSum(41,42,43)}}/3)</th>
-              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="4">注意(6/6)</th>
+              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="4">注意({{fractionalConversion(calculateSum(52,53,54,55,56))+calculateSum(49,50,51)}}/6)</th>
             </tr>
           </thead>
 
@@ -42,7 +42,7 @@
               <!-- 视空间与执行能力 -->
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['32']}}</td>
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['33']}}</td>
-              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['38']+reviewPrint.reviewIdScoreMap['39']+reviewPrint.reviewIdScoreMap['40']}}/3</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{calculateSum(38,39,40)}}/3</td>
               <!-- 命名 -->
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['41']}}</td>
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['42']}}</td>
@@ -51,15 +51,15 @@
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['49']}}</td>
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['50']}}</td>
               <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['51']}}</td>
-              <td style="border: 1px solid #000; padding: 4px;">{{calculateSum(52,53,54,55,56)}}/3</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{fractionalConversion(calculateSum(52,53,54,55,56))}}/3</td>
             </tr>
           </tbody>
 
           <thead>
             <tr>
-              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="3">语言(3/3)</th>
-              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="2">抽象(2/2)</th>
-              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="5">延迟记忆(5/5)</th>
+              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="3">语言({{calculateSum(57,58,59)}}/3)</th>
+              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="2">抽象({{calculateSum(60,61)}}/2)</th>
+              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="5">延迟记忆({{calculateSum(62,63,64,65,66)}}/5)</th>
             </tr>
           </thead>
 
@@ -80,20 +80,20 @@
           <tbody>
             <tr>
               <!-- 语言 -->
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['57']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['58']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['59']}}</td>
               <!-- 抽象 -->
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['60']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['61']}}</td>
               <!-- 延迟记忆 -->
-              <td style="border: 1px solid #000; padding: 4px;" colspan="5">1/5</td>
+              <td style="border: 1px solid #000; padding: 4px;" colspan="5"></td>
             </tr>
           </tbody>
 
           <thead>
             <tr>
-              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="10">定向(3/3)</th>
+              <th style="border: 1px solid #000; padding: 4px;text-align: left;" colspan="10">定向({{calculateSum(74,73,72,75,77,76)}}/6)</th>
             </tr>
           </thead>
 
@@ -111,12 +111,12 @@
 
           <tbody>
             <tr>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
-              <td style="border: 1px solid #000; padding: 4px;">1</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['74']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['73']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['72']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['75']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['77']}}</td>
+              <td style="border: 1px solid #000; padding: 4px;">{{reviewPrint.reviewIdScoreMap['76']}}</td>
               <td style="border: 1px solid #000; padding: 4px;" colspan="4"></td>
             </tr>
           </tbody>
@@ -128,18 +128,34 @@
             <!-- 立方体画图 -->
             <div style="display: flex; flex-direction: column;">
               <span>立方体画图:</span>
-              <img src="https://hcp-yaorong.oss-cn-beijing.aliyuncs.com/review/0137cac9092f402ca186d045fb8ce0e9.png" alt="图片1" style="width: 80px; height: 80px;">
+              <div style="width: 175px; height: 80px; overflow: hidden; display: flex; justify-content: center; align-items: center;">
+                <img 
+                  v-if="reviewPrint.url1" 
+                  :src="reviewPrint.url1" 
+                  style="
+                    width: 90%;
+                    height: 90%;
+                  ">
+              </div>
             </div>
             <!-- 钟表画图 -->
             <div style="display: flex; flex-direction: column;">
               <span>钟表画图:</span>
-              <img src="https://hcp-yaorong.oss-cn-beijing.aliyuncs.com/review/0137cac9092f402ca186d045fb8ce0e9.png" alt="图片2" style="width: 80px; height: 80px;">
+              <div style="width: 175px; height: 80px; justify-content: center; align-items: center;">
+                <img 
+                  v-if="reviewPrint.url2" 
+                  :src="reviewPrint.url2" 
+                  style="
+                    width: 80%;
+                    height: 80%;
+                  ">
+              </div>
             </div>
           </div>
           <div id="b" style="margin-right: 20px;">
             <span>总分:</span>
             <div class="number-with-line">
-              <span class="number">20</span>
+              <span class="number">{{reviewPrint.totalPoints}}</span>
               <span class="line"></span>
             </div>
           </div>
@@ -159,19 +175,19 @@
             <dynamic-chart
                 chartType="line"
                 :chartData="barData1"
-                title="认知域柱状图"
+                title="评分线型图"
                 width="800px"
                 height="200px"
                 />
         </div>
 
         <div style="text-align: left;">
-            <div style="display: flex; justify-content: space-between; align-items: center;">
-                <p style="margin-left: 40px;"><strong>参考结论:</strong>不正确状态</p>
-                <p style="margin-right: 60px;"><strong>日期:</strong>2024.11.16</p>
-            </div>
-            <div style="text-align: right; margin-right: 120px;">
-                <p><strong>测评师签字:</strong></p>
+            <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: -10px;">  <!-- 减少底部间距 -->
+                <p style="margin-left: 40px;"><strong>参考结论:</strong>{{this.reviewPrint.totalPoints < 26 ? '不正确状态' : '正确状态'}}</p>
+                <div style="text-align: right; margin-right: 60px; line-height: 1.2;">  <!-- 调整行距 -->
+                    <p style="margin: 2px 0;"><strong>日期:</strong>{{formatDate(reviewTime)}}</p>  <!-- 压缩段落间距 -->
+                    <p style="margin: 2px 0;margin-right: 75px;"><strong>测评师签字:</strong></p>  <!-- 压缩段落间距 -->
+                </div>
             </div>
         </div>
 
@@ -217,21 +233,8 @@ export default {
         return {
             // 柱状图数据
             barData: [
-                { name: '定向力', value: 5, total: 10 },
-                { name: '记忆力', value: 2, total: 3 },
-                { name: '计算力', value: 3, total: 5 },
-                { name: '感知力', value: 1, total: 2 },
-                { name: '语言能力', value: 4, total: 5 },
-                { name: '执行力', value: 2, total: 5 },
             ],
             barData1: [
-                { name: '2025.1.12', value: 19 },
-                { name: '2025.1.25', value: 21 },
-                { name: '2025.2.11', value: 25 },
-                { name: '2025.2.15', value: 21 },
-                { name: '2025.2.28', value: 26 },
-                { name: '2025.3.11', value: 28 },
-                { name: '2025.3.21', value: 30 },
             ]
         }
     },
@@ -249,9 +252,7 @@ export default {
         },
         initMMSE() {
           // 设置柱状图
-          // this.updatedBarData()
-          // 患者状态 分析
-          this.patientStatus()
+          this.updatedBarData()
           this.updatedLineData()
         },
         updatedLineData(){
@@ -264,24 +265,16 @@ export default {
                 }
             })
         },
-        patientStatus() {
-            let patientStatus = 0;
-            switch (this.defaultVal.education) {
-              case 'A':
-                patientStatus = this.reviewPrint.totalPoints <= 20 ? 1 : 0;
-                break;
-              case 'B':
-                patientStatus = this.reviewPrint.totalPoints <= 22 ? 1 : 0;
-                break;
-              case 'C':
-                patientStatus = this.reviewPrint.totalPoints <= 23 ? 1 : 0;
-                break;
-              default:
-                // 可以处理未知类别的情况,或者保持status为0
-                console.warn('Unknown defaultVal:', this.defaultVal.totalPoints);
-                break;
-            }
-            return patientStatus;
+        updatedBarData(){
+          this.barData = [
+                { name: '视空间和执行能力', value: this.calculateSum(32,33,38,39,40), total: 5 },
+                { name: '命名', value: this.calculateSum(41,42,43), total: 3 },
+                { name: '注意', value: this.fractionalConversion(this.calculateSum(52,53,54,55,56))+this.calculateSum(49,50,51), total: 6 },
+                { name: '语言', value: this.calculateSum(57,58,59), total: 3 },
+                { name: '抽象', value: this.calculateSum(60,61), total: 2 },
+                { name: '延迟记忆', value: this.calculateSum(62,63,64,65,66), total: 5 },
+                { name: '定向', value: this.calculateSum(74,73,72,75,77,76), total: 6 }
+          ]
         },
         formatDate(dateTime) {
             const date = new Date(dateTime);
@@ -290,6 +283,19 @@ export default {
             const day = String(date.getDate()).padStart(2, '0');
             return `${year}-${month}-${day}`;
         },
+        fractionalConversion(score) {
+          let sum = 0
+            if ([4, 5].includes(score)) {
+              sum = 3;
+            } else if ([2, 3].includes(score)) {
+              sum = 2;
+            } else if (score === 1) {
+              sum = 1;
+            } else {
+              sum = score === 0 ? 0 : score; // 0 返回 0,其他值返回原数字
+            }
+            return sum
+        }
     }
 }
 </script>
@@ -311,7 +317,7 @@ export default {
 }
 
 @page {
-  size: A4;
+  size: auto A4 landscape;
   margin: 10mm;
 }