cognitiveTaskOldTestRecord.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="app-container">
  3. <Header />
  4. <div class="main-container">
  5. <van-nav-bar left-arrow title="测试结果" @click-left="goBack" />
  6. <div class="main-outline">
  7. <div class="top-info">
  8. <div class="line-name">
  9. 测试者:<span>{{ getUserInfo.petName }}</span>
  10. </div>
  11. <div class="line-test-name">
  12. <!-- {{ type == "0" ? "量表名称" : type == "1" ? "任务名称" : "其它" }}:-->
  13. <span>{{ tableName }}</span>
  14. </div>
  15. <div class="line-test-time">
  16. 测试时间:<span>{{ time }}</span>
  17. </div>
  18. </div>
  19. <PageModule text="分值">
  20. <table class="inner-table">
  21. <tr class="table-th">
  22. <th>项目</th>
  23. <th>内容</th>
  24. </tr>
  25. <!-- {{-->
  26. <!-- resResult-->
  27. <!-- }}-->
  28. <tr v-for="(item, index) in resResult" :key="index">
  29. <!-- {{-->
  30. <!-- resResult-->
  31. <!-- }}-->
  32. <td class="td-result">{{ item.name }}</td>
  33. <td class="td-result">{{ item.score }}</td>
  34. </tr>
  35. </table>
  36. </PageModule>
  37. <div class="report-tip">
  38. <div class="tip-title">报告阅读说明</div>
  39. <p class="tip-desc">谢谢您的参与,阅读本报告时,请注意以下内容:</p>
  40. <!--<p class="tip-content">测评图表可快速帮您掌握报告内容;</p>-->
  41. <p class="tip-content">本结果仅供参考,不可作为临床诊断的依据;</p>
  42. <p class="tip-content">
  43. 如结果与你自己或他人感知的有出入,可回忆在测试时是否有事情影响了你,或自己答题时是否有所顾虑;
  44. </p>
  45. <p class="tip-content">
  46. 如对报告有不理解的地方,建议向专业资质人员进行咨询。
  47. </p>
  48. </div>
  49. <div class="btnArea">
  50. <van-button round size="small" type="primary" @click="download"
  51. >点击下载
  52. </van-button>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. // import StackedLine from "@/components/echarts/StackedLine";
  60. import Header from "@/components/header/index.vue";
  61. import PageModule from "@/components/PageModule/index.vue";
  62. import { mapGetters } from "vuex";
  63. export default {
  64. name: "cognitiveTaskOldTestRecord",
  65. components: { Header, PageModule },
  66. data() {
  67. return {
  68. name: "",
  69. tableName: "",
  70. time: "",
  71. baseUrl: baseUrl,
  72. resResult: [],
  73. userType: "", //用户类
  74. sex: 0,
  75. type: "", //量表类型0是量表,1是认知任务
  76. id: "", //来自测试列表
  77. from: "", //1-来自首页量表,2-来自测试记录列表页
  78. testPlanId: "", //来自测试计划
  79. testResultData: {}
  80. };
  81. },
  82. computed: {
  83. ...mapGetters({
  84. getUserInfo: "getUserInfo"
  85. })
  86. },
  87. created() {
  88. this.id = this.$route.query.id || "";
  89. this.from = this.$route.query.from || "";
  90. this.testPlanId = this.$route.query.testPlanId || "";
  91. },
  92. mounted() {
  93. this.inits(this.$route.query.id);
  94. },
  95. methods: {
  96. getDataList(v) {
  97. // console.log("vvvvv", v);
  98. v.forEach(item => {
  99. if (item && item.value[0] && item.value[0] != "") {
  100. this.resResult.push({
  101. name: item.name,
  102. score: item.value[0]
  103. });
  104. }
  105. });
  106. },
  107. inits(id) {
  108. this.$http.get(`getRecordById?id=${id}`, {}, res => {
  109. //当返回正确的话
  110. console.log(res.data.userRecordEntity, "res结果页面");
  111. this.testResultData = res.data;
  112. if (res && res.code == 200) {
  113. this.type = res.data?.userRecordEntity.type;
  114. // console.log(res,"认知任务返回")
  115. const datas = res.data.userRecordEntity.testResult;
  116. if (res.data.userRecordEntity.flag === "ProspectiveMemory") {
  117. // this.getDataList(datas);
  118. this.resResult.push({
  119. name: "前瞻性记忆能力",
  120. score: res.data.userRecordEntity.testResults
  121. });
  122. } else {
  123. const resResultData =
  124. typeof datas == "string"
  125. ? JSON.parse(datas)[0].tableContext
  126. : datas[0].tableContext;
  127. this.getDataList(resResultData);
  128. }
  129. //先获取到测试者
  130. let str = res.data.userRecordEntity.fileName;
  131. let testDate = res.data.userRecordEntity.testDate;
  132. let yearMonthDay = testDate
  133. .replace("年", "/")
  134. .replace("月", "/")
  135. .replace("日", " ")
  136. .replace("时", ":")
  137. .replace("分", ":")
  138. .replace("秒", "");
  139. this.time = yearMonthDay;
  140. this.tableName = res.data.userRecordEntity.name;
  141. let sd = str.split("/");
  142. let sp = sd[sd.length - 1];
  143. let a = sp.split("-");
  144. this.name = res.data.userRecordEntity.phone;
  145. this.sex = a[4];
  146. }
  147. });
  148. },
  149. //返回上一级
  150. goBack() {
  151. // this.$router.push("/index/scaleTest");
  152. if (this.testPlanId) {
  153. //来自测试计划列表
  154. this.$router.push({
  155. name: "testPlanClassify",
  156. params: {
  157. testPlanId: this.testPlanId
  158. }
  159. });
  160. } else if (this.from == 1) {
  161. // 来自普通测试列表
  162. this.$router.push("/index/cognitionTask");
  163. } else {
  164. // 来自测试记录列表
  165. this.$router.push("/testRecords");
  166. }
  167. },
  168. // 下载
  169. download() {
  170. window.location.href = `${baseUrl}/result/download/testResult?id=${this.id}`;
  171. },
  172. downloadFile() {
  173. if (this.tableName == "画钟测试") {
  174. window.open(`${baseUrl}result/download/CDTImg?id=${this.id}`, "_blank");
  175. }
  176. window.open(
  177. `${baseUrl}result/download/testResult?id=${this.id}`,
  178. "_blank"
  179. );
  180. }
  181. }
  182. };
  183. </script>
  184. <style lang="scss" scoped>
  185. .main-outline {
  186. overflow-y: auto !important;
  187. .top-info {
  188. width: calc(100% - 24px);
  189. margin: 0 12px;
  190. height: 136px;
  191. background: url("~@/assets/image/bg-result-top.png") no-repeat center;
  192. background-size: 100% 100%;
  193. overflow: hidden;
  194. .line-name {
  195. font-size: 20px;
  196. color: #8ac962;
  197. padding-left: 20px;
  198. margin-top: 40px;
  199. }
  200. .line-test-name {
  201. font-size: 15px;
  202. color: #333333;
  203. margin-top: 14px;
  204. padding-left: 20px;
  205. }
  206. .line-test-time {
  207. font-size: 12px;
  208. color: #999999;
  209. margin-top: 4px;
  210. padding-left: 20px;
  211. }
  212. }
  213. .inner-table {
  214. width: 100%;
  215. border-radius: 10px;
  216. overflow: hidden;
  217. .table-th {
  218. height: 32px;
  219. font-size: 14px;
  220. background: #8ac962;
  221. color: #fff;
  222. th {
  223. border-bottom: 1px solid white;
  224. border-right: 1px solid white;
  225. }
  226. }
  227. .td-result {
  228. height: 14px;
  229. min-height: 32px;
  230. padding: 7px;
  231. font-size: 14px;
  232. width: 50%;
  233. background-color: #f0f3f6;
  234. border-bottom: 1px solid white;
  235. border-right: 1px solid white;
  236. text-align: center;
  237. }
  238. }
  239. .report-tip {
  240. width: calc(100% - 24px);
  241. margin: 32px 12px 0;
  242. font-size: 12px;
  243. .tip-title {
  244. width: 100px;
  245. height: 20px;
  246. font-size: 15px;
  247. font-weight: 500;
  248. color: #333333;
  249. line-height: 20px;
  250. }
  251. .tip-desc {
  252. font-size: 12px;
  253. color: #999999;
  254. margin: 4px 0 8px;
  255. }
  256. .tip-content {
  257. font-size: 12px;
  258. color: #555555;
  259. line-height: 20px;
  260. display: list-item;
  261. list-style-type: disc;
  262. margin-left: 14px;
  263. }
  264. }
  265. .btnArea {
  266. margin: 20px 0;
  267. padding: 15px;
  268. display: flex;
  269. align-items: center;
  270. justify-content: center;
  271. .van-button {
  272. width: 2.6rem;
  273. }
  274. }
  275. }
  276. </style>