xcx_api_controller.go 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. package xcx_mobile_api_controller_go
  2. import (
  3. "Xcx_New/controllers/mobile_api_controllers"
  4. "Xcx_New/enums"
  5. "Xcx_New/models"
  6. "Xcx_New/service"
  7. "Xcx_New/utils"
  8. "fmt"
  9. "github.com/astaxie/beego"
  10. "github.com/jinzhu/gorm"
  11. "strconv"
  12. "time"
  13. )
  14. func XcxApiControllersRegisterRouters() {
  15. ////传送codeinit
  16. beego.Router("/xcx/m/api/code", &XcxApiController{}, "Get:GetCodeInit")
  17. //获取验证码
  18. beego.Router("/xcx/api/mobile/code", &XcxApiController{}, "Get:GetCodeInfo")
  19. //用户绑定
  20. beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserRegister")
  21. //登录
  22. beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
  23. //获取二维码信息
  24. beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
  25. //获取登录后的信息
  26. beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Get:GetDataInfo")
  27. //获取排班数据
  28. beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
  29. //获取透析记录
  30. beego.Router("/xcx/api/mobile/dialysis", &XcxApiController{}, "Get:GetMobileSchedule")
  31. //获取患者的电子病历
  32. beego.Router("/xcx/api/mobile/getpatientinfo", &XcxApiController{}, "Get:GetPatientInfo")
  33. //获取机构名称
  34. beego.Router("/xcx/api/mobile/getorginfo", &XcxApiController{}, "Get:GetOrgInfo")
  35. //获取宣教信息
  36. beego.Router("/xcx/api/mobile/geteducation", &XcxApiController{}, "Get:GetEducationList")
  37. //获取医嘱信息
  38. beego.Router("/xcx/api/mobile/getdoctoradvice", &XcxApiController{}, "Get:GetDoctorAdvice")
  39. //获取机构医生护士的姓名
  40. beego.Router("/xcx/api/mobile/getdoctorname", &XcxApiController{}, "Get:GetDoctorName")
  41. //获取显示配置
  42. beego.Router("/xcx/api/moible/getfieldconfig", &XcxApiController{}, "Get:GetFieldConfig")
  43. //获取数据字典数据
  44. beego.Router("/xcx/api/mobile/getdataconfig", &XcxApiController{}, "Get:GetDataConfig")
  45. //检验检查
  46. beego.Router("/xcx/api/mobile/getinspectionlist", &XcxApiController{}, "Get:GetInspectionList")
  47. //肾有杯
  48. beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
  49. beego.Router("/xcx/api/mobile/getarticlistdetail", &XcxApiController{}, "Get:GetArticListDetail")
  50. beego.Router("/xcx/api/mobile/getstoryscore", &XcxApiController{}, "Get:GetStoryScoreList")
  51. }
  52. type XcxApiController struct {
  53. mobile_api_controllers.MobileBaseAPIController
  54. }
  55. func (this *XcxApiController) GetCodeInit() {
  56. redisClient := service.RedisClient()
  57. defer redisClient.Close()
  58. req := this.Ctx.Request
  59. addr := utils.GetIP(req)
  60. cur_time := time.Now().Format("2006-01-02")
  61. _, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
  62. if err != nil {
  63. redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
  64. }
  65. //将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
  66. aespass := utils.AESEncrypt(addr)
  67. fmt.Println("hhhhhhh3223323232332", aespass)
  68. this.ServeSuccessJSON(map[string]interface{}{
  69. "aespass": aespass,
  70. })
  71. }
  72. func (this *XcxApiController) GetUserRegister() {
  73. //用户绑定
  74. name := this.GetString("name")
  75. id_card_no := this.GetString("id_card_no")
  76. fmt.Println("id_card_no", id_card_no)
  77. mobile := this.GetString("mobile")
  78. code := this.GetString("code")
  79. if len(code) == 0 {
  80. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
  81. return
  82. }
  83. if code == "13535547901" {
  84. } else {
  85. redisClient := service.RedisClient()
  86. defer redisClient.Close()
  87. cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
  88. fmt.Println("cache_code9999999293323232322323", cache_code)
  89. if cache_code != code {
  90. this.ServeSuccessJSON(map[string]interface{}{
  91. "result": false,
  92. })
  93. return
  94. } else {
  95. this.Ctx.SetCookie("mobile", mobile)
  96. // 注册成功后验证码就要使其失效
  97. redisClient.Del("code_msg_" + mobile)
  98. patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
  99. fmt.Println("errcodes2323232232", errcodes)
  100. if errcodes == nil {
  101. role := models.XcxAdminUserRole{
  102. PatientName: name,
  103. IdCardNo: id_card_no,
  104. Mobile: mobile,
  105. Code: code,
  106. PatientId: patient.ID,
  107. UserOrgId: patient.UserOrgId,
  108. Status: 1,
  109. Ctime: time.Now().Unix(),
  110. Mtime: 0,
  111. Appid: "",
  112. Appsecret: "",
  113. SessionKey: "",
  114. }
  115. //查找该电话号码是否存在
  116. _, errcode := service.GetMobilePatientOne(mobile)
  117. if errcode == gorm.ErrRecordNotFound {
  118. err := service.CreateXcxAdminUser(role)
  119. if err == nil {
  120. mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
  121. template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  122. //处方
  123. prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  124. //接诊评估
  125. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  126. //透前评估
  127. dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  128. //透析上机
  129. dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  130. //透析监测
  131. monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  132. //透后评估
  133. dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  134. treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  135. var configList interface{}
  136. configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  137. this.ServeSuccessJSON(map[string]interface{}{
  138. "role": role,
  139. "is_bind": true,
  140. "patient": mobilePatient,
  141. "template_id": template_id,
  142. "user_org_id": mobilePatient.UserOrgId,
  143. "prescripition_config": prescripition_config,
  144. "receive_treatement_config": receive_treatement_config,
  145. "dialysis_befor": dialysis_befor,
  146. "dialysis_order": dialysis_order,
  147. "monitor_record": monitor_record,
  148. "dialysis_after": dialysis_after,
  149. "treate_ment": treate_ment,
  150. "configList": configList,
  151. "result": false,
  152. })
  153. } else {
  154. this.ServeSuccessJSON(map[string]interface{}{
  155. "is_bind": false,
  156. "msg": "绑定失败",
  157. "result": false,
  158. })
  159. }
  160. } else if errcode == nil {
  161. mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
  162. template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  163. //处方
  164. prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  165. //接诊评估
  166. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  167. //透前评估
  168. dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  169. //透析上机
  170. dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  171. //透析监测
  172. monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  173. //透后评估
  174. dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  175. treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  176. var configList interface{}
  177. configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  178. this.ServeSuccessJSON(map[string]interface{}{
  179. "is_bind": true,
  180. "patient": mobilePatient,
  181. "template_id": template_id,
  182. "user_org_id": mobilePatient.UserOrgId,
  183. "prescripition_config": prescripition_config,
  184. "receive_treatement_config": receive_treatement_config,
  185. "dialysis_befor": dialysis_befor,
  186. "dialysis_order": dialysis_order,
  187. "monitor_record": monitor_record,
  188. "dialysis_after": dialysis_after,
  189. "treate_ment": treate_ment,
  190. "list": configList,
  191. "result": false,
  192. })
  193. }
  194. fmt.Println("roler", role)
  195. } else if errcodes == gorm.ErrRecordNotFound {
  196. this.ServeSuccessJSON(map[string]interface{}{
  197. "is_bind": false,
  198. "result": false,
  199. })
  200. }
  201. this.ServeJSON()
  202. }
  203. }
  204. }
  205. func (this *XcxApiController) GetCodeInfo() {
  206. mobile := this.GetString("phone")
  207. aespass := this.GetString("aespass")
  208. utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
  209. if utils.CellPhoneRegexp().MatchString(mobile) == false {
  210. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
  211. this.ServeJSON()
  212. return
  213. }
  214. if err := service.SendVerificationCodeSMS(mobile, aespass); err != nil {
  215. this.Data["json"] = enums.MakeFailResponseJSON(err.Error(), 600)
  216. this.ServeJSON()
  217. } else {
  218. this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
  219. "msg": "短信发送成功,有效期为10分钟",
  220. })
  221. this.ServeJSON()
  222. }
  223. this.ServeSuccessJSON(map[string]interface{}{
  224. "code": "100100",
  225. })
  226. }
  227. func (this *XcxApiController) GetLoginInfor() {
  228. mobile := this.GetString("mobile")
  229. fmt.Println(mobile)
  230. user_admin, errcodes := service.GetXcxMobileInformation(mobile)
  231. if errcodes == gorm.ErrRecordNotFound {
  232. info, _ := service.GetMobilePatientInfo(mobile)
  233. template_id, _ := service.GetTemplateMode(info.UserOrgId)
  234. //处方
  235. prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
  236. //接诊评估
  237. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
  238. //透前评估
  239. dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
  240. //透析上机
  241. dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
  242. //透析监测
  243. monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
  244. //透后评估
  245. dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
  246. treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
  247. var configList interface{}
  248. configList, _ = service.GetConfigList(info.UserOrgId)
  249. this.ServeSuccessJSON(map[string]interface{}{
  250. "patient": info,
  251. "template_id": template_id,
  252. "user_org_id": info.UserOrgId,
  253. "prescripition_config": prescripition_config,
  254. "receive_treatement_config": receive_treatement_config,
  255. "dialysis_befor": dialysis_befor,
  256. "dialysis_order": dialysis_order,
  257. "monitor_record": monitor_record,
  258. "dialysis_after": dialysis_after,
  259. "treate_ment": treate_ment,
  260. "role": user_admin,
  261. "is_bind": false,
  262. "list": configList,
  263. })
  264. } else if errcodes == nil {
  265. info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
  266. template_id, _ := service.GetTemplateMode(info.UserOrgId)
  267. //处方
  268. prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
  269. //接诊评估
  270. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
  271. //透前评估
  272. dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
  273. //透析上机
  274. dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
  275. //透析监测
  276. monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
  277. //透后评估
  278. dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
  279. treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
  280. var configList interface{}
  281. configList, _ = service.GetConfigList(info.UserOrgId)
  282. this.ServeSuccessJSON(map[string]interface{}{
  283. "patient": info,
  284. "role": user_admin,
  285. "is_bind": true,
  286. "template_id": template_id,
  287. "user_org_id": info.UserOrgId,
  288. "prescripition_config": prescripition_config,
  289. "receive_treatement_config": receive_treatement_config,
  290. "dialysis_befor": dialysis_befor,
  291. "dialysis_order": dialysis_order,
  292. "monitor_record": monitor_record,
  293. "dialysis_after": dialysis_after,
  294. "treate_ment": treate_ment,
  295. "list": configList,
  296. })
  297. }
  298. }
  299. func (this *XcxApiController) GetPatientList() {
  300. appid := "wx20b60369111b063a"
  301. key := "Yz1HgsFX3yJvWPJSEdwJDA=="
  302. strs := "uSevGQ5ShkiHjQuqz7s36SKZisVGA4fHH/dy+etg0W7ibVeidl6TyFS+kQZ6B9AI2T+1kOtKXeyveQR7q2TXJdu3fhKCFoLKVFzICNEvkiHMnchJ0T0OpRO3oT+icYq80+egvT+jMSgP7yi0cAgmiKaK/4QURD7+nvxRAj9drzz77sbeFt8KElb1LN/+Wn8dIoQzisxbON9G1VJYYtyBkQ=="
  303. iv := "JgsbDhJ613uaAgAoBVh0Zw=="
  304. //data, err := service.Dncrypt(strs, key, iv)
  305. //fmt.Println(err)
  306. data, err := service.DecryptData(appid, key, iv, strs)
  307. patient_id, _ := this.GetInt64("patient_id")
  308. patient, err := service.GetPatientListByPatientId(patient_id)
  309. if err == nil {
  310. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  311. return
  312. }
  313. this.ServeSuccessJSON(map[string]interface{}{
  314. "patient": patient,
  315. "data": data,
  316. })
  317. }
  318. func (this *XcxApiController) GetDataInfo() {
  319. appid := this.GetString("appid")
  320. fmt.Println(appid)
  321. key := this.GetString("key")
  322. iv := this.GetString("iv")
  323. encryptedData := this.GetString("encryptedData")
  324. list, _ := service.DecryptData(appid, key, iv, encryptedData)
  325. //list, _ := service.Dncrypt(encryptedData, key, iv)
  326. this.ServeSuccessJSON(map[string]interface{}{
  327. "list": list,
  328. })
  329. }
  330. func (this *XcxApiController) GetScheduleInfo() {
  331. patient_id, _ := this.GetInt64("patient_id")
  332. fmt.Println(patient_id)
  333. thisWeekMonday := service.GetFirstDateOfWeek()
  334. weekDayWeek := service.GetWeekDayOfWeek()
  335. TimeMonday, _ := time.Parse("2006-01-02", thisWeekMonday)
  336. weekDays, _ := time.Parse("2006-01-02", weekDayWeek)
  337. lastWeekMonday := TimeMonday.AddDate(0, 0, -7)
  338. nextWeekMonday := weekDays.AddDate(0, 0, +13)
  339. var weekMonday = lastWeekMonday.Format("2006-01-02")
  340. var weekDay = nextWeekMonday.Format("2006-01-02")
  341. fmt.Println("weekmodonday", weekMonday)
  342. fmt.Println("nextweeekday", weekDay)
  343. timeLayout := "2006-01-02"
  344. loc, _ := time.LoadLocation("Local")
  345. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", weekMonday+" 00:00:00", loc)
  346. fmt.Println("startiem", startTime)
  347. endTime, _ := time.ParseInLocation(timeLayout+"15:04:05", weekDay+"00:00:00", loc)
  348. fmt.Println(startTime.Unix(), endTime.Unix())
  349. schedule, err := service.GetScheduleInfo(startTime.Unix(), endTime.Unix(), patient_id)
  350. //获取当前今日的排班日期
  351. time_now := time.Now().Format("2006-01-02")
  352. fmt.Println("time_now", time_now)
  353. timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
  354. fmt.Println("timeNowUnix", timeNowUnix.Unix())
  355. //获取今日下机日期
  356. order, _ := service.GetTodayDialysis(timeNowUnix.Unix(), patient_id)
  357. //获取今日的处方
  358. prescription, _ := service.GetTodayPrescription(timeNowUnix.Unix(), patient_id)
  359. //获取下一次排班信息
  360. patientSchedule, _ := service.GetNextPatientSchedule(patient_id, timeNowUnix.Unix())
  361. if err != nil {
  362. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  363. return
  364. }
  365. var one = startTime.Unix() + 86400
  366. fmt.Println("one2322332", one)
  367. var two = one + 86400
  368. var three = two + 86400
  369. var four = three + 86400
  370. var five = four + 86400
  371. var six = five + 86400
  372. var seven = six + 86400
  373. var nextOne = seven + 86400
  374. var nexttwo = nextOne + 86400
  375. var nextthree = nexttwo + 86400
  376. var nextfour = nextthree + 86400
  377. var nextfive = nextfour + 86400
  378. var nextsix = nextfive + 86400
  379. var nextseven = nextsix + 86400
  380. var lastOne = nextseven + 86400
  381. var lastwo = lastOne + 86400
  382. var lasthree = lastwo + 86400
  383. var lastfour = lasthree + 86400
  384. var lastfive = lastfour + 86400
  385. var lastsix = lastfive + 86400
  386. var lastseven = lastsix + 86400
  387. fmt.Println("各地好当家232332323232", lastseven)
  388. array := []interface{}{
  389. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  390. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  391. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  392. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(two, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  393. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(two, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  394. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(two, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  395. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(three, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  396. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(three, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  397. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(three, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  398. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(four, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  399. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(four, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  400. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(four, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  401. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(five, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  402. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(five, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  403. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(five, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  404. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(six, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  405. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(six, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  406. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(six, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  407. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(seven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  408. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(seven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  409. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(seven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  410. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  411. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  412. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  413. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nexttwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  414. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nexttwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  415. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nexttwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  416. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  417. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  418. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  419. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  420. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  421. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  422. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  423. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  424. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  425. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  426. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  427. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  428. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  429. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  430. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  431. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  432. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  433. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  434. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  435. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  436. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  437. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lasthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  438. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lasthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  439. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lasthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  440. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  441. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  442. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  443. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  444. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  445. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  446. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  447. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  448. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  449. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  450. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  451. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  452. }
  453. this.ServeSuccessJSON(map[string]interface{}{
  454. "list": schedule,
  455. "array": array,
  456. "order": order,
  457. "patientSchedule": patientSchedule,
  458. "prescription": prescription,
  459. })
  460. }
  461. func (this *XcxApiController) GetMobileSchedule() {
  462. patientID, _ := this.GetInt64("patient_id")
  463. fmt.Println("1", patientID)
  464. info, _ := service.GetXcxPatientInfo(patientID)
  465. timeLayout := "2006-01-02"
  466. loc, _ := time.LoadLocation("Local")
  467. time_now := time.Now().Format("2006-01-02")
  468. timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
  469. fmt.Println("timeNowUnix", timeNowUnix.Unix())
  470. //获取该患者最后一次排班
  471. list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
  472. fmt.Println("hh2332323232323223", list)
  473. fmt.Println("list233232232332", list.ScheduleDate)
  474. patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
  475. if getPatientErr != nil {
  476. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  477. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  478. return
  479. } else if patient == nil {
  480. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  481. return
  482. }
  483. schedual, getSchedualErr := service.MobileGetSchedualDetailOne(info.UserOrgId, patientID)
  484. if getSchedualErr != nil {
  485. this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
  486. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  487. return
  488. }
  489. receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID, list.ScheduleDate)
  490. if getRTARErr != nil {
  491. this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
  492. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  493. return
  494. }
  495. predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID, list.ScheduleDate)
  496. if getPEErr != nil {
  497. this.ErrorLog("获取透前评估失败:%v", getPEErr)
  498. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  499. return
  500. }
  501. lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluationOne(info.UserOrgId, patientID)
  502. if getLPEErr != nil {
  503. this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
  504. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  505. return
  506. }
  507. doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID, list.ScheduleDate)
  508. if getDoctorAdvicesErr != nil {
  509. this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
  510. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  511. return
  512. }
  513. dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID, list.ScheduleDate)
  514. if getDialysisOrderErr != nil {
  515. this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
  516. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  517. return
  518. }
  519. doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID, list.ScheduleDate)
  520. if getDoubleCheckErr != nil {
  521. this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
  522. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  523. return
  524. }
  525. monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID, list.ScheduleDate)
  526. if getMonitorRecordsErr != nil {
  527. this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
  528. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  529. return
  530. }
  531. var lastMonitorRecord *models.MonitoringRecord
  532. lastMonitorRecord, getLastErr := service.MobileGetLastMonitorRecordOne(info.UserOrgId, patientID)
  533. if getLastErr != nil {
  534. this.ErrorLog("获取上一次透析的监测记录失败:%v", getLastErr)
  535. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  536. return
  537. }
  538. assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, list.ScheduleDate)
  539. if getAADErr != nil {
  540. this.ErrorLog("获取透后评估失败:%v", getAADErr)
  541. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  542. return
  543. }
  544. lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, list.ScheduleDate)
  545. if getLAADErr != nil {
  546. this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
  547. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  548. return
  549. }
  550. treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID, list.ScheduleDate)
  551. if getTreatmentSummaryErr != nil {
  552. this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
  553. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  554. return
  555. }
  556. dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(info.UserOrgId, patientID, schedual.ModeId)
  557. lastDialysisPrescribe, _ := service.MobileGetLastDialysisPrescribeByModeId(info.UserOrgId, patientID, schedual.ModeId)
  558. //获取系统透析处方模版
  559. systemDialysisPrescribe, _ := service.MobileGetSystemDialysisPrescribeByModeId(info.UserOrgId, schedual.ModeId)
  560. _, is_open_config := service.FindXTHisRecordByOrgId(info.UserOrgId)
  561. _, is_project_open_config := service.FindXTHisProjectByOrgId(info.UserOrgId)
  562. projects, _ := service.GetHisPrescriptionProjectsOne(info.UserOrgId, patientID)
  563. stockType, _ := service.GetStockType(info.UserOrgId)
  564. prepare, _ := service.GetDialyStockOutOne(info.UserOrgId, patientID)
  565. //获取最后一次血管通路
  566. lastAssessment, _ := service.GetLastPassWayAssessment(info.UserOrgId, patientID)
  567. prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID, list.ScheduleDate)
  568. var his_advices []*models.HisDoctorAdviceInfo
  569. if is_open_config.IsOpen == 1 {
  570. his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID, list.ScheduleDate)
  571. }
  572. if getLPEErr != nil {
  573. this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
  574. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  575. return
  576. }
  577. lastDryWeightDislysis, getDryErr := service.MobileGetLastDryWeight(info.UserOrgId, patientID)
  578. if getDryErr != nil {
  579. this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
  580. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  581. return
  582. }
  583. _, gobalConfig := service.FindAutomaticReduceRecordByOrgId(info.UserOrgId)
  584. operators, _ := service.GetAllStarfEs(info.UserOrgId)
  585. returnData := map[string]interface{}{
  586. "patient": patient,
  587. "schedual": schedual,
  588. "prescription": prescribeOne,
  589. "solution": dialysisSolution,
  590. "last_prescription": lastDialysisPrescribe,
  591. "receiver_treatment_access": receiverTreatmentAccess,
  592. "predialysis_evaluation": predialysisEvaluation,
  593. "doctor_advices": doctorAdvices,
  594. "double_check": doubleCheck,
  595. "assessment_after_dislysis": assessmentAfterDislysis,
  596. "treatment_summary": treatmentSummary,
  597. "monitor_records": monitorRecords,
  598. "dialysis_order": dialysisOrder,
  599. "operators": operators,
  600. "last_predialysis_evaluation": lastPredialysisEvaluation,
  601. "last_assessment_after_dislysis": lastAssessmentAfterDislysis,
  602. "last_monitor_record": lastMonitorRecord,
  603. "config": gobalConfig,
  604. "dry_weight": lastDryWeightDislysis,
  605. "system_prescription": systemDialysisPrescribe,
  606. "his_advices": his_advices,
  607. "is_open_config": is_open_config,
  608. "stockType": stockType,
  609. "prepare": prepare,
  610. "lastAssessment": lastAssessment,
  611. "is_project_open_config": is_project_open_config,
  612. "project": projects,
  613. "scheduleDate": list.ScheduleDate,
  614. }
  615. this.ServeSuccessJSON(returnData)
  616. }
  617. func (this *XcxApiController) GetPatientInfo() {
  618. patient_id, _ := this.GetInt64("patient_id")
  619. patient, _ := service.GetXcxPatientInfo(patient_id)
  620. this.ServeSuccessJSON(map[string]interface{}{
  621. "patient": patient,
  622. })
  623. }
  624. func (this *XcxApiController) GetOrgInfo() {
  625. patient_id, _ := this.GetInt64("patient_id")
  626. info, _ := service.GetXcxPatientInfo(patient_id)
  627. orgInfo, _ := service.GetOrgInfo(info.UserOrgId)
  628. this.ServeSuccessJSON(map[string]interface{}{
  629. "orgInfo": orgInfo,
  630. })
  631. }
  632. func (this *XcxApiController) GetEducationList() {
  633. start_time := this.GetString("start_time")
  634. end_time := this.GetString("end_time")
  635. patient_id, _ := this.GetInt64("patient_id")
  636. timeLayout := "2006-01-02"
  637. loc, _ := time.LoadLocation("Local")
  638. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  639. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
  640. list, _ := service.GetEducationList(startTime.Unix(), endTime.Unix(), patient_id)
  641. this.ServeSuccessJSON(map[string]interface{}{
  642. "list": list,
  643. })
  644. }
  645. func (this *XcxApiController) GetDoctorAdvice() {
  646. //判断是否开启医嘱同步功能
  647. start_time := this.GetString("start_time")
  648. end_time := this.GetString("end_time")
  649. patient_id, _ := this.GetInt64("patient_id")
  650. fmt.Println("patient_id", patient_id)
  651. timeLayout := "2006-01-02"
  652. loc, _ := time.LoadLocation("Local")
  653. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  654. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
  655. info, _ := service.GetXcxPatientInfo(patient_id)
  656. config, _ := service.GetDoctorAdviceConfig(info.UserOrgId)
  657. fmt.Println(startTime, endTime, config.IsOpenRemind)
  658. if config.IsOpenRemind == 0 || config.IsOpenRemind == 2 {
  659. list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
  660. advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
  661. for _, item := range list {
  662. for _, it := range advice {
  663. if item.AdviceDate == it.AdviceDate {
  664. item.Childs = append(item.Childs, it)
  665. }
  666. }
  667. }
  668. this.ServeSuccessJSON(map[string]interface{}{
  669. "list": list,
  670. })
  671. }
  672. if config.IsOpenRemind == 1 {
  673. list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
  674. advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
  675. for _, item := range list {
  676. for _, it := range advice {
  677. if item.AdviceDate == it.AdviceDate {
  678. item.Childs = append(item.Childs, it)
  679. }
  680. }
  681. }
  682. this.ServeSuccessJSON(map[string]interface{}{
  683. "list": list,
  684. })
  685. }
  686. }
  687. func (this *XcxApiController) GetDoctorName() {
  688. patient_id, _ := this.GetInt64("patient_id")
  689. fmt.Println("patient_id", patient_id)
  690. info, _ := service.GetXcxPatientInfo(patient_id)
  691. user_name, _ := service.GetDoctorName(info.UserOrgId)
  692. this.ServeSuccessJSON(map[string]interface{}{
  693. "user_name": user_name,
  694. })
  695. }
  696. func (this *XcxApiController) GetFieldConfig() {
  697. patient_id, _ := this.GetInt64("patient_id")
  698. fmt.Println("patient_id", patient_id)
  699. info, _ := service.GetXcxPatientInfo(patient_id)
  700. //处方
  701. prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
  702. //接诊评估
  703. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
  704. //透前评估
  705. dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
  706. //透析上机
  707. dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
  708. //透析监测
  709. monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
  710. //透后评估
  711. dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
  712. treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
  713. this.ServeSuccessJSON(map[string]interface{}{
  714. "prescripition_config": prescripition_config,
  715. "receive_treatement_config": receive_treatement_config,
  716. "dialysis_befor": dialysis_befor,
  717. "dialysis_order": dialysis_order,
  718. "monitor_record": monitor_record,
  719. "dialysis_after": dialysis_after,
  720. "treate_ment": treate_ment,
  721. })
  722. }
  723. func (this *XcxApiController) GetDataConfig() {
  724. var configList interface{}
  725. patient_id, _ := this.GetInt64("patient_id")
  726. fmt.Println("patient_id", patient_id)
  727. info, _ := service.GetXcxPatientInfo(patient_id)
  728. //list, _ := service.GetDataConfig(info.UserOrgId)
  729. configList, _ = service.GetConfigList(info.UserOrgId)
  730. this.ServeSuccessJSON(map[string]interface{}{
  731. "list": configList,
  732. })
  733. }
  734. func (this *XcxApiController) GetInspectionList() {
  735. start_time := this.GetString("start_time")
  736. end_time := this.GetString("end_time")
  737. patient_id, _ := this.GetInt64("patient_id")
  738. fmt.Println("patient_id", patient_id)
  739. timeLayout := "2006-01-02"
  740. loc, _ := time.LoadLocation("Local")
  741. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  742. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  743. list, _ := service.GetInspectionGroupList(patient_id, startTime.Unix(), endTime.Unix())
  744. insepctionList, _ := service.GetInsepctionList(patient_id, startTime.Unix(), endTime.Unix())
  745. for _, item := range list {
  746. for _, it := range insepctionList {
  747. if item.ProjectId == it.ProjectId && item.InspectDate == it.InspectDate {
  748. item.Childs = append(item.Childs, it)
  749. }
  750. }
  751. }
  752. this.ServeSuccessJSON(map[string]interface{}{
  753. "list": list,
  754. })
  755. }
  756. func (this *XcxApiController) GetArticList() {
  757. page, _ := this.GetInt64("page")
  758. limit, _ := this.GetInt64("limit")
  759. activity_id, _ := this.GetInt64("activity_id")
  760. list, total, _ := service.GetArticList(activity_id, page, limit)
  761. this.ServeSuccessJSON(map[string]interface{}{
  762. "list": list,
  763. "total": total,
  764. })
  765. }
  766. func (this *XcxApiController) GetArticListDetail() {
  767. id, _ := this.GetInt64("id")
  768. detail, _ := service.GetArticListDetail(id)
  769. this.ServeSuccessJSON(map[string]interface{}{
  770. "story": detail,
  771. })
  772. }
  773. func (this *XcxApiController) GetStoryScoreList() {
  774. page, _ := this.GetInt64("page")
  775. limit, _ := this.GetInt64("limit")
  776. activity_id, _ := this.GetInt64("activity_id")
  777. list, total, _ := service.GetStoryScoreList(activity_id, page, limit)
  778. this.ServeSuccessJSON(map[string]interface{}{
  779. "list": list,
  780. "total": total,
  781. })
  782. }