jieSuanDanXiuGai.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. import {ref} from "vue";
  2. import {maZuiFangShi} from "@/api/public-api";
  3. import store from '@/store';
  4. import {listIsBlank, stringIsBlank} from "@/utils/blank-utils";
  5. import {getFundPayType, getMedChrgitmType} from "@/api/medical-insurance/si-setl-upload";
  6. import {getFormatDatetime} from "@/utils/date";
  7. const getRoles = store.state.user.info.roles
  8. export function shenHeQuanXian() {
  9. return getRoles.indexOf(1) > -1 || getRoles.indexOf(8) > -1
  10. }
  11. /**
  12. * 获取医保诊断
  13. * @param val 诊断编码
  14. * @returns {string} 返回名称
  15. */
  16. export function getsiDiagTypeName(val) {
  17. switch (val) {
  18. case "1":
  19. return "西医主要诊断"
  20. case "2":
  21. return "西医其他诊断"
  22. case "3":
  23. return "中医主要诊断"
  24. case "4":
  25. return "中医其他诊断"
  26. default:
  27. return "没有选择"
  28. }
  29. }
  30. /**
  31. * 判断这个人是否有申请了
  32. * @param val
  33. * @returns {string}
  34. */
  35. export function auditName(val) {
  36. switch (val.auditFlag) {
  37. case 0:
  38. return `<span style="color: #909399">${val.psnName}</span>`
  39. case 1:
  40. return `<span style="color: #67C23A">${val.psnName}</span>`
  41. case 2:
  42. return `<span style="color: #F56C6C">${val.psnName}</span>`
  43. case 3:
  44. return `<span style="color: #E6A23C">${val.psnName}</span>`
  45. default:
  46. return `${val.psnName}`
  47. }
  48. }
  49. export const qks = ref([
  50. {code: '0/0', name: '0/0'},
  51. {code: '1/3', name: 'Ⅰ/丙'},
  52. {code: '1/1', name: 'Ⅰ/甲'},
  53. {code: '1/2', name: 'Ⅰ/乙'},
  54. {code: '2/3', name: 'Ⅱ/丙'},
  55. {code: '2/1', name: 'Ⅱ/甲'},
  56. {code: '2/2', name: 'Ⅱ/乙'},
  57. {code: '3/3', name: 'Ⅲ/丙'},
  58. {code: '3/1', name: 'Ⅲ/甲'},
  59. {code: '3/2', name: 'Ⅲ/乙'}
  60. ])
  61. export const auditFlags = ref([
  62. {code: 0, name: '待审核'},
  63. {code: 1, name: '审核通过'},
  64. {code: 2, name: '驳回'},
  65. {code: 3, name: '正在审核'},
  66. {code: 4, name: '全部'},
  67. ])
  68. /**
  69. *
  70. * @param qkjb 切口级别
  71. * @param yhqk 愈合级别
  72. * @returns {string} 返回信息
  73. */
  74. export function qieKouName(qkjb, yhqk) {
  75. let code = qkjb + '/' + yhqk
  76. let name = ''
  77. qks.value.forEach(item => {
  78. if (item.code === code) {
  79. return name = item.name
  80. }
  81. })
  82. return name
  83. }
  84. /**
  85. *
  86. * @type {ToRef<*[]>} 麻醉数组
  87. */
  88. export const maZuiFangShis = ref([])
  89. /**
  90. * 远程获取麻醉方式
  91. */
  92. maZuiFangShi().then((res) => {
  93. maZuiFangShis.value = res
  94. })
  95. /**
  96. * 麻醉的名字
  97. * @param val code
  98. * @returns {string} 名称
  99. */
  100. export function maZuiName(val) {
  101. let name = '未知'
  102. maZuiFangShis.value.forEach(item => {
  103. if (item.code === val) {
  104. return name = item.name
  105. }
  106. })
  107. return name
  108. }
  109. /**
  110. * 医生默认可以默认选择的信息
  111. * @param arr 数组
  112. * @param notNode 不需要的 code
  113. * @returns {*[]} 返回科室
  114. */
  115. export function huoQuZhongKongChaXunTiaoJian(arr, notNode) {
  116. let data = []
  117. arr.forEach(item => {
  118. if (notNode.indexOf(item.code) === -1) {
  119. data.push(item.code)
  120. }
  121. })
  122. return data
  123. }
  124. /* 打印结算单的一些工具类 */
  125. export function brdyName(val) {
  126. if (stringIsBlank(val)) {
  127. return ""
  128. }
  129. let name = val.split("-")
  130. return `${name[0]}年${name[1]}月${name[2]}日`
  131. }
  132. /* 入院时间拆分 */
  133. export function getDateName(val) {
  134. if (stringIsBlank(val)) {
  135. return ""
  136. }
  137. let date = val.split(" ")[0].split("-")
  138. let times = val.split(" ")[1].split(":")
  139. return `${date[0]}年${date[1]}月${date[2]}日 ${times[0]}时`
  140. }
  141. // 手术时间拆分
  142. export function getShouShuShiJian(val) {
  143. let {oprnOprtBegntime, oprnOprtEndtime} = val
  144. let format = 'YYYY年MM月DD日 HH时mm分ss秒'
  145. return `${getFormatDatetime(oprnOprtBegntime, format)} 至 ${getFormatDatetime(oprnOprtEndtime, format)}`
  146. }
  147. // 麻醉时间
  148. export function getMaZuiShiJian(val) {
  149. let {anstBegntime, anstEndtime} = val
  150. let format = 'YYYY年MM月DD日 HH时mm分ss秒'
  151. return `${getFormatDatetime(anstBegntime, format)} 至 ${getFormatDatetime(anstEndtime, format)}`
  152. }
  153. // 颅内时间拆分
  154. export function luNeiShiJian(val) {
  155. if (stringIsBlank(val)) {
  156. return ""
  157. }
  158. let data = val.split("/")
  159. return ` ${data[0]}天 ${data[1]}小时 ${data[2]}分钟`
  160. }
  161. //结算时间计算
  162. export function nianYueRi(val) {
  163. if (stringIsBlank(val)) {
  164. return ' 年 月 日'
  165. }
  166. let date = val.split("-")
  167. return `${date[0]}年${date[1]}月${date[2]}日`
  168. }
  169. export function getAge(val) {
  170. if (stringIsBlank(val)) {
  171. return ""
  172. }
  173. return val.split('.')[0];
  174. }
  175. export function getAdmissCond(val) {
  176. switch (val) {
  177. case 1:
  178. return "有"
  179. case 2:
  180. return "临床未确定"
  181. case 3:
  182. return "情况不明"
  183. case 4:
  184. return "无"
  185. default:
  186. return ""
  187. }
  188. }
  189. export function getXiYiZhenDuan(val) {
  190. if (listIsBlank(val)) {
  191. return []
  192. }
  193. let diag = []
  194. val.forEach(item => {
  195. if (item.siDiagType === '1' || item.siDiagType === '2') {
  196. diag.push(item)
  197. }
  198. })
  199. if (listIsBlank(diag)) {
  200. return []
  201. }
  202. let zhuYao = []
  203. let ciYao = []
  204. diag.forEach(item => {
  205. if (item.siDiagType === '1' && zhuYao.length === 0) {
  206. zhuYao.push(item)
  207. } else {
  208. ciYao.push(item)
  209. }
  210. })
  211. return zhuYao.concat(ciYao)
  212. }
  213. export function getZhongYiZhenDuan(val) {
  214. if (listIsBlank(val)) {
  215. return []
  216. }
  217. let diag = []
  218. val.forEach(item => {
  219. if (item.siDiagType === '3' || item.siDiagType === '4') {
  220. diag.push(item)
  221. }
  222. })
  223. if (listIsBlank(diag)) {
  224. return []
  225. }
  226. let zhuYao = []
  227. let ciYao = []
  228. diag.forEach(item => {
  229. if (item.siDiagType === '3' && zhuYao.length === 0) {
  230. zhuYao.push(item)
  231. } else {
  232. ciYao.push(item)
  233. }
  234. })
  235. return zhuYao.concat(ciYao)
  236. }
  237. export function zhenDuanData(val) {
  238. let xiYiData = []
  239. let zhongYiData = []
  240. let obj = {disDiagComment: '', disDiag: '', admissCond: ''}
  241. // 只有当诊断全部为空的 时候才创建 9 个 空的数据
  242. if (listIsBlank(val)) {
  243. for (let i = 0; i < 9; i++) {
  244. xiYiData.push(obj)
  245. zhongYiData.push(obj)
  246. }
  247. }
  248. xiYiData = getXiYiZhenDuan(val)
  249. zhongYiData = getZhongYiZhenDuan(val)
  250. let maxLength = xiYiData.length > zhongYiData.length ? xiYiData.length : zhongYiData.length
  251. let newXiYiData = []
  252. let newZhongYiData = []
  253. if (maxLength < 2) {
  254. maxLength = 9
  255. }
  256. for (let i = 0; i < maxLength; i++) {
  257. if (i >= xiYiData.length) {
  258. newXiYiData.push(obj)
  259. } else {
  260. newXiYiData.push(xiYiData[i])
  261. }
  262. if (i >= zhongYiData.length) {
  263. newZhongYiData.push(obj)
  264. } else {
  265. newZhongYiData.push(zhongYiData[i])
  266. }
  267. }
  268. return zhenDuanHeBing(newXiYiData, newZhongYiData)
  269. }
  270. export function zhenDuanHeBing(xiYiZhenDuan, ZhongYiZhenDuan) {
  271. // 因为我在上面 保证了 两个诊断的长度完全一致 所以怎么循环都可以
  272. let data = []
  273. for (let i = 0; i < xiYiZhenDuan.length; i++) {
  274. data.push({
  275. xiYiDisDiag: xiYiZhenDuan[i].disDiag,
  276. xiYiDisDiagComment: xiYiZhenDuan[i].disDiagComment,
  277. xiYiAdmissCond: xiYiZhenDuan[i].admissCond,
  278. ZhongYiDisDiag: ZhongYiZhenDuan[i].disDiag,
  279. ZhongYiDiagComment: ZhongYiZhenDuan[i].disDiagComment,
  280. ZhongYiAdmissCond: ZhongYiZhenDuan[i].admissCond,
  281. })
  282. }
  283. return data
  284. }
  285. export function getShouShuData(val) {
  286. if (listIsBlank(val)) {
  287. let kong = []
  288. for (let i = 0; i < 3; i++) {
  289. kong.push({
  290. ssmc: '',
  291. ssbm: '',
  292. mzff: '',
  293. ssysName: '',
  294. ssys: '',
  295. mzysName: '',
  296. mzys: '',
  297. })
  298. }
  299. return kong
  300. }
  301. let zhuYaoShouShu = []
  302. let ciYaoShouShu = []
  303. val.forEach(item => {
  304. if (item.ssjb === 4 && zhuYaoShouShu.length === 0) {
  305. zhuYaoShouShu.push(item)
  306. } else {
  307. ciYaoShouShu.push(item)
  308. }
  309. })
  310. return zhuYaoShouShu.concat(ciYaoShouShu)
  311. }
  312. // 重症监护类型
  313. export function zhongZhenJianHu(val) {
  314. if (val === null) {
  315. val = []
  316. }
  317. let data = []
  318. if (listIsBlank(val)) {
  319. data.push({
  320. scsCutdWardType: '',
  321. scsCutdInpoolTime: '',
  322. scsCutdExitTime: '',
  323. scsCutdSumDura: '',
  324. })
  325. return data
  326. }
  327. val.forEach(item => {
  328. item.scsCutdInpoolTime = nianYueRiShiFen(item.scsCutdInpoolTime)
  329. item.scsCutdExitTime = nianYueRiShiFen(item.scsCutdExitTime)
  330. item.scsCutdSumDura = zhongZhenShiFenMiao(item.scsCutdSumDura)
  331. })
  332. return val
  333. }
  334. export function nianYueRiShiFen(val) {
  335. if (stringIsBlank(val)) {
  336. return ""
  337. }
  338. let date = val.split(" ")[0].split("-")
  339. let times = val.split(" ")[1].split(":")
  340. return `${date[0]}年${date[1]}月${date[2]}日${times[0]}时${times[1]}分`
  341. }
  342. export function zhongZhenShiFenMiao(val) {
  343. if (stringIsBlank(val)) {
  344. return ""
  345. }
  346. let times = val.split("/")
  347. return `${times[0]}时${times[1]}分${times[2]}秒`
  348. }
  349. // 获取费用类型
  350. export let medChrgitmType = []
  351. export let medChrgitmTypeMap = {}
  352. getMedChrgitmType().then((res) => {
  353. medChrgitmType = res
  354. medChrgitmType.forEach(item => {
  355. medChrgitmTypeMap[item.code] = {name: item.name}
  356. })
  357. })
  358. export function getMedChrgitmTypeData(val) {
  359. let data = []
  360. if (listIsBlank(val)) {
  361. medChrgitmType.forEach(item => {
  362. data.push({
  363. medChrgitm: item.name,
  364. amt: '',
  365. claaSumfee: '',
  366. clabAmt: '',
  367. fulamtOwnpayAmt: '',
  368. othAmt: '',
  369. })
  370. })
  371. data.push({
  372. medChrgitm: "合计",
  373. amt: 0,
  374. claaSumfee: 0,
  375. clabAmt: 0,
  376. fulamtOwnpayAmt: 0,
  377. othAmt: 0,
  378. })
  379. return data
  380. }
  381. val.sort(function (a, b) {
  382. return a.medChrgitm - b.medChrgitm
  383. })
  384. data = val
  385. return data
  386. }
  387. // 医保统筹支付
  388. export let fndPayTypeData = []
  389. export let fndPayTypeMap = {}
  390. getFundPayType().then(res => {
  391. fndPayTypeData = res
  392. fndPayTypeData.forEach(item => {
  393. fndPayTypeMap[item.code] = {code: item.code, name: item.name}
  394. })
  395. })
  396. export function fenLeiZhiFuLeiXing(val) {
  397. let obj = {}
  398. let qiTa = []
  399. let shuShiHua = ['310100', '330100', '390200', '320100', '610100', "370100"]
  400. for (let i = 0; i < shuShiHua.length; i++) {
  401. obj[shuShiHua[i]] = {
  402. fundPayType: shuShiHua[i],
  403. fundPayamt: "",
  404. }
  405. }
  406. val.forEach(item => {
  407. let name = fndPayTypeMap.hasOwnProperty(item.fundPayType)
  408. if (shuShiHua.indexOf(item.fundPayType) > -1) {
  409. obj[item.fundPayType] = {
  410. fundPayType: item.fundPayType,
  411. fundPayamt: item.fundPayamt,
  412. name: name ? fndPayTypeMap[item.fundPayType].name : ""
  413. }
  414. } else {
  415. qiTa.push({
  416. fundPayType: item.fundPayType,
  417. fundPayamt: item.fundPayamt,
  418. name: name ? fndPayTypeMap[item.fundPayType].name : "其他"
  419. })
  420. }
  421. })
  422. if (listIsBlank(qiTa)) {
  423. qiTa.push({
  424. fundPayType: "",
  425. fundPayamt: "",
  426. name: ""
  427. })
  428. }
  429. return {obj, qiTa}
  430. }
  431. export const outpatientChronicDisease = (list) => {
  432. let data = []
  433. if (listIsBlank(list)) {
  434. for (let i = 0; i < 6; i++) {
  435. data.push({
  436. diagCode: '',
  437. diagName: '',
  438. oprnOprtCode: '',
  439. oprnOprtName: '',
  440. })
  441. }
  442. } else {
  443. return list
  444. }
  445. return data
  446. }