TianJiaJianYan.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div style="display: flex;height: 100% ; width: 100%">
  3. <div style="width: 220px">
  4. <CyFlex>
  5. <template #header>
  6. <el-radio-group v-model="chaZhaoLeiXing" @change="dianJiLeiXingChaXun">
  7. <el-radio-button :value="1">新申请</el-radio-button>
  8. <el-radio-button :value="2">个人模板</el-radio-button>
  9. <el-radio-button :value="3">科室模板</el-radio-button>
  10. </el-radio-group>
  11. </template>
  12. <div style="height: 100% ; width: 100%">
  13. <div v-show="chaZhaoLeiXing === 1" style="height: 100% ; width: 100%">
  14. <JyJcTree yjyc="jy" @nodeClick="nodeClick"/>
  15. </div>
  16. <div v-show="chaZhaoLeiXing !== 1" style="height: 100% ; width: 100%">
  17. <jc-jy-template :data="templateData"
  18. :is-check="false"
  19. @del-click="deleteTemplate"
  20. @node-click="rowClick"/>
  21. </div>
  22. </div>
  23. </CyFlex>
  24. </div>
  25. <div style="flex: 1; height: 100%;width: 0">
  26. <JianChaJianYanTable :data="jyList"
  27. @del-click="delCLick"
  28. v-model:public-data="jyExtraInformation"/>
  29. </div>
  30. </div>
  31. <el-dialog v-model="baoCunMuBan.dialog" center title="保存检查模板" width="30%">
  32. <el-form ref="baoCunMuBanRef" :model="baoCunMuBan" :rules="baoCunMuBanJiaoYan" label-width="80px">
  33. <el-row>
  34. <el-col :span="24">
  35. <el-form-item label="模板类型" prop="orderType">
  36. <el-radio-group v-model="baoCunMuBan.orderType">
  37. <el-radio-button :label="1">个人</el-radio-button>
  38. <el-radio-button :label="2">科室</el-radio-button>
  39. </el-radio-group>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="24">
  43. <el-form-item label="名称" prop="tcName">
  44. <el-input v-model="baoCunMuBan.tcName" ref="tcNameRef" clearable></el-input>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="24">
  48. <el-form-item label="排序码" prop="sortNo">
  49. <el-input-number v-model="baoCunMuBan.sortNo" :max="9999" :min="0"></el-input-number>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="24">
  53. <el-form-item label="录入方式" prop="tcFlag">
  54. <el-radio-group v-model="baoCunMuBan.tcFlag">
  55. <el-radio-button :label="0">自动选择</el-radio-button>
  56. <el-radio-button :label="1">手工录入</el-radio-button>
  57. </el-radio-group>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="24">
  61. <el-button @click="dianJiBaoCunMuBan(baoCunMuBanRef)">提交</el-button>
  62. <el-button>关闭</el-button>
  63. </el-col>
  64. </el-row>
  65. </el-form>
  66. </el-dialog>
  67. </template>
  68. <script setup>
  69. import {onMounted, ref} from 'vue'
  70. import {
  71. baoCunJianChaJianYanMuBan,
  72. baoCunJianYanJianCha,
  73. getTemplateGrouping,
  74. jianChaJianYanMuBanMing,
  75. shanShuJianChaMuBan,
  76. } from '@/api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing'
  77. import {ElMessageBox} from 'element-plus'
  78. import {stringIsBlank, stringNotBlank} from '@/utils/blank-utils'
  79. import {
  80. cuoWuXinXi,
  81. huanZheXinXi,
  82. jsQueryYzData,
  83. jyExtraInformation,
  84. jyJcRestriction,
  85. jyList,
  86. jyProxy,
  87. yzMitt
  88. } from '@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng'
  89. import {getServerDateApi, yaoPinXiangMuPiPeiYiBao} from '@/api/public-api'
  90. import Sleep from '@/utils/sleep'
  91. import {BizException, ExceptionEnum} from "@/utils/BizException";
  92. import JyJcTree from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/jy-jc-tree/JyJcTree.vue";
  93. import JianChaJianYanTable
  94. from "@/views/hospitalization/zhu-yuan-yi-sheng/jian-cha-jian-yan-shen-qing/components/public/JianChaJianYanTable.vue";
  95. import JcJyTemplate
  96. from "@/views/hospitalization/zhu-yuan-yi-sheng/jian-cha-jian-yan-shen-qing/components/public/JcJyTemplate.vue";
  97. import CyFlex from "@/components/cy/flex/src/CyFlex.vue";
  98. import {CyMessageBox} from "@/components/cy/message-box";
  99. import XEUtils from 'xe-utils'
  100. import {useUserStore} from "@/pinia/user-store";
  101. const chaZhaoLeiXing = ref(1)
  102. const userInfo = useUserStore().userInfo
  103. const baoCunMuBanRef = ref()
  104. const tcNameRef = ref(null)
  105. const baoCunMuBan = ref({
  106. dialog: false,
  107. tcName: '',
  108. orderType: 1,
  109. sortNo: 0,
  110. tcFlag: 1,
  111. fuGaiYuanShuJu: false,
  112. chongFuMing: false,
  113. })
  114. const templateData = ref()
  115. const dianJiLeiXingChaXun = () => {
  116. if (chaZhaoLeiXing.value !== 1) {
  117. getTemplateGrouping('2', chaZhaoLeiXing.value).then((res) => {
  118. templateData.value = res
  119. });
  120. }
  121. }
  122. const rowClick = async (data) => {
  123. if (data.isTheParentNode === '2') {
  124. const temp = XEUtils.clone(data, true);
  125. temp.startTime = await getServerDateApi();
  126. jyProxy.push(temp);
  127. }
  128. }
  129. const delCLick = (index) => {
  130. jyProxy.delIndex(index)
  131. }
  132. const dianJiBaoCunShenQing = async () => {
  133. jyProxy.emptyError();
  134. const listCode = jyProxy.eachAndReturnList((item) => item.orderCode + '-00')
  135. const 未匹配医保码 = await yaoPinXiangMuPiPeiYiBao(listCode).catch(() => '')
  136. cuoWuXinXi.value = 未匹配医保码
  137. if (stringNotBlank(未匹配医保码)) {
  138. await CyMessageBox.confirm({
  139. message: '未匹配医保码',
  140. title: '提示,仅提示,请继续点击确认完成保存。',
  141. confirmButtonText: '继续录入',
  142. dangerouslyUseHTMLString: true,
  143. type: 'warning',
  144. })
  145. }
  146. baoCunShuJu().then(() => {
  147. })
  148. }
  149. async function baoCunShuJu() {
  150. await CyMessageBox.confirm({
  151. message: '确定要保存这些数据吗? ',
  152. title: '提示',
  153. type: 'warning',
  154. })
  155. let data = XEUtils.clone(huanZheXinXi.value, true)
  156. data.list = jyList.value
  157. data.reqType = 2
  158. await baoCunJianYanJianCha(data)
  159. jyProxy.clear();
  160. // 查询医嘱
  161. jsQueryYzData().then(() => {
  162. })
  163. }
  164. const deleteTemplate = (data) => {
  165. ElMessageBox.confirm('是否要删除该模板', '提示', {
  166. type: 'warning',
  167. }).then(() => {
  168. shanShuJianChaMuBan(data.code, userInfo.deptCode).then(() => {
  169. dianJiLeiXingChaXun()
  170. })
  171. }).catch(() => {
  172. })
  173. }
  174. const baoCunMuBanJiaoYan = ref({
  175. tcName: [
  176. {required: true, message: '名称不能为空', trigger: 'blur'},
  177. {min: 1, max: 30, message: '长度在 1 到 30 个字', trigger: 'blur'},
  178. ],
  179. orderType: [{required: true, message: '名称不能为空', trigger: 'blur'}],
  180. sortNo: [{required: true, message: '名称不能为空', trigger: 'blur'}],
  181. tcFlag: [{required: true, message: '名称不能为空', trigger: 'blur'}],
  182. })
  183. const dianJiBaoCunMuBan = async (form) => {
  184. if (!form) return
  185. try {
  186. await form.validate()
  187. jianChaJianYanMuBanMing(baoCunMuBan.value.tcName, '2').then((res) => {
  188. if (res) {
  189. ElMessageBox.confirm('已经存在相同的模板名称,是否覆盖数据', '温馨提示', {
  190. type: 'warning',
  191. distinguishCancelAndClose: true,
  192. confirmButtonText: '覆盖',
  193. cancelButtonText: '取消',
  194. })
  195. .then(() => {
  196. faSongBaoCunMuBan()
  197. })
  198. .catch((e) => {
  199. })
  200. } else {
  201. faSongBaoCunMuBan()
  202. }
  203. })
  204. } catch (e) {
  205. console.log(e)
  206. }
  207. }
  208. const faSongBaoCunMuBan = () => {
  209. baoCunMuBan.value.reqType = 2
  210. baoCunMuBan.value.list = jyList.value
  211. baoCunMuBan.value.tcExec = userInfo.deptCode
  212. baoCunJianChaJianYanMuBan(baoCunMuBan.value).then((res) => {
  213. dianJiLeiXingChaXun()
  214. baoCunMuBan.value.dialog = false
  215. })
  216. }
  217. const clickSaveTemplate = async () => {
  218. jyProxy.emptyError();
  219. baoCunMuBan.value.dialog = true
  220. await Sleep(200)
  221. tcNameRef.value.focus()
  222. }
  223. const nodeClick = async (val) => {
  224. if (val.code.length < 5) {
  225. BizException(ExceptionEnum.LOGICAL_ERROR, '无法添加目录')
  226. }
  227. jyJcRestriction(val)
  228. let temp = {
  229. classes: val.classes,
  230. orderType: "",
  231. execDept: val.execUnit,
  232. execDeptName: val.execUnitName,
  233. inspectStuff: val.inspectStuff,
  234. orderCode: val.code,
  235. startTime: await getServerDateApi(),
  236. inspectStuffName: val.inspectStuffName,
  237. orderName: val.name,
  238. checkFlag: "0",
  239. jzFlag: 0,
  240. ybSelfFlag: 0,
  241. note: val.note,
  242. collectionInfo: val.ccollectionInfo,
  243. genderRestriction: val.genderRestriction,
  244. minAgeRestriction: val.minAgeRestriction,
  245. maxAgeRestriction: val.maxAgeRestriction
  246. };
  247. jyProxy.push(temp)
  248. }
  249. onMounted(() => {
  250. yzMitt.on('jySave', () => {
  251. jyProxy.emptyError();
  252. function error() {
  253. if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
  254. BizException(ExceptionEnum.LOGICAL_ERROR, "根据病理科要求,检验有病理项目需要填写,病史摘要、体征信息、相关辅检结果、临床诊断。")
  255. }
  256. }
  257. let isPathology = false
  258. jyProxy.forEach((item) => {
  259. if (item.classes === '038') {
  260. item.reqComment = jyExtraInformation.value.reqComment
  261. item.reqTzComment = jyExtraInformation.value.reqTzComment
  262. item.reqOtherResult = jyExtraInformation.value.reqOtherResult
  263. item.diagCode = jyExtraInformation.value.diagCode
  264. item.diagText = jyExtraInformation.value.diagText;
  265. isPathology = true
  266. }
  267. })
  268. if (isPathology) {
  269. if (stringIsBlank(jyExtraInformation.value.reqComment)) {
  270. error()
  271. }
  272. if (stringIsBlank(jyExtraInformation.value.reqTzComment)) {
  273. error()
  274. }
  275. if (stringIsBlank(jyExtraInformation.value.reqOtherResult)) {
  276. error();
  277. }
  278. if (stringIsBlank(jyExtraInformation.value.diagCode)) {
  279. error()
  280. }
  281. }
  282. // 没有选择患者启动保存模板
  283. if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
  284. BizException(ExceptionEnum.LOGICAL_ERROR, "请先选择患者后保存。")
  285. }
  286. dianJiBaoCunShenQing();
  287. })
  288. yzMitt.on('jySaveTemplate', () => {
  289. clickSaveTemplate()
  290. })
  291. dianJiLeiXingChaXun()
  292. })
  293. </script>
  294. <style scoped>
  295. :deep(.el-table .children-row) {
  296. background: rgba(145, 247, 145, 0.5);
  297. }
  298. :deep(.el-table) {
  299. --el-table-row-hover-background-color: #85dbfd7a;
  300. }
  301. </style>