jieSuanDanXiuGai.js 12 KB

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