diagnosis.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. import request from '@/utils/request.js'
  2. import {fromAnalysisModel} from "@/model/tongue-analysis.model";
  3. import {removeRedundantSemicolons} from '@/api/hack';
  4. // 获取就诊病人信息
  5. export function getPatiiensMsg(data) {
  6. return request({
  7. url: `/outpatient/recordsMgr/${data}`,
  8. method: 'get',
  9. })
  10. };
  11. // 获取中医电子病历回显信息
  12. export function getEmrShowMsg(data) {
  13. return request({
  14. url: `/outpatient/electronicmedicalrecordMgr/infoByRecordsId?recordsId=${data.recordsId}`,
  15. method: 'post',
  16. data
  17. })
  18. };
  19. // 提交诊断页面数据
  20. export function addDiagnosisData(data) {
  21. return request({
  22. url: '/outpatient/diagnosisMgr/Add',
  23. method: 'post',
  24. data
  25. })
  26. };
  27. export function addDiagnosisData2(data) {
  28. return request({
  29. url: '/outpatient/diagnosisMgr/Add',
  30. method: 'post',
  31. data,
  32. }).then(res => {
  33. if (res.ResultCode !== 0) throw Error(res.ResultInfo || `错误`);
  34. if (!res.Data.mainDiagnosis) return {mainDiagnosis: res.Data};
  35. return res.Data;
  36. });
  37. }
  38. // 修改诊断页面数据
  39. export function editDiagnosisData(data) {
  40. return request({
  41. url: '/outpatient/diagnosisMgr/update',
  42. method: 'post',
  43. data
  44. })
  45. };
  46. // 开方获取患者基本信息
  47. export function getPatiensBasisM(data) {
  48. return request({
  49. url: '/test/outpatient/patientBaseInfo?patientId=' + data.patientId,
  50. method: 'post',
  51. // data
  52. }).then(res => removeRedundantSemicolons(res));
  53. };
  54. // 刷新电子病历信息
  55. export function refreshElectronicInfo(data) {
  56. return request({
  57. url: '/test/outpatient/refreshElectronicInfo?patientId=' + data.patientId,
  58. method: 'post',
  59. ignoreErrorMessage: '请重试',
  60. }).then(res => {
  61. if (res.ResultCode !== 0) throw Error(res.ResultInfo || `请重试`);
  62. if (res.Data == null) throw Error(`暂无新数据,请稍后刷新`);
  63. const data = removeRedundantSemicolons(res.Data);
  64. return data.outpatientElectronicmedicalrecord != null ? data : {outpatientElectronicmedicalrecord: data};
  65. });
  66. }
  67. // 获取表格 药品列表
  68. export function getTableDrug(data, isPurposeType = false) {
  69. if (isPurposeType) {
  70. data.name = data.key;
  71. return request({
  72. url: '/basis/stitutionsdrugMgr/materialQuery',
  73. method: 'post',
  74. data
  75. }).then(res => {
  76. const data = Array.isArray(res.Data) ? res.Data : [];
  77. res.Data = {
  78. TotalRecordCount: data.length,
  79. TotalPageCount: 1,
  80. PageSize: data.length,
  81. ButtonRight: "",
  82. CurrentPageSize: data.length,
  83. PageIndex: 1,
  84. Items: data.map(item => {
  85. return {
  86. pid: item.drugId,
  87. matid: item.drugId,
  88. ypmc: item.name,
  89. gg: item.gg,
  90. dw: item.dw,
  91. price: item.price || '',
  92. }
  93. })
  94. };
  95. return res;
  96. })
  97. }
  98. return request({
  99. url: '/test/outpatient/selectDrug?page=' + data.page + '&limit=' + data.limit,
  100. method: 'post',
  101. data
  102. })
  103. };
  104. //添加处方
  105. export function addRecipe(data) {
  106. return request({
  107. url: '/test/outpatient/addOutPatient',
  108. method: 'post',
  109. data
  110. })
  111. };
  112. //获取诊断页 回显数据
  113. export function getDiagnosisShowData(data) {
  114. return request({
  115. url: '/outpatient/diagnosisMgr/infoByRecordsId?recordsId=' + data.recordsId,
  116. method: 'post',
  117. })
  118. };
  119. // 获取处方回显数据
  120. export function getRecipeShowData(data) {
  121. return request({
  122. url: '/test/outpatient/getPrescription/' + data,
  123. method: 'get'
  124. })
  125. };
  126. // 通过 处方id 获取处方回显数据
  127. export function getRecipeDataByid(data) {
  128. return request({
  129. url: `/outpatient/patientprescriptionMgr/${data.pid}`,
  130. method: 'get'
  131. })
  132. };
  133. // 添加中医电子病历
  134. export function addEMR(data) {
  135. Object.keys(data).forEach(key => {
  136. try {
  137. if(typeof data[key] === 'string') data[key] = data[key]
  138. .replace(/^[\s;]+/, '') // 去除开头的分号和空白
  139. .replace(/\s*;+\s*/g, ';') // 分号和两边空白合并为一个分号
  140. .replace(/;{2,}/g, ';'); // 再次合并可能出现的连续分号
  141. } catch (e) {}
  142. })
  143. return request({
  144. url: '/outpatient/electronicmedicalrecordMgr/Add',
  145. method: 'post',
  146. data: removeRedundantSemicolons(data),
  147. })
  148. };
  149. // 修改中医电子病历信息
  150. export function editEMR(data) {
  151. debugger
  152. Object.keys(data).forEach(key => {
  153. try {
  154. if(typeof data[key] === 'string') data[key] = data[key]
  155. .replace(/^[\s;]+/, '') // 去除开头的分号和空白
  156. .replace(/\s*;+\s*/g, ';') // 分号和两边空白合并为一个分号
  157. .replace(/;{2,}/g, ';'); // 再次合并可能出现的连续分号
  158. } catch (e) {}
  159. })
  160. return request({
  161. url: '/outpatient/electronicmedicalrecordMgr/update',
  162. method: 'post',
  163. data: removeRedundantSemicolons(data),
  164. })
  165. };
  166. // 回传his
  167. export function backToHis(data) {
  168. return request({
  169. url: '/outpatient/electronicmedicalrecordMgr/electronicmedicalRecordsReturnHis',
  170. method: 'post',
  171. data
  172. })
  173. }
  174. // 寄到本院 获取地址
  175. export function getAddressForHospital(data) {
  176. return request({
  177. url: '/test/outpatient/getAddress',
  178. method: 'post',
  179. data
  180. })
  181. }
  182. // 获取体质辨识列表接口
  183. export function getPhysicalList(data) {
  184. return request({
  185. url: '/outpatient/identificationMgr/listPain?page=' + data.page + '&limit=' + data.limit + '&name=' + data.name,
  186. method: 'post',
  187. data
  188. })
  189. };
  190. // 获取某i个用户的体质辨识记录
  191. export function getUserPhysicList(data) {
  192. return request({
  193. url: '/outpatient/identificationMgr/listPainInfo?patientId=' + data.patientId + '&limit=' + data.limit + '&page=' + data.page,
  194. method: 'post',
  195. data
  196. })
  197. };
  198. //体质辨识 添加
  199. export function addPhysicalList(data) {
  200. return request({
  201. url: '/outpatient/identificationMgr/Add',
  202. method: 'post',
  203. data
  204. })
  205. };
  206. // 获取体质辨识 详情
  207. export function getPhysicalDetail(data) {
  208. return request({
  209. url: `/outpatient/identificationresultMgr/${data.identid}`,
  210. method: 'get'
  211. })
  212. };
  213. // 获取体质辨识 详情
  214. export function getPhysicalDetailGy(data) {
  215. return request({
  216. url: `/outpatient/identificationMgr/selecthealthInterventionBydentificationId?dentificationId=${data.dentificationId}`,
  217. method: 'post',
  218. data
  219. })
  220. };
  221. // 提交体质辨识 医生建议
  222. export function submitDoctorjy(data) {
  223. return request({
  224. url: '/outpatient/identificationresultMgr/update',
  225. method: 'post',
  226. data
  227. })
  228. };
  229. // 提交健康干预
  230. export function submitDoctorGy(data) {
  231. return request({
  232. url: '/outpatient/identificationMgr/SavehealthIntervention',
  233. method: 'post',
  234. data
  235. })
  236. }
  237. // 删除体质辨识记录
  238. export function deletePhysicRecord(data) {
  239. return request({
  240. url: '/outpatient/identificationMgr/BatchDelete?ids=' + data.ids,
  241. method: 'post',
  242. data
  243. })
  244. };
  245. //根据选择的中药类型查询所属药房id
  246. export function getPharmacyID(data) {
  247. return request({
  248. url: '/basis/pharmacyMgr/getPidBytype?type=' + data.type,
  249. method: 'post',
  250. data
  251. })
  252. };
  253. // 切换药房 id
  254. export function changePharmacy(data) {
  255. if (data && Array.isArray(data.drugIds) && data.drugIds.length === 0) return Promise.resolve({
  256. "Data": [],
  257. "ResultInfo": "操作成功",
  258. "ResultCode": 0
  259. });
  260. return request({
  261. url: '/test/outpatient/changeDrug',
  262. method: 'post',
  263. data
  264. })
  265. };
  266. // 获取开方界面协定方数据
  267. export function getAgreeRecipe(data) {
  268. return request({
  269. url: '/test/outpatient/getPres?page=' + data.pageId + '&limit=' + data.pageSize,
  270. method: 'post',
  271. data
  272. })
  273. };
  274. // 根绝就诊记录id 获取就诊信息
  275. export function getSeeDByID(data) {
  276. return request({
  277. url: '/test/outpatient/byRecId',
  278. method: 'get',
  279. params: data
  280. })
  281. };
  282. // 获取病历详情数据
  283. export function getRecordDetail(data) {
  284. return request({
  285. url: '/outpatient/CaseManagement/' + data.id,
  286. method: 'get',
  287. params: data
  288. })
  289. }
  290. // 获取药品详细信息
  291. export function getDrugDetail(data) {
  292. return request({
  293. url: '/basis/stitutionsdrugMgr/stiDrugInfo?stiDrugId=' + data.stiDrugId,
  294. method: 'post',
  295. data
  296. })
  297. };
  298. //开方界面获取协定方详细信息
  299. export function getAccordDetail(data) {
  300. return request({
  301. url: '/test/outpatient/preInfo',
  302. method: 'get',
  303. params: data
  304. })
  305. };
  306. // 获取我最常用
  307. export function getMyOfenUse(data) {
  308. return request({
  309. url: '/test/outpatient/myused',
  310. method: 'get',
  311. params: data
  312. })
  313. };
  314. //协定方 转方 判断
  315. export function changeBasisPre(data) {
  316. return request({
  317. url: '/test/outpatient/changeBasisPre',
  318. method: 'post',
  319. data
  320. })
  321. };
  322. //专家经验转方判断
  323. export function changeExpre(data) {
  324. return request({
  325. url: '/test/outpatient/changeExpPre',
  326. method: 'post',
  327. data
  328. })
  329. }
  330. // 处方修改
  331. export function updateRecipe(data) {
  332. return request({
  333. url: '/test/outpatient/update',
  334. method: 'post',
  335. data
  336. })
  337. };
  338. // 开方页面选择药房
  339. export function customerQuery(data) {
  340. return request({
  341. url: "/basis/pharmacyMgr/customerQuery?type=" + data.type,
  342. method: 'post',
  343. data
  344. })
  345. }
  346. //智能辩证 问卷临时存储
  347. export function znQuestionSave(data) {
  348. return request({
  349. url: '/smartDialecticalQuestionnaireTempSave/tempSave',
  350. method: 'post',
  351. data
  352. })
  353. }
  354. // 只能辩证 问卷回显
  355. export function znQusetionShow(data) {
  356. return request({
  357. url: `/smartDialecticalQuestionnaireTempSave/echoData/${data.recordId}`,
  358. method: 'get',
  359. params: data
  360. })
  361. };
  362. // 处方是否支付
  363. export function recipeIsPay(params) {
  364. return request({
  365. url: `/outpatient/pay/checkPrescriptionPaymentStatus`, //params.preId // ${JSON.stringify(params)}
  366. method: 'post',
  367. // params
  368. data: params
  369. })
  370. }
  371. // 根据就诊记录id 查询 是否有处方
  372. export function getPreNumber(params) {
  373. return request({
  374. url: `/outpatient/recordsMgr/getPrescriptionNumberByRecordId/${params.pid}`,
  375. method: 'get',
  376. params
  377. })
  378. }
  379. // 获取药房 共享药房和 本地药房id
  380. export function getPharmacyIDS(params) {
  381. return request({
  382. url: `/basis/pharmacyMgr/getPharmacyIds`,
  383. method: 'get',
  384. params
  385. })
  386. }
  387. // 提交处方预览
  388. export function getRecipePriview(data) {
  389. return request({
  390. url: `/test/outpatient/addOutPatientPreview`,
  391. method: 'post',
  392. data
  393. })
  394. }
  395. // 获取中药制剂 包装单位
  396. export function getBzdw(params) {
  397. return request({
  398. url: '/test/outpatient/getBZDW',
  399. method: 'get',
  400. params
  401. })
  402. }
  403. // 获取健康跟踪记录 详情
  404. export function getHealthTrack(data) {
  405. return request({
  406. url: '/outpatient/identificationMgr/getHealthTrackingRecordBydentificationId?page=' + data.page + '&limit=' + data.limit + '&dentificationId=' + data.dentificationId,
  407. method: 'post',
  408. data
  409. })
  410. }
  411. // 新增健康跟踪记录
  412. export function addHealthTrack(data) {
  413. return request({
  414. url: '/outpatient/identificationMgr/addHealthTrackingRecord',
  415. method: 'post',
  416. data
  417. })
  418. }
  419. // 获取主要体质
  420. export function getMainPhysical(data) {
  421. return request({
  422. url: '/outpatient/identificationMgr/getAnalysisGroupItemName',
  423. method: 'get'
  424. })
  425. }
  426. // 中医体质统计分析
  427. export function getPhysicalTotalList(data) {
  428. return request({
  429. url: '/outpatient/identificationMgr/statisticalList?page=' + data.page + '&limit=' + data.limit,
  430. method: 'post',
  431. data
  432. })
  433. }
  434. // 中医体质统计分析导出
  435. export function exportPhysicalTotal(data) {
  436. return request({
  437. url: '/outpatient/identificationMgr/statisticalListExport?page=' + data.page + '&limit=' + data.limit,
  438. method: 'post',
  439. data
  440. })
  441. }
  442. // 中医体质分析详情 生成PDF
  443. export function createPdf(data) {
  444. return request({
  445. url: '/PDF/PDF',
  446. method: 'post',
  447. data
  448. })
  449. }
  450. // 查询是否健康干预锅
  451. export function findIsHealthGY(data) {
  452. return request({
  453. url: `/outpatient/identificationresultMgr/healthInterventionOrNot/${data.identid}`,
  454. method: 'get',
  455. params: data
  456. })
  457. }
  458. // 获取医保规则最大(最小)药味数
  459. export function getMaxMinDoaseNumber(data) {
  460. return request({
  461. url: '/basis/medicalInsuranceRegulationMgr/minimumAndMaximumDosageNumber',
  462. method: 'post',
  463. data
  464. })
  465. }
  466. // 获取合理安全用药规则
  467. export async function getRationalSafeUse() {
  468. return request({
  469. url: '/basis/medicalInsuranceRegulationMgr/minimumAndMaximumDosageNumber',
  470. method: 'post',
  471. })
  472. }
  473. export function getTongueAndFaceAnalysis(data) {
  474. return request({
  475. url: '/outpatient/electronicmedicalrecordMgr/getTongueFaceAnalysisResult',
  476. method: 'post',
  477. data,
  478. params: {recordsId: data.recordsId},
  479. }).then(res => {
  480. if (res.ResultCode == 0) {
  481. const tongue = fromAnalysisModel('tongue', res.Data);
  482. const face = fromAnalysisModel('face', res.Data);
  483. return res.Data = {
  484. id: res.Data.recordsid,
  485. time: res.Data.recordstime,
  486. tongue,
  487. face,
  488. cover: [tongue ? tongue.cover : null, face ? face.cover : null].filter(Boolean).flatMap(item => item),
  489. }, res;
  490. } else {
  491. throw res
  492. }
  493. })
  494. }
  495. export function getTongueAndFaceAnalysisRecords(patientId, page = 1, limit = 6) {
  496. // patientId = '8d12c55e-7a29-45f3-804d-ed12b0e27660'
  497. return request({
  498. url: '/outpatient/electronicmedicalrecordMgr/getRecordTfs',
  499. method: 'post',
  500. params: {patientId, page, limit},
  501. }).then(res => {
  502. if (res.ResultCode == 0) {
  503. return {
  504. total: res.Data.TotalRecordCount,
  505. data: res.Data.Items.map(item => {
  506. const tongue = fromAnalysisModel('tongue', item);
  507. const face = fromAnalysisModel('face', item);
  508. return {
  509. id: item.recordsid,
  510. time: item.recordstime,
  511. tongue,
  512. face,
  513. cover: [tongue ? tongue.cover : null, face ? face.cover : null].filter(Boolean).flatMap(item => item),
  514. }
  515. }),
  516. }
  517. } else {
  518. throw res
  519. }
  520. })
  521. }