print.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import {
  2. json
  3. } from "../../utils/ajax";
  4. import store from '@store';
  5. import Notify from '@commonComp/Notify';
  6. import {
  7. getAllDataList,
  8. getAllDataStringList,
  9. pushAllDataList,
  10. filterDataArr
  11. } from '@utils/tools';
  12. export const saveMessage = (bool) => {
  13. let baseList = store.getState();
  14. let state = baseList.patInfo.message;
  15. let whichSign = baseList.typeConfig.typeConfig;
  16. let jsonStr = getAllDataStringList(baseList);
  17. let jsonData = getAllDataList(baseList);
  18. // console.log(jsonStr.diag,'保存历史病历')
  19. json('/inquiryInfo/saveInquiry', {
  20. "doctorId": state.doctorId,
  21. "hospitalDeptId": state.hospitalDeptId,
  22. "hospitalId": state.hospitalId,
  23. "patientId": state.patientId, //患者id
  24. "dataJson": JSON.stringify(getAllDataList(baseList)),
  25. "detailList": [{
  26. "content": jsonStr.chief,
  27. "contentValue":filterDataArr(JSON.parse(jsonStr.chief)),
  28. "type": 1
  29. }, {
  30. "content": jsonStr.present,
  31. "contentValue":filterDataArr(JSON.parse(jsonStr.present)),
  32. "type": 2
  33. }, {
  34. "content": jsonStr.other,
  35. "contentValue":filterDataArr(JSON.parse(jsonStr.other)),
  36. "type": 3
  37. }, {
  38. "content": jsonStr.vital,
  39. "contentValue":filterDataArr(JSON.parse(jsonStr.vital)),
  40. "type": 4
  41. }, {
  42. "content": jsonStr.lis,
  43. "contentValue":jsonStr.lis,
  44. "type": 5
  45. }, {
  46. "content": jsonStr.pacs,
  47. "contentValue":jsonStr.pacs,
  48. "type": 6
  49. }, {
  50. "content": jsonStr.diag,
  51. "contentValue":jsonStr.diag,
  52. "type": 7
  53. }, {
  54. "content": jsonStr.advice,
  55. "contentValue":jsonStr.advice,
  56. "type": 8
  57. }],
  58. "sign": whichSign, //类型0结构化 1文本
  59. "diagnose": (jsonData.diag.length > 0 ? jsonData.diag[0].name : ''), //诊断
  60. "inquiryCode": state.recordId, //就诊序列号
  61. // "regVisitedState": 0, //就诊状态
  62. // "type": 0,
  63. }).then((res) => {
  64. let data = res.data
  65. if (data.code == 0) {
  66. if(!bool){
  67. Notify.success('历史病历保存成功');
  68. }
  69. } else {
  70. console.log(res)
  71. }
  72. })
  73. if(bool){
  74. json('/printRecord/savePrintRecords', {
  75. "dataJson": JSON.stringify(getAllDataList(baseList)),
  76. "doctorId": state.doctorId,
  77. "hospitalDeptId": state.hospitalDeptId,
  78. "hospitalId": state.hospitalId,
  79. "inquiryCode": state.recordId, //就诊序列号
  80. "name": (jsonData.diag.length > 0 ? jsonData.diag[0].name : ''), //诊断
  81. "patientId": state.patientId, //患者id
  82. "type": whichSign, //类型0结构化 1文本
  83. "content": {
  84. "advice": jsonStr.advice,
  85. "chief": jsonStr.present,
  86. "diag": jsonStr.diag,
  87. "lis": jsonStr.lis,
  88. "other": jsonStr.other,
  89. "pacs": jsonStr.pacs,
  90. "present": jsonStr.present,
  91. "vital": jsonStr.vital
  92. },
  93. }).then((res) => {
  94. let data = res.data
  95. if (data.code == 0) {
  96. console.log('打印记录保存成功')
  97. } else {
  98. console.log(res)
  99. }
  100. })
  101. }
  102. };
  103. export const clearMessages = () => {
  104. let baseList = store.getState();
  105. let whichSign = baseList.typeConfig.typeConfig;
  106. pushAllDataList(whichSign,'clear');
  107. };