You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

418 lines
14 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <el-table
  4. :data="doctorCheck.checkItemList"
  5. style="width: 100%"
  6. :height="
  7. window.pageHeight < 600
  8. ? Math.floor(((420 - 40 - (isCheckPicture ? 110:0)) * 3) / 5)
  9. : Math.floor(((window.pageHeight - 260 - 40 - (isCheckPicture ? 110:0)) * 3) / 5)
  10. "
  11. border highlight-current-row
  12. @row-click="rowClick" size="small"
  13. >
  14. <el-table-column prop="itemName" label="项目" width="180" />
  15. <el-table-column prop="result" label="结果" min-width="200">
  16. <template slot-scope="scope">
  17. <el-autocomplete
  18. style="width: 100%;"
  19. type="textarea"
  20. v-model="scope.row.result"
  21. :fetch-suggestions="querySearch"
  22. placeholder="请输入结果值"
  23. @select="handleSelect"
  24. :disabled="scope.row.isCalculationItem == 'Y' ||
  25. doctorCheck.RegisterCheckEdit.completeFlag == '1' ||
  26. doctorCheck.RegisterCheckEdit.completeFlag == '2'
  27. "
  28. :autosize="{ minRows: 1, maxRows: 100 }"
  29. :data-ismultiline="scope.row.isMultiLine"
  30. @input="madeTooltips(scope.$index)"
  31. v-bind:class="scope.row.class"
  32. />
  33. </template>
  34. </el-table-column>
  35. <el-table-column prop="unit" label="单位" width="80" align="center"/>
  36. <el-table-column
  37. prop="referenceRangeValue"
  38. label="参考范围"
  39. width="80" align="center"
  40. />
  41. <el-table-column
  42. prop="tooltips"
  43. label="提示"
  44. width="40" align="center"
  45. />
  46. </el-table>
  47. </div>
  48. </template>
  49. <script>
  50. // 0-无参考范围,1-数字型,2-字符型,3-性激素
  51. import { mapState } from "vuex";
  52. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  53. import { deepCopy } from '../../utlis/proFunc'
  54. export default {
  55. components: {},
  56. props:["isCheckPicture","registerCheckId"],
  57. data() {
  58. return {
  59. resultStatus:[], //结果状态提示数据
  60. tipsNormal:{
  61. displayName: "正常",
  62. dataInputPrompt: "正常",
  63. reportPrompt: "正常",
  64. reportBackgroundColor: 16777215,
  65. reportFontColor: 0,
  66. dataInputBackgroundColor: 16777215,
  67. dataInputFontColor: 0,
  68. }, //正常提示
  69. tipsError:{}, //错误提示
  70. tipsNegative:{}, //阴性提示
  71. tipsLowPositive:{}, //弱阳性提示
  72. tipsPositive:{}, //阳性提示
  73. tipsLow:{}, //偏低提示
  74. tipsHigh:{}, //偏高提示
  75. tipsSuperLow:{}, //超低提示
  76. tipsSuperHigh:{}, //超高提示
  77. restaurants: [], //结果模版
  78. currentRow: -1, //当前操作的行
  79. };
  80. },
  81. created() {},
  82. //挂载完成
  83. mounted() {
  84. this.dictInit()
  85. },
  86. computed: {
  87. ...mapState(["window","dataTransOpts", "dict", "doctorCheck"]),
  88. },
  89. methods: {
  90. dictInit(){
  91. //获取结果状态提示数据
  92. getapi('/api/app/result-status').then(res =>{
  93. if(res.code != -1){
  94. this.resultStatus = res.data.items
  95. this.resultStatus.forEach(e => {
  96. if(e.displayName.indexOf("正常") > -1){
  97. this.colorTrans(e,'tipsNormal')
  98. }else if(e.displayName.indexOf("错误") > -1){
  99. this.colorTrans(e,'tipsError')
  100. }else if(e.displayName.indexOf("阴性") > -1){
  101. this.colorTrans(e,'tipsNegative')
  102. }else if(e.displayName.indexOf("弱阳性") > -1){
  103. this.colorTrans(e,'tipsLowPositive')
  104. }else if(e.displayName.indexOf("阳性") > -1){
  105. this.colorTrans(e,'tipsPositive')
  106. }else if(e.displayName.indexOf("偏低") > -1){
  107. this.colorTrans(e,'tipsLow')
  108. }else if(e.displayName.indexOf("偏高") > -1){
  109. this.colorTrans(e,'tipsHigh')
  110. }else if(e.displayName.indexOf("危急值下限") > -1){
  111. this.colorTrans(e,'tipsSuperLow')
  112. }else if(e.displayName.indexOf("危急值上限") > -1){
  113. this.colorTrans(e,'tipsSuperHigh')
  114. }
  115. });
  116. }
  117. })
  118. },
  119. // 颜色转换
  120. // displayName: "错误",
  121. // dataInputPrompt: "×",
  122. // reportPrompt: "×",
  123. // reportBackgroundColor: 2427166,
  124. // reportFontColor: 1070166,
  125. // dataInputBackgroundColor: 321313,
  126. // dataInputFontColor: 12991019,
  127. colorTrans(dataColor,frontColor){
  128. let tempColor = '000000' + Number(dataColor.dataInputBackgroundColor).toString(16)
  129. let backgroundColor = '#' + tempColor.substring(tempColor.length - 6)
  130. tempColor = '000000' + Number(dataColor.dataInputFontColor).toString(16)
  131. let color = '#' + tempColor.substring(tempColor.length - 6)
  132. this[frontColor] = Object.assign(
  133. {},
  134. dataColor,
  135. {backgroundColor,color}
  136. )
  137. console.log(`this.${frontColor}`,this[frontColor])
  138. },
  139. // "referenceRangeValue": "15-55",
  140. // "referenceRangeTypeFlag": "1",
  141. // "criticalRangeValue": null,
  142. // "result"
  143. madeTooltips(index){
  144. // let ts = confirm('提示')
  145. let checkItem = this.doctorCheck.checkItemList[index]
  146. let tooltips = 'tipsNormal'
  147. checkItem.class = tooltips
  148. let referenceRangeTypeFlag = checkItem.referenceRangeTypeFlag||'0' //参考范围类别0-无参考范围,1-数字型,2-字符型,3-性激素
  149. // console.log('madeTooltips',index,referenceRangeTypeFlag)
  150. switch (referenceRangeTypeFlag) {
  151. case '3': // 1 是数字型,3 是性激素期
  152. case '1':
  153. // console.log('1、3')
  154. if(checkItem.result && checkItem.referenceRangeValue){
  155. let tempResult = checkItem.result.replaceAll('<','').replaceAll('>','').replaceAll('=','').replaceAll('≤','').replaceAll('≥','').replaceAll(' ','')
  156. // console.log('tempResult',isNaN(tempResult),tempResult)
  157. if(isNaN(tempResult)) break;
  158. let result = Number(tempResult)
  159. let criticalRangeValue = checkItem.criticalRangeValue
  160. let valueArr = checkItem.referenceRangeValue.split('-')
  161. if(valueArr.length == 1) valueArr.unshift(0)
  162. // console.log('valueArr',checkItem.referenceRangeValue,valueArr)
  163. if(criticalRangeValue){
  164. let criticalArr = criticalRangeValue.split('-')
  165. if(criticalArr.length == 1) criticalArr.unshift(0)
  166. // console.log('criticalArr',checkItem.criticalRangeValue,criticalArr)
  167. if(result < Number(criticalArr[0])){
  168. tooltips = 'tipsSuperLow'
  169. }else if(result > Number(criticalArr[1])){
  170. tooltips = 'tipsSuperHigh'
  171. }else if(result < Number(valueArr[0])){
  172. tooltips = 'tipsLow'
  173. }else if(result > Number(valueArr[1])){
  174. tooltips = 'tipsHigh'
  175. }
  176. }else{
  177. if(result < Number(valueArr[0])){
  178. tooltips = 'tipsLow'
  179. }else if(result > Number(valueArr[1])){
  180. tooltips = 'tipsHigh'
  181. }
  182. }
  183. }
  184. break;
  185. case '2':
  186. if(checkItem.result){
  187. if(checkItem.result.indexOf('阴性') > -1 || checkItem.result.indexOf('-') > -1){
  188. tooltips = 'tipsNegative'
  189. }else if(checkItem.result.indexOf('弱阳性') > -1 || checkItem.result.indexOf('±') > -1){
  190. tooltips = 'tipsLowPositive'
  191. }else if(checkItem.result.indexOf('阳性') > -1 || checkItem.result.indexOf('+') > -1){
  192. tooltips = 'tipsPositive'
  193. }
  194. }
  195. break;
  196. default:
  197. break;
  198. }
  199. // 判断后重新赋值
  200. checkItem.class = tooltips
  201. checkItem.tooltips = this[tooltips].dataInputPrompt
  202. // console.log('checkItem',checkItem)
  203. // console.log(`this.${tooltips}`,this[tooltips])
  204. },
  205. //选择项目
  206. rowClick(row) {
  207. this.doctorCheck.checkItem = row;
  208. this.restaurants = row.itemResultTemplates;
  209. },
  210. //检查组合项目下所包含的明细项目
  211. checkItemList(RegisterCheckId) {
  212. // this.doctorCheck.checkItem = null
  213. if(!RegisterCheckId){
  214. this.doctorCheck.checkItemList = []
  215. return
  216. }
  217. console.log(
  218. `/api/app/registercheckitem/getlistinregistercheckid?RegisterCheckId=${RegisterCheckId}`
  219. );
  220. getapi(
  221. `/api/app/registercheckitem/getlistinregistercheckid?RegisterCheckId=${RegisterCheckId}`
  222. )
  223. .then((res) => {
  224. // console.log("checkItemList", res.data);
  225. if (res.code == 1) {
  226. this.doctorCheck.checkItemList = res.data;
  227. this.doctorCheck.checkItemList.forEach((e,i) => {
  228. this.madeTooltips(i)
  229. });
  230. this.enterToTab();
  231. }
  232. })
  233. .catch((err) => {
  234. this.$message({ type: "error", message: `操作失败,原因:${err}` });
  235. });
  236. },
  237. querySearch(queryString, cb) {
  238. var restaurants = deepCopy(this.restaurants); //[{ value: '阴性' },{ value: '阳性' }]
  239. restaurants.forEach((item) => {
  240. return (item.value = item.result);
  241. });
  242. // console.log("restaurants", restaurants);
  243. var results = queryString
  244. ? restaurants.filter(this.createFilter(queryString))
  245. : restaurants;
  246. // 调用 callback 返回建议列表的数据
  247. cb(results);
  248. },
  249. createFilter(queryString) {
  250. return (restaurant) => {
  251. return (
  252. restaurant["value"]
  253. .toLowerCase()
  254. .indexOf(queryString.toLowerCase()) === 0
  255. );
  256. };
  257. },
  258. handleSelect(item) {
  259. console.log('item',item);
  260. },
  261. //回车替代tab键
  262. enterToTab() {
  263. // console.log('enterToTab');
  264. this.$nextTick(() => {
  265. let inputs = document.querySelectorAll(["textarea","input"]); //用数组可以读取多个标签的元素 //.inline-input
  266. // 为每个输入框添加键盘事件监听器
  267. inputs.forEach((input,i) => {
  268. // console.log('input',input);
  269. input.addEventListener('keydown', (event) => {
  270. // 如果按下的是回车键
  271. // console.log('data-ismultiline',input.getAttribute('data-ismultiline'));
  272. if (event.keyCode === 13 && input.getAttribute('data-ismultiline') == '0') {
  273. // 阻止回车键的默认行为(换行)
  274. event.preventDefault();
  275. // 获取当前输入框的下一个兄弟元素
  276. // let nextInput = input.nextElementSibling();
  277. // console.log('nextInput',nextInput,this);
  278. // // 如果存在下一个兄弟元素,将焦点移到下一个输入框
  279. // if (nextInput) {
  280. // nextInput.focus();
  281. // }
  282. // console.log('inputs[i+1]',inputs[i+1]);
  283. // console.log('disabled',inputs[i+1].getAttribute('disabled'));
  284. // console.log('class',inputs[i+1].getAttribute('class'));
  285. for(let j=i+1; j<inputs.length;j++){
  286. if(inputs[j].getAttribute('disabled') != "disabled" ){
  287. inputs[j].focus();
  288. break;
  289. }
  290. }
  291. }
  292. });
  293. });
  294. });
  295. },
  296. },
  297. //监听事件
  298. watch: {
  299. //检查项目切换
  300. // "doctorCheck.RegisterCheckId":{
  301. // immediate:true,
  302. // handler(newVal, oldVal) {
  303. // console.log(
  304. // "watch doctorCheck.RegisterCheckId newVal:",
  305. // newVal,
  306. // " oldVal:",
  307. // oldVal
  308. // );
  309. // this.checkItemList(newVal);
  310. // }
  311. // },
  312. //检查项目未切换换时 也可以强制刷新数据
  313. "dataTransOpts.refresh.register_check_item":{
  314. immediate:true,
  315. handler(newVal, oldVal) {
  316. console.log(`watch dataTransOpts.refresh.register_check_item newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.registerCheckId}`);
  317. this.checkItemList(this.registerCheckId);
  318. }
  319. },
  320. },
  321. };
  322. </script>
  323. <style lang="scss" scoped>
  324. @import "../../assets/css/global.css";
  325. ::v-deep .el-table td.el-table__cell,
  326. .el-table th.el-table__cell.is-leaf {
  327. padding: 0;
  328. }
  329. ::v-deep .el-textarea__inner {
  330. min-height: 23px;
  331. height: 23px;
  332. line-height: 1.25;
  333. padding: 2px 15px 2px 2px;
  334. }
  335. /*正常*/
  336. ::v-deep .tipsNormal .el-textarea__inner {
  337. background-color: v-bind("tipsNormal.backgroundColor") !important;
  338. color: v-bind("tipsNormal.color") !important;
  339. }
  340. /*错误*/
  341. ::v-deep .tipsError .el-textarea__inner {
  342. background-color: v-bind("tipsError.backgroundColor") !important;
  343. color: v-bind("tipsError.color") !important;
  344. }
  345. /*阴性 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  346. ::v-deep .tipsNegative .el-textarea__inner {
  347. background-color: v-bind("tipsNegative.backgroundColor") !important;
  348. color: v-bind("tipsNegative.color") !important;
  349. }
  350. /*弱阳性 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  351. ::v-deep .tipsLowPositive .el-textarea__inner {
  352. background-color: v-bind("tipsLowPositive.backgroundColor") !important;
  353. color: v-bind("tipsLowPositive.color") !important;
  354. }
  355. /*阳性 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  356. ::v-deep .tipsPositive .el-textarea__inner {
  357. background-color: v-bind("tipsPositive.backgroundColor") !important;
  358. color: v-bind("tipsPositive.color") !important;
  359. }
  360. /*偏低 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  361. ::v-deep .tipsLow .el-textarea__inner {
  362. background-color: v-bind("tipsLow.backgroundColor") !important;
  363. color: v-bind("tipsLow.color") !important;
  364. }
  365. /*偏高 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  366. ::v-deep .tipsHigh .el-textarea__inner {
  367. background-color: v-bind("tipsHigh.backgroundColor") !important;
  368. color: v-bind("tipsHigh.color") !important;
  369. }
  370. /*超低 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  371. ::v-deep .tipsSuperLow .el-textarea__inner {
  372. background-color: v-bind("tipsSuperLow.backgroundColor") !important;
  373. color: v-bind("tipsSuperLow.color") !important;
  374. }
  375. /*偏高 v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */
  376. ::v-deep .tipsSuperHigh .el-textarea__inner {
  377. background-color: v-bind("tipsSuperHigh.backgroundColor") !important;
  378. color: v-bind("tipsSuperHigh.color") !important;
  379. }
  380. </style>