request.ts 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. import { Get, Post } from "../../lib/request/method";
  2. import { createHealthIndex } from "./tools/health-index";
  3. import dayjs from "dayjs";
  4. import { healthAnalysisModel, healthReportModel } from "./model/health.model";
  5. export function healthPatientMethod() {
  6. return Post(`/patientInfoManage/getPatientInfoDetail`, {}, { transform({ data }) { return data } });
  7. }
  8. export function healthReportListMethod() {
  9. const transform = ({ data }: AnyObject) => {
  10. return Array.isArray(data) ? data.map(item => {
  11. return {
  12. id: item.healthAnalysisReportId,
  13. reportTime: item.time3,
  14. description: [item.willillStateName, item.willillDegreeName, item.willillSocialName, item.willillFunctionName].filter(Boolean).join(',')
  15. }
  16. }) : []
  17. }
  18. return Get(`/analysisManage/getHarsTid`, { transform })
  19. }
  20. export function healthReportMethod({ id, scene, ...query }: Record<'id' | 'scene', string | void>): Promise<ReturnType<typeof healthReportModel>> {
  21. const transform = ({ data }: AnyObject) => healthReportModel(data);
  22. let params = { ...query } as any;
  23. if (id) { params.healthAnalysisReportId = id; }
  24. if (scene) {
  25. params.scene = decodeURIComponent(scene);
  26. return Get(`/analysisManage/getHealRepDetailByScene`, { params, transform });
  27. }
  28. return id
  29. ? Get(`/analysisManage/getHealRepDetailById`, { params, transform })
  30. : Post(`/analysisManage/getLastHealRepDetail`, {}, { params, transform })
  31. }
  32. export function healthAnalysisMethod({ id, scene, ...query }: Record<'id' | 'scene', string | void>): Promise<ReturnType<typeof healthAnalysisModel>> {
  33. const transform = ({ data }: AnyObject) => healthAnalysisModel(data);
  34. let params = { ...query } as any;
  35. if (id) { params.tonguefaceAnalysisReportId = id; }
  36. if (scene) {
  37. params.scene = decodeURIComponent(scene);
  38. return Get(`/analysisManage/getTofRepDetailByScene`, { params, transform });
  39. }
  40. return id
  41. ? Get(`/analysisManage/getTofRepDetailById`, { params, transform })
  42. : Post(`/analysisManage/getLastTofRepDetail`, {}, { params, transform })
  43. }
  44. export function healthAnalysisListMethod() {
  45. const transform = ({ data }: AnyObject) => {
  46. return Array.isArray(data) ? data.map(item => {
  47. return {
  48. id: item.id,
  49. reportTime: item.time3,
  50. description: item.content || '',
  51. }
  52. }) : []
  53. }
  54. return Get(`/analysisManage/getTofsTid`, { transform })
  55. }
  56. /**
  57. * 获取指标信息
  58. * @param id 健康分析报告
  59. */
  60. export function healthIndexMethod(id?: string) {
  61. const transform = ({ data }: AnyObject) => Array.isArray(data) ? data.map(item => createHealthIndex(item)) : [];
  62. return id
  63. ? Get(`/analysisManage/getLast7Day`, { params: { healthAnalysisReportId: id }, transform })
  64. : Post(`/patientQuota/getCurQuoval`, {}, { transform })
  65. }
  66. export function healthSchemeMethod(id: string) {
  67. const transform = ({ data }: AnyObject) => {
  68. return {
  69. reportTime: dayjs(data?.time).format('YYYY年MM月DD日'),
  70. children: data?.types?.map((item: AnyObject, i: number) => {
  71. return {
  72. title: item?.type || '',
  73. children: item?.groups?.map((item: AnyObject, j: number) => {
  74. return {
  75. buyUrl: item?.buyUrl || '',
  76. buyType: item?.buyType || '',
  77. title: item?.name || '',
  78. descriptions: item?.attrs?.map((attr: AnyArray, k: number) => {
  79. return { ...attr, id: `description-${i}-${j}-${k}`, }
  80. }) ?? [],
  81. children: item?.items?.map((item: AnyObject, k: number) => {
  82. switch (item?.type) {
  83. case 'img':
  84. return {
  85. id: `${item?.type}-${i}-${j}-${k}`,
  86. type: item.imgUrl ? 'image' : null,
  87. poster: item.imgUrl,
  88. url: item.mediaUrl ?? item.imgUrl,
  89. title: item.name,
  90. description: item.description,
  91. }
  92. case 'video':
  93. return {
  94. id: `${item?.type}-${i}-${j}-${k}`,
  95. type: item.mediaUrl ? 'video' : null,
  96. poster: item.imgUrl,
  97. url: item.mediaUrl,
  98. title: item.name,
  99. description: item.description,
  100. }
  101. case 'acupoint':
  102. return {
  103. id: `${item?.type}-${i}-${j}-${k}`,
  104. type: item.imgUrl ? 'image' : item.name ? 'text' : null,
  105. poster: item.imgUrl,
  106. url: item.mediaUrl ?? item.imgUrl,
  107. title: [item.name, `${item.doase || ''}${item.unit || ''}`].filter(Boolean).join(' '),
  108. description: item.description,
  109. }
  110. case 'medicine':
  111. return {
  112. id: `${item?.type}-${i}-${j}-${k}`,
  113. type: item.imgUrl ? 'image' : item.name ? 'text' : null,
  114. poster: item.imgUrl,
  115. url: item.mediaUrl ?? item.imgUrl,
  116. title: [item.name, `${item.doase || ''}${item.unit || ''}`].filter(Boolean).join(' '),
  117. description: item.description,
  118. }
  119. default:
  120. return {
  121. id: `${item?.type}-${i}-${j}-${k}`,
  122. type: null
  123. }
  124. }
  125. }).filter((item: AnyObject) => item.type) ?? [],
  126. description: item?.description,
  127. }
  128. }) ?? [],
  129. }
  130. }) ?? []
  131. }
  132. };
  133. return Get(`/analysisManage/getCondProgDetailById`, { params: { healthAnalysisReportId: id }, transform })
  134. }
  135. export function getStatusRecordMethod() {
  136. return Post(`/analysisManage/pageHarStatu`, {}, {
  137. transform({ data }: AnyObject) {
  138. return {
  139. total: data.total,
  140. data: data.data?.map((item: AnyObject) => {
  141. return {
  142. reportTime: dayjs(item.analysisEndTime).format('YY/MM/DD'),
  143. ...item
  144. }
  145. })
  146. };
  147. }
  148. })
  149. }
  150. // 获取随访评估列表
  151. export function getFollowEvaluationListMethod() {
  152. return Post(`/followupTaskManage/pageFollowupTaskGroup`, {}, {
  153. transform({ data }: AnyObject) {
  154. return data;
  155. }
  156. })
  157. }
  158. // 获取随访记录列表
  159. export function getFollowRecordListMethod() {
  160. return Post(`/followupTaskManage/pageFollowupTask`, {}, {
  161. transform({ data }: AnyObject) {
  162. return data;
  163. }
  164. })
  165. }
  166. // 获取调养记录列表
  167. export function getCareRecordListMethod(status: string) {
  168. return Post(`/patientCrManage/pagePcrs`, {status}, {
  169. transform({ data }: AnyObject) {
  170. return data;
  171. }
  172. })
  173. }
  174. // 线下非药物治疗
  175. export function getOfflineTreatmentListMethod(progress: string) {
  176. return Post(`/patientCrManage/pagePofflineCp`, {progress}, {
  177. transform({ data }: AnyObject) {
  178. return data;
  179. }
  180. })
  181. }
  182. // 核销记录
  183. // export function getVerifyRecordMethod(id: number) {
  184. // console.log(id, "核销记录");
  185. // // return Post(`/patientCrManage/pofflineCp`, {id}, {
  186. // // transform({ data }: AnyObject) {
  187. // // return data;
  188. // // }
  189. // // })
  190. // }
  191. // 获取调理中的调理记录
  192. export function getCareRecordMethod() {
  193. return Post(`/patientCrManage/getPcing`, {}, {
  194. transform({ data }: AnyObject) {
  195. return data;
  196. }
  197. })
  198. }