request.ts 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. shortImageUrl: item?.miniprogram || '',
  78. title: item?.name || '',
  79. descriptions: item?.attrs?.map((attr: AnyArray, k: number) => {
  80. return { ...attr, id: `description-${i}-${j}-${k}`, }
  81. }) ?? [],
  82. children: item?.items?.map((item: AnyObject, k: number) => {
  83. switch (item?.type) {
  84. case 'img':
  85. return {
  86. id: `${item?.type}-${i}-${j}-${k}`,
  87. type: item.imgUrl ? 'image' : null,
  88. poster: item.imgUrl,
  89. url: item.mediaUrl ?? item.imgUrl,
  90. title: item.name,
  91. description: item.description,
  92. }
  93. case 'video':
  94. return {
  95. id: `${item?.type}-${i}-${j}-${k}`,
  96. type: item.mediaUrl ? 'video' : null,
  97. poster: item.imgUrl,
  98. url: item.mediaUrl,
  99. title: item.name,
  100. description: item.description,
  101. }
  102. case 'acupoint':
  103. return {
  104. id: `${item?.type}-${i}-${j}-${k}`,
  105. type: item.imgUrl ? 'image' : item.name ? 'text' : null,
  106. poster: item.imgUrl,
  107. url: item.mediaUrl ?? item.imgUrl,
  108. title: [item.name, `${item.doase || ''}${item.unit || ''}`].filter(Boolean).join(' '),
  109. description: item.description,
  110. }
  111. case 'medicine':
  112. return {
  113. id: `${item?.type}-${i}-${j}-${k}`,
  114. type: item.imgUrl ? 'image' : item.name ? 'text' : null,
  115. poster: item.imgUrl,
  116. url: item.mediaUrl ?? item.imgUrl,
  117. title: [item.name, `${item.doase || ''}${item.unit || ''}`].filter(Boolean).join(' '),
  118. description: item.description,
  119. }
  120. default:
  121. return {
  122. id: `${item?.type}-${i}-${j}-${k}`,
  123. type: null
  124. }
  125. }
  126. }).filter((item: AnyObject) => item.type) ?? [],
  127. description: item?.description,
  128. }
  129. }) ?? [],
  130. }
  131. }) ?? []
  132. }
  133. };
  134. return Get(`/analysisManage/getCondProgDetailById`, { params: { healthAnalysisReportId: id }, transform })
  135. }
  136. export function getStatusRecordMethod() {
  137. return Post(`/analysisManage/pageHarStatu`, {}, {
  138. transform({ data }: AnyObject) {
  139. return {
  140. total: data.total,
  141. data: data.data?.map((item: AnyObject) => {
  142. return {
  143. reportTime: dayjs(item.analysisEndTime).format('YY/MM/DD'),
  144. ...item
  145. }
  146. })
  147. };
  148. }
  149. })
  150. }
  151. // 获取随访评估列表
  152. export function getFollowEvaluationListMethod() {
  153. return Post(`/followupTaskManage/pageFollowupTaskGroup`, {}, {
  154. transform({ data }: AnyObject) {
  155. return data;
  156. }
  157. })
  158. }
  159. // 获取随访记录列表
  160. export function getFollowRecordListMethod() {
  161. return Post(`/followupTaskManage/pageFollowupTask`, {}, {
  162. transform({ data }: AnyObject) {
  163. return data;
  164. }
  165. })
  166. }
  167. // 获取调养记录列表
  168. export function getCareRecordListMethod(status: string) {
  169. return Post(`/patientCrManage/pagePcrs`, {status}, {
  170. transform({ data }: AnyObject) {
  171. return data;
  172. }
  173. })
  174. }
  175. // 线下非药物治疗
  176. export function getOfflineTreatmentListMethod(progress: string) {
  177. return Post(`/patientCrManage/pagePofflineCp`, {progress}, {
  178. transform({ data }: AnyObject) {
  179. return data;
  180. }
  181. })
  182. }
  183. // 核销记录
  184. // export function getVerifyRecordMethod(id: number) {
  185. // console.log(id, "核销记录");
  186. // // return Post(`/patientCrManage/pofflineCp`, {id}, {
  187. // // transform({ data }: AnyObject) {
  188. // // return data;
  189. // // }
  190. // // })
  191. // }
  192. // 获取调理中的调理记录
  193. export function getCareRecordMethod() {
  194. return Post(`/patientCrManage/getPcing`, {}, {
  195. transform({ data }: AnyObject) {
  196. return data;
  197. }
  198. })
  199. }