BloodSugarQuery.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <page-layer>
  3. <template #header>
  4. 住院号:
  5. <el-input style="width: 120px" v-model="patNo" @blur="inputBlur"/>
  6. 住院次数:
  7. <el-input-number v-model="times" :min="0"/>
  8. <el-button @click="inquire">查询</el-button>
  9. <el-button @click="print">打印</el-button>
  10. </template>
  11. <template #main>
  12. <div style="width: 1122px;height: 793px" ref="printDiv">
  13. <table style="width: 100%;max-height: 793px">
  14. <thead>
  15. <tr>
  16. <th colspan="23">泰和医院内分泌科血糖单</th>
  17. </tr>
  18. <tr>
  19. <th colspan="23">
  20. <div style="width: 100%;display: flex;justify-content: space-between">
  21. <div>
  22. 床号: {{ patientInfo?.bedNo }}
  23. </div>
  24. <div>
  25. 姓名: {{ patientInfo?.name }}
  26. </div>
  27. <div>
  28. 年龄: {{ patientInfo?.age }}
  29. </div>
  30. <div>
  31. 住院号:{{ patientInfo?.inpatientNo }}
  32. </div>
  33. <div>
  34. 单位: mmol/l
  35. </div>
  36. </div>
  37. </th>
  38. </tr>
  39. <tr class="tr">
  40. <th style="width: 110px">日期</th>
  41. <th style="width: 30px">空腹</th>
  42. <th>时间签名</th>
  43. <th>早餐后</th>
  44. <th>时间签名</th>
  45. <th>中餐前</th>
  46. <th>时间签名</th>
  47. <th>中餐后</th>
  48. <th>时间签名</th>
  49. <th>晚餐前</th>
  50. <th>时间签名</th>
  51. <th>晚餐后</th>
  52. <th>时间签名</th>
  53. <th style="width: 30px">零点</th>
  54. <th>时间签名</th>
  55. <th style="width: 30px">三点</th>
  56. <th>时间签名</th>
  57. <th>随机血糖</th>
  58. <th>时间签名</th>
  59. <th>随机血糖</th>
  60. <th>时间签名</th>
  61. <th>随机血糖</th>
  62. <th>时间签名</th>
  63. </tr>
  64. </thead>
  65. <tbody>
  66. <tr v-for="item in data">
  67. <td style="padding: 10px">
  68. {{ item.date }}
  69. </td>
  70. <blood-sugar-table v-for="index in 11"
  71. @right-click="rightClick"
  72. :data="htmlTd(index - 1,item.data)"/>
  73. </tr>
  74. </tbody>
  75. </table>
  76. </div>
  77. <right-click-menu :mouse-position="position" closeManually ref="RightClickMenuRef">
  78. <div>
  79. {{ position.data.timecodeName }}
  80. <el-form label-width="70px">
  81. <el-form-item label="医生签名">
  82. <SelectStaffCode v-model="position.data" :name="['nurseId', 'nurseIdName']"/>
  83. </el-form-item>
  84. <el-form-item label="结果">
  85. <el-input style="width: 120px;" v-model="position.data.testResult"/>
  86. </el-form-item>
  87. <el-form-item label="时间">
  88. <el-time-picker
  89. format="HH:mm:ss"
  90. value-format="YYYY-MM-DD HH:mm:ss"
  91. v-model="position.data.testTime"/>
  92. </el-form-item>
  93. </el-form>
  94. <el-button @click="confirmTheChanges">确认</el-button>
  95. <el-button @click="cancel">取消</el-button>
  96. </div>
  97. </right-click-menu>
  98. </template>
  99. </page-layer>
  100. </template>
  101. <script setup name='BloodSugarQuery'>
  102. import {
  103. getPatientLoodSugar,
  104. getThePatienMaxHospitalizationTimes,
  105. modifyPatientBloodGlucoseInfo
  106. } from "@/api/blood-sugar/query";
  107. import BloodSugarTable from "@/components/blood-sugar-table/BloodSugarTable.vue";
  108. import {getLodop, initLodop} from "@/utils/c-lodop";
  109. import RightClickMenu from "@/components/menu-item/RightClickMenu.vue";
  110. import SelectStaffCode from "@/components/SelectStaffCode.vue";
  111. import {clone} from "@/utils/clone";
  112. import {getFormatDatetime} from "@/utils/date";
  113. import PageLayer from "@/layout/PageLayer";
  114. let patNo = $ref('0412588')
  115. let times = $ref(1)
  116. const queryPatientSBloodSugarInformation = () => {
  117. getPatientLoodSugar(patNo, times).then((res) => {
  118. data = res.bloodSugarData
  119. patientInfo = res.patientInfo
  120. console.log(res)
  121. })
  122. }
  123. const inquire = () => {
  124. queryPatientSBloodSugarInformation()
  125. }
  126. let data = $ref()
  127. let patientInfo = $ref()
  128. let thead = ["空腹", "早餐后", "中餐前", "中餐后", "晚餐前", "晚餐后", "零点", "三点", "随机血糖1", "随机血糖2", "随机血糖3"]
  129. const inputBlur = () => {
  130. if (patNo) {
  131. getThePatienMaxHospitalizationTimes(patNo).then((res) => {
  132. console.log(res)
  133. })
  134. }
  135. }
  136. let position = $ref()
  137. const RightClickMenuRef = ref()
  138. let tempBloodSugarData = $ref()
  139. const rightClick = (val, event) => {
  140. position = {
  141. event: event,
  142. data: val
  143. }
  144. tempBloodSugarData = clone(val)
  145. }
  146. const confirmTheChanges = () => {
  147. modifyPatientBloodGlucoseInfo(position.data).then((res) => {
  148. position.data.formatTestTime = getFormatDatetime(position.data.testTime, 'HH:mm')
  149. RightClickMenuRef.value.close()
  150. })
  151. }
  152. const cancel = () => {
  153. position.data.nurseId = tempBloodSugarData.nurseId
  154. position.data.nurseIdName = tempBloodSugarData.nurseIdName
  155. position.data.testResult = tempBloodSugarData.testResult
  156. position.data.testTime = tempBloodSugarData.testTime
  157. RightClickMenuRef.value.close()
  158. }
  159. const htmlTd = (index, data) => {
  160. return data[thead[index]]
  161. }
  162. const printDiv = ref()
  163. const print = () => {
  164. let LODOP = getLodop()
  165. let style = `<style>td {
  166. border: 1px solid #000;
  167. text-align: center;
  168. padding: 10px 0;
  169. }
  170. .tr th {
  171. border: 1px solid #000;
  172. text-align: center;
  173. }
  174. table, tr, td {
  175. border-collapse: collapse;
  176. }</style>`
  177. const strHtml = style + '<body>' + printDiv.value.innerHTML + '</body>'
  178. LODOP.PRINT_INIT('泰和医院内分泌科血糖单') // 初始化打印机 名字
  179. LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') // 设置纸张大小 A4
  180. LODOP.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true) // 整宽不变形
  181. LODOP.ADD_PRINT_HTM('2mm', '5mm', '100%', '100%', strHtml) //要打印的内容
  182. LODOP.SET_PRINT_STYLE('ItemType', 3) //设置对象风格
  183. LODOP.ADD_PRINT_TEXT('290mm', '190mm', '20mm', '2mm', '第#页/共&页') //增加纯文本项
  184. LODOP.PREVIEW() // 关闭
  185. console.log(printDiv)
  186. }
  187. onMounted(() => {
  188. queryPatientSBloodSugarInformation()
  189. initLodop()
  190. })
  191. </script>
  192. <style scoped lang="scss">
  193. td {
  194. border: 1px solid #000;
  195. text-align: center;
  196. padding: 10px 0;
  197. }
  198. .tr th {
  199. border: 1px solid #000;
  200. text-align: center;
  201. }
  202. table, tr, td {
  203. border-collapse: collapse;
  204. }
  205. </style>