xcx_api_controller.go 55KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453
  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. "github.com/shopspring/decimal"
  12. "strconv"
  13. "time"
  14. )
  15. func XcxApiControllersRegisterRouters() {
  16. ////传送codeinit
  17. beego.Router("/xcx/m/api/code", &XcxApiController{}, "Get:GetCodeInit")
  18. //获取验证码
  19. beego.Router("/xcx/api/mobile/code", &XcxApiController{}, "Post:GetCodeInfo")
  20. //用户绑定
  21. beego.Router("/xcx/api/mobile/register", &XcxApiController{}, "Get:GetUserNameRegister")
  22. //手机号登录
  23. beego.Router("/xcx/api/mobile/login", &XcxApiController{}, "Get:GetLoginInfor")
  24. //openid登录
  25. beego.Router("/xcx/api/openid/login", &XcxApiController{}, "Get:GetLoginInfoByOpenid")
  26. //获取二维码信息
  27. beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
  28. //获取登录后的信息
  29. beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Get:GetDataInfo")
  30. //获取排班数据
  31. beego.Router("/xcx/api/mobile/schedulebyweek", &XcxApiController{}, "Post:GetSchedulesByWeek")
  32. //获取排班数据
  33. beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
  34. //获取透析记录
  35. beego.Router("/xcx/api/mobile/dialysis", &XcxApiController{}, "Get:GetMobileSchedule")
  36. //获取体重纪录
  37. beego.Router("/xcx/api/mobile/signweight", &XcxApiController{}, "Get:GetSignsByWeight")
  38. //获取血压纪录
  39. beego.Router("/xcx/api/mobile/signblood", &XcxApiController{}, "Get:GetSignsByBlood")
  40. //获取患者的电子病历
  41. beego.Router("/xcx/api/mobile/getpatientinfo", &XcxApiController{}, "Get:GetPatientInfo")
  42. //获取机构名称
  43. beego.Router("/xcx/api/mobile/getorginfo", &XcxApiController{}, "Get:GetOrgInfo")
  44. //获取宣教信息
  45. beego.Router("/xcx/api/mobile/geteducation", &XcxApiController{}, "Get:GetEducationList")
  46. //获取医嘱信息
  47. beego.Router("/xcx/api/mobile/getdoctoradvice", &XcxApiController{}, "Get:GetDoctorAdvice")
  48. //获取机构医生护士的姓名
  49. beego.Router("/xcx/api/mobile/getdoctorname", &XcxApiController{}, "Get:GetDoctorName")
  50. //获取显示配置
  51. beego.Router("/xcx/api/moible/getfieldconfig", &XcxApiController{}, "Get:GetFieldConfig")
  52. //获取数据字典数据
  53. beego.Router("/xcx/api/mobile/getdataconfig", &XcxApiController{}, "Get:GetDataConfig")
  54. //检验检查列表
  55. beego.Router("/xcx/api/mobile/getinspectionlist", &XcxApiController{}, "Get:GetInspectionList")
  56. //检验检查详情
  57. beego.Router("/xcx/api/mobile/getinspectioninfo", &XcxApiController{}, "Get:GetInspectionInfo")
  58. //肾有杯
  59. beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
  60. beego.Router("/xcx/api/mobile/getarticlistdetail", &XcxApiController{}, "Get:GetArticListDetail")
  61. beego.Router("/xcx/api/mobile/getstoryscore", &XcxApiController{}, "Get:GetStoryScoreList")
  62. //获取appid
  63. beego.Router("/xcx/api/mobile/getappid", &XcxApiController{}, "Get:GetAppId")
  64. // 获取充值当前余额信息
  65. beego.Router("/xcx/api/mobile/getbalance", &XcxApiController{}, "Get:IdToBalance")
  66. // 获取一段时间内
  67. beego.Router("/xcx/api/mobile/getbalanceinfo", &XcxApiController{}, "Get:DepositFlow")
  68. }
  69. type XcxApiController struct {
  70. mobile_api_controllers.MobileBaseAPIController
  71. }
  72. // 根据id获取押金流水
  73. func (this *XcxApiController) DepositFlow() {
  74. orgid, _ := this.GetInt64("org_id", 0)
  75. patient_id, _ := this.GetInt64("patient_id", 0) //患者id
  76. //获取当前患者的姓名
  77. tmp, _ := service.GetHisUserName(orgid, patient_id)
  78. name := tmp.Name
  79. start_time := this.GetString("start_time", "") //开始时间
  80. end_time := this.GetString("end_time", "") //结束时间
  81. timeLayout := "2006-01-02"
  82. loc, _ := time.LoadLocation("Local")
  83. var stime int64 //开始时间
  84. var etime int64 //结束时间
  85. if start_time == "" || end_time == "" {
  86. //如果为空则查全部的
  87. stime, etime = service.GetMonth()
  88. } else {
  89. stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  90. etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  91. stime = stmp.Unix()
  92. etime = etmp.Unix()
  93. }
  94. ////获取该角色当前时间段的余额
  95. //decimal := service.GetMoneyforTime(id, orgid, etime)
  96. //获取列表
  97. deposirhistory, errs := service.GetFlowList(patient_id, orgid, stime, etime)
  98. if errs != nil {
  99. utils.ErrorLog("获取列表失败,原因为:", errs.Error())
  100. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, errs.Error())
  101. return
  102. }
  103. var expenditure, recharge decimal.Decimal
  104. for i := 0; i < len(deposirhistory); i++ {
  105. //如果为扣费,或退费 则把订单id变为就诊号
  106. if deposirhistory[i].DepositStatus == 1 || deposirhistory[i].DepositStatus == 3 || deposirhistory[i].DepositStatus == 4 {
  107. recharge = recharge.Add(deposirhistory[i].Deposit)
  108. }
  109. if deposirhistory[i].DepositStatus == 2 {
  110. expenditure = expenditure.Add(deposirhistory[i].Deposit)
  111. }
  112. }
  113. this.ServeSuccessJSON(map[string]interface{}{
  114. "list": deposirhistory,
  115. "name": name,
  116. "start_time": time.Unix(stime, 0).Format("2006-01-02"),
  117. "end_time": time.Unix(etime, 0).Format("2006-01-02"),
  118. "expenditure": expenditure,
  119. "recharge": recharge,
  120. })
  121. return
  122. }
  123. // 根据患者id查询患者的余额
  124. func (this *XcxApiController) IdToBalance() {
  125. orgid, _ := this.GetInt64("org_id", 0)
  126. his_patient_id, _ := this.GetInt64("patient_id", 0)
  127. if orgid <= 0 || his_patient_id <= 0 {
  128. this.ServeSuccessJSON(map[string]interface{}{
  129. "error_code": 1001,
  130. "error_msg": "参数错误",
  131. })
  132. }
  133. balance := service.GetUserMoney(his_patient_id, orgid)
  134. patient, _ := service.GetPatientByIdXcx(his_patient_id)
  135. this.ServeSuccessJSON(map[string]interface{}{
  136. "balance": balance,
  137. "patient": patient,
  138. })
  139. return
  140. }
  141. func (this *XcxApiController) GetCodeInit() {
  142. redisClient := service.RedisClient()
  143. defer redisClient.Close()
  144. req := this.Ctx.Request
  145. addr := utils.GetIP(req)
  146. cur_time := time.Now().Format("2006-01-02")
  147. _, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
  148. if err != nil {
  149. redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
  150. }
  151. //将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
  152. aespass := utils.AESEncrypt(addr)
  153. this.ServeSuccessJSON(map[string]interface{}{
  154. "aespass": aespass,
  155. })
  156. }
  157. func (this *XcxApiController) GetUserNameRegister() {
  158. // name := this.GetString("name")
  159. // relationship := this.GetString("relationship")
  160. id_card_no := this.GetString("id_card_no")
  161. mobile := this.GetString("mobile")
  162. // code := this.GetString("code")
  163. openid := this.GetString("openid")
  164. if len(mobile) == 0 || len(openid) == 0 {
  165. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  166. return
  167. }
  168. // redisClient := service.RedisClient()
  169. // defer redisClient.Close()
  170. // cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
  171. // utils.TraceLog("cache_code:%v code:%v", cache_code, code)
  172. // if cache_code != code {
  173. // this.ServeSuccessJSON(map[string]interface{}{
  174. // "err_code": "1001",
  175. // "err_msg": "验证码错误",
  176. // })
  177. // return
  178. // }
  179. // this.Ctx.SetCookie("mobile", mobile)
  180. // // 注册成功后验证码就要使其失效
  181. // redisClient.Del("code_msg_" + mobile)
  182. patient, errcodes := service.GetPatientByIdcardno(id_card_no)
  183. if errcodes == nil {
  184. role := models.XcxAdminUserRole{
  185. PatientName: patient.Name,
  186. // Relationship: relationship,
  187. IdCardNo: id_card_no,
  188. Mobile: mobile,
  189. // Code: code,
  190. PatientId: patient.ID,
  191. UserOrgId: patient.UserOrgId,
  192. Status: 1,
  193. Ctime: time.Now().Unix(),
  194. Mtime: 0,
  195. Appid: "",
  196. Appsecret: "",
  197. SessionKey: "",
  198. Openid: openid,
  199. }
  200. err := service.CreateXcxAdminUser(role)
  201. if err == nil {
  202. //mobilePatient, _ := service.GetNamePatient(name, id_card_no)
  203. //template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  204. ////处方
  205. //prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  206. //
  207. ////接诊评估
  208. //receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  209. //
  210. ////透前评估
  211. //dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  212. //
  213. ////透析上机
  214. //dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  215. //
  216. ////透析监测
  217. //monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  218. //
  219. ////透后评估
  220. //dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  221. //
  222. //treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  223. //var configList interface{}
  224. //configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  225. this.ServeSuccessJSON(map[string]interface{}{
  226. "role": role,
  227. "is_bind": true,
  228. "err_code": "0",
  229. "err_msg": "",
  230. //"patient": mobilePatient,
  231. //"template_id": template_id,
  232. "user_org_id": patient.UserOrgId,
  233. //"prescripition_config": prescripition_config,
  234. //"receive_treatement_config": receive_treatement_config,
  235. //"dialysis_befor": dialysis_befor,
  236. //"dialysis_order": dialysis_order,
  237. //"monitor_record": monitor_record,
  238. //"dialysis_after": dialysis_after,
  239. //"treate_ment": treate_ment,
  240. //"configList": configList,
  241. //"result": false,
  242. })
  243. } else {
  244. this.ServeSuccessJSON(map[string]interface{}{
  245. "is_bind": false,
  246. "msg": "绑定失败",
  247. "result": false,
  248. })
  249. }
  250. } else {
  251. this.ServeSuccessJSON(map[string]interface{}{
  252. "is_bind": false,
  253. "msg": "绑定失败,没有对应的患者信息",
  254. "result": false,
  255. })
  256. }
  257. }
  258. func (this *XcxApiController) GetUserRegister() {
  259. //用户绑定
  260. name := this.GetString("name")
  261. id_card_no := this.GetString("id_card_no")
  262. fmt.Println("id_card_no", id_card_no)
  263. mobile := this.GetString("mobile")
  264. code := this.GetString("code")
  265. if len(code) == 0 {
  266. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeVerificationCodeWrong)
  267. return
  268. }
  269. if code == "000000" {
  270. patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
  271. fmt.Println("errcodes2323232232", errcodes)
  272. if errcodes == nil {
  273. role := models.XcxAdminUserRole{
  274. PatientName: name,
  275. IdCardNo: id_card_no,
  276. Mobile: mobile,
  277. Code: code,
  278. PatientId: patient.ID,
  279. UserOrgId: patient.UserOrgId,
  280. Status: 1,
  281. Ctime: time.Now().Unix(),
  282. Mtime: 0,
  283. Appid: "",
  284. Appsecret: "",
  285. SessionKey: "",
  286. }
  287. //查找该电话号码是否存在
  288. _, errcode := service.GetMobilePatientOne(mobile)
  289. if errcode == gorm.ErrRecordNotFound {
  290. err := service.CreateXcxAdminUser(role)
  291. if err == nil {
  292. mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
  293. template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  294. //处方
  295. prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  296. //接诊评估
  297. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  298. //透前评估
  299. dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  300. //透析上机
  301. dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  302. //透析监测
  303. monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  304. //透后评估
  305. dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  306. treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  307. var configList interface{}
  308. configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  309. this.ServeSuccessJSON(map[string]interface{}{
  310. "role": role,
  311. "is_bind": true,
  312. "patient": mobilePatient,
  313. "template_id": template_id,
  314. "user_org_id": mobilePatient.UserOrgId,
  315. "prescripition_config": prescripition_config,
  316. "receive_treatement_config": receive_treatement_config,
  317. "dialysis_befor": dialysis_befor,
  318. "dialysis_order": dialysis_order,
  319. "monitor_record": monitor_record,
  320. "dialysis_after": dialysis_after,
  321. "treate_ment": treate_ment,
  322. "configList": configList,
  323. "result": false,
  324. })
  325. } else {
  326. this.ServeSuccessJSON(map[string]interface{}{
  327. "is_bind": false,
  328. "msg": "绑定失败",
  329. "result": false,
  330. })
  331. }
  332. } else if errcode == nil {
  333. mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
  334. template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  335. //处方
  336. prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  337. //接诊评估
  338. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  339. //透前评估
  340. dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  341. //透析上机
  342. dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  343. //透析监测
  344. monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  345. //透后评估
  346. dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  347. treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  348. var configList interface{}
  349. configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  350. this.ServeSuccessJSON(map[string]interface{}{
  351. "is_bind": true,
  352. "patient": mobilePatient,
  353. "template_id": template_id,
  354. "user_org_id": mobilePatient.UserOrgId,
  355. "prescripition_config": prescripition_config,
  356. "receive_treatement_config": receive_treatement_config,
  357. "dialysis_befor": dialysis_befor,
  358. "dialysis_order": dialysis_order,
  359. "monitor_record": monitor_record,
  360. "dialysis_after": dialysis_after,
  361. "treate_ment": treate_ment,
  362. "list": configList,
  363. "result": false,
  364. })
  365. }
  366. fmt.Println("roler", role)
  367. } else if errcodes == gorm.ErrRecordNotFound {
  368. this.ServeSuccessJSON(map[string]interface{}{
  369. "is_bind": false,
  370. "result": false,
  371. })
  372. }
  373. this.ServeJSON()
  374. } else {
  375. redisClient := service.RedisClient()
  376. defer redisClient.Close()
  377. cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
  378. fmt.Println("cache_code9999999293323232322323", cache_code)
  379. if cache_code != code {
  380. this.ServeSuccessJSON(map[string]interface{}{
  381. "result": false,
  382. })
  383. return
  384. } else {
  385. this.Ctx.SetCookie("mobile", mobile)
  386. // 注册成功后验证码就要使其失效
  387. redisClient.Del("code_msg_" + mobile)
  388. patient, errcodes := service.GetMobilePatient(mobile, id_card_no)
  389. fmt.Println("errcodes2323232232", errcodes)
  390. if errcodes == nil {
  391. role := models.XcxAdminUserRole{
  392. PatientName: name,
  393. IdCardNo: id_card_no,
  394. Mobile: mobile,
  395. Code: code,
  396. PatientId: patient.ID,
  397. UserOrgId: patient.UserOrgId,
  398. Status: 1,
  399. Ctime: time.Now().Unix(),
  400. Mtime: 0,
  401. Appid: "",
  402. Appsecret: "",
  403. SessionKey: "",
  404. }
  405. //查找该电话号码是否存在
  406. _, errcode := service.GetMobilePatientOne(mobile)
  407. if errcode == gorm.ErrRecordNotFound {
  408. err := service.CreateXcxAdminUser(role)
  409. if err == nil {
  410. mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
  411. template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  412. //处方
  413. prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  414. //接诊评估
  415. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  416. //透前评估
  417. dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  418. //透析上机
  419. dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  420. //透析监测
  421. monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  422. //透后评估
  423. dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  424. treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  425. var configList interface{}
  426. configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  427. this.ServeSuccessJSON(map[string]interface{}{
  428. "role": role,
  429. "is_bind": true,
  430. "patient": mobilePatient,
  431. "template_id": template_id,
  432. "user_org_id": mobilePatient.UserOrgId,
  433. "prescripition_config": prescripition_config,
  434. "receive_treatement_config": receive_treatement_config,
  435. "dialysis_befor": dialysis_befor,
  436. "dialysis_order": dialysis_order,
  437. "monitor_record": monitor_record,
  438. "dialysis_after": dialysis_after,
  439. "treate_ment": treate_ment,
  440. "configList": configList,
  441. "result": false,
  442. })
  443. } else {
  444. this.ServeSuccessJSON(map[string]interface{}{
  445. "is_bind": false,
  446. "msg": "绑定失败",
  447. "result": false,
  448. })
  449. }
  450. } else if errcode == nil {
  451. mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
  452. template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
  453. //处方
  454. prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
  455. //接诊评估
  456. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
  457. //透前评估
  458. dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
  459. //透析上机
  460. dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
  461. //透析监测
  462. monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
  463. //透后评估
  464. dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
  465. treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
  466. var configList interface{}
  467. configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
  468. this.ServeSuccessJSON(map[string]interface{}{
  469. "is_bind": true,
  470. "patient": mobilePatient,
  471. "template_id": template_id,
  472. "user_org_id": mobilePatient.UserOrgId,
  473. "prescripition_config": prescripition_config,
  474. "receive_treatement_config": receive_treatement_config,
  475. "dialysis_befor": dialysis_befor,
  476. "dialysis_order": dialysis_order,
  477. "monitor_record": monitor_record,
  478. "dialysis_after": dialysis_after,
  479. "treate_ment": treate_ment,
  480. "list": configList,
  481. "result": false,
  482. })
  483. }
  484. fmt.Println("roler", role)
  485. } else if errcodes == gorm.ErrRecordNotFound {
  486. this.ServeSuccessJSON(map[string]interface{}{
  487. "is_bind": false,
  488. "result": false,
  489. })
  490. }
  491. this.ServeJSON()
  492. }
  493. }
  494. }
  495. func (this *XcxApiController) GetCodeInfo() {
  496. mobile := this.GetString("phone")
  497. aespass := this.GetString("aespass")
  498. utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
  499. if utils.CellPhoneRegexp().MatchString(mobile) == false {
  500. this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
  501. this.ServeJSON()
  502. return
  503. }
  504. if err := service.SendVerificationCodeSMS(mobile, aespass); err != nil {
  505. this.Data["json"] = enums.MakeFailResponseJSON(err.Error(), 600)
  506. this.ServeJSON()
  507. } else {
  508. this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
  509. "msg": "短信发送成功,有效期为10分钟",
  510. })
  511. this.ServeJSON()
  512. }
  513. this.ServeSuccessJSON(map[string]interface{}{
  514. "code": "100100",
  515. })
  516. }
  517. func (this *XcxApiController) GetLoginInfoByOpenid() {
  518. openid := this.GetString("openid")
  519. user_admin, errcodes := service.GetXcxOpneidInformation(openid)
  520. if errcodes == gorm.ErrRecordNotFound {
  521. this.ServeSuccessJSON(map[string]interface{}{
  522. "patient": "",
  523. "patient_id": 0,
  524. "user_org_id": 0,
  525. "role": user_admin,
  526. "is_bind": false,
  527. })
  528. } else if errcodes == nil {
  529. info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
  530. this.ServeSuccessJSON(map[string]interface{}{
  531. "patient": info,
  532. "role": user_admin,
  533. "is_bind": true,
  534. "user_org_id": info.UserOrgId,
  535. "patient_id": user_admin.PatientId,
  536. })
  537. }
  538. }
  539. func (this *XcxApiController) GetLoginInfor() {
  540. mobile := this.GetString("mobile")
  541. user_admin, errcodes := service.GetXcxMobileInformation(mobile)
  542. if errcodes == gorm.ErrRecordNotFound {
  543. this.ServeSuccessJSON(map[string]interface{}{
  544. "patient": "",
  545. "patient_id": 0,
  546. "user_org_id": 0,
  547. "role": user_admin,
  548. "is_bind": false,
  549. })
  550. } else if errcodes == nil {
  551. info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
  552. this.ServeSuccessJSON(map[string]interface{}{
  553. "patient": info,
  554. "role": user_admin,
  555. "is_bind": true,
  556. "user_org_id": info.UserOrgId,
  557. "patient_id": user_admin.PatientId,
  558. })
  559. }
  560. }
  561. func (this *XcxApiController) GetPatientList() {
  562. //appid := "wx20b60369111b063a"
  563. appid := "wxcdf53b48b7df107e"
  564. key := "Yz1HgsFX3yJvWPJSEdwJDA=="
  565. strs := "uSevGQ5ShkiHjQuqz7s36SKZisVGA4fHH/dy+etg0W7ibVeidl6TyFS+kQZ6B9AI2T+1kOtKXeyveQR7q2TXJdu3fhKCFoLKVFzICNEvkiHMnchJ0T0OpRO3oT+icYq80+egvT+jMSgP7yi0cAgmiKaK/4QURD7+nvxRAj9drzz77sbeFt8KElb1LN/+Wn8dIoQzisxbON9G1VJYYtyBkQ=="
  566. iv := "JgsbDhJ613uaAgAoBVh0Zw=="
  567. //data, err := service.Dncrypt(strs, key, iv)
  568. //fmt.Println(err)
  569. data, err := service.DecryptData(appid, key, iv, strs)
  570. patient_id, _ := this.GetInt64("patient_id")
  571. patient, err := service.GetPatientListByPatientId(patient_id)
  572. if err == nil {
  573. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  574. return
  575. }
  576. this.ServeSuccessJSON(map[string]interface{}{
  577. "patient": patient,
  578. "data": data,
  579. })
  580. }
  581. func (this *XcxApiController) GetDataInfo() {
  582. appid := this.GetString("appid")
  583. fmt.Println(appid)
  584. key := this.GetString("key")
  585. iv := this.GetString("iv")
  586. encryptedData := this.GetString("encryptedData")
  587. list, _ := service.DecryptData(appid, key, iv, encryptedData)
  588. //list, _ := service.Dncrypt(encryptedData, key, iv)
  589. this.ServeSuccessJSON(map[string]interface{}{
  590. "list": list,
  591. })
  592. }
  593. func (this *XcxApiController) GetSignsByBlood() {
  594. start := this.GetString("start", "")
  595. end := this.GetString("end", "")
  596. patient_id, _ := this.GetInt64("patient_id", 0)
  597. org_id, _ := this.GetInt64("org_id", 0)
  598. if len(start) <= 0 || len(end) <= 0 || patient_id <= 0 || org_id <= 0 {
  599. this.ServeSuccessJSON(map[string]interface{}{
  600. "err_code": 1001,
  601. "err_msg": "缺少参数",
  602. "data": "",
  603. })
  604. }
  605. loc, _ := time.LoadLocation("Local")
  606. startTime, _ := time.ParseInLocation("2006-01-02", start, loc)
  607. startTimeUnix := startTime.Unix()
  608. endTime, _ := time.ParseInLocation("2006-01-02", end, loc)
  609. endTimeUinx := endTime.Unix()
  610. utils.TraceLog("startTime:%v endTime:%v", startTime, endTime)
  611. utils.TraceLog("startTimeUnix:%v endTimeUinx:%v", startTimeUnix, endTimeUinx)
  612. if startTimeUnix < 0 || endTimeUinx < 0 {
  613. this.ServeSuccessJSON(map[string]interface{}{
  614. "err_code": 1001,
  615. "err_msg": "时间超出范围",
  616. "data": "",
  617. })
  618. }
  619. if startTimeUnix > endTimeUinx {
  620. this.ServeSuccessJSON(map[string]interface{}{
  621. "err_code": 1001,
  622. "err_msg": "开始时间大于结束时间",
  623. "data": "",
  624. })
  625. }
  626. if endTimeUinx-startTimeUnix > 60*60*24*60 {
  627. this.ServeSuccessJSON(map[string]interface{}{
  628. "err_code": 1001,
  629. "err_msg": "时间范围超过60天",
  630. "data": "",
  631. })
  632. }
  633. beforeblood, _ := service.GetSignsByBlood(org_id, startTimeUnix, endTimeUinx, patient_id)
  634. afterblood, _ := service.GetSignsByAfterBlood(org_id, startTimeUnix, endTimeUinx, patient_id)
  635. this.ServeSuccessJSON(map[string]interface{}{
  636. "err_code": 0,
  637. "err_msg": "",
  638. "before_blood": beforeblood,
  639. "after_blood": afterblood,
  640. })
  641. //now := time.Now()
  642. //offset := int(time.Monday - now.Weekday())
  643. //if offset > 0 {
  644. // offset = -6
  645. //}
  646. //monday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
  647. //endday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset+6)
  648. //startTime := monday.Unix()
  649. //endTime := endday.Unix()
  650. //
  651. //this.ServeSuccessJSON(map[string]interface{}{
  652. // "monday": startTime,
  653. // "endday": endTime,
  654. //})
  655. }
  656. func (this *XcxApiController) GetSignsByWeight() {
  657. start := this.GetString("start", "")
  658. end := this.GetString("end", "")
  659. patient_id, _ := this.GetInt64("patient_id", 0)
  660. org_id, _ := this.GetInt64("org_id", 0)
  661. if len(start) <= 0 || len(end) <= 0 || patient_id <= 0 || org_id <= 0 {
  662. this.ServeSuccessJSON(map[string]interface{}{
  663. "err_code": 1001,
  664. "err_msg": "缺少参数",
  665. "data": "",
  666. })
  667. }
  668. loc, _ := time.LoadLocation("Local")
  669. startTime, _ := time.ParseInLocation("2006-01-02", start, loc)
  670. startTimeUnix := startTime.Unix()
  671. endTime, _ := time.ParseInLocation("2006-01-02", end, loc)
  672. endTimeUinx := endTime.Unix()
  673. utils.TraceLog("startTime:%v endTime:%v", startTime, endTime)
  674. utils.TraceLog("startTimeUnix:%v endTimeUinx:%v", startTimeUnix, endTimeUinx)
  675. if startTimeUnix < 0 || endTimeUinx < 0 {
  676. this.ServeSuccessJSON(map[string]interface{}{
  677. "err_code": 1001,
  678. "err_msg": "时间超出范围",
  679. "data": "",
  680. })
  681. }
  682. if startTimeUnix > endTimeUinx {
  683. this.ServeSuccessJSON(map[string]interface{}{
  684. "err_code": 1001,
  685. "err_msg": "开始时间大于结束时间",
  686. "data": "",
  687. })
  688. }
  689. if endTimeUinx-startTimeUnix > 60*60*24*60 {
  690. this.ServeSuccessJSON(map[string]interface{}{
  691. "err_code": 1001,
  692. "err_msg": "时间范围超过60天",
  693. "data": "",
  694. })
  695. }
  696. beforeweight, _ := service.GetSignsByWeight(org_id, startTimeUnix, endTimeUinx, patient_id)
  697. dryweight, _ := service.GetSignsByDryWeight(org_id, startTimeUnix, endTimeUinx, patient_id)
  698. afterweight, _ := service.GetSignsByAfterWeight(org_id, startTimeUnix, endTimeUinx, patient_id)
  699. this.ServeSuccessJSON(map[string]interface{}{
  700. "err_code": 0,
  701. "err_msg": "",
  702. "before_eweight": beforeweight,
  703. "dry_eweight": dryweight,
  704. "after_eweight": afterweight,
  705. })
  706. //now := time.Now()
  707. //offset := int(time.Monday - now.Weekday())
  708. //if offset > 0 {
  709. // offset = -6
  710. //}
  711. //monday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
  712. //endday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset+6)
  713. //startTime := monday.Unix()
  714. //endTime := endday.Unix()
  715. //
  716. //this.ServeSuccessJSON(map[string]interface{}{
  717. // "monday": startTime,
  718. // "endday": endTime,
  719. //})
  720. }
  721. func (this *XcxApiController) GetSchedulesByWeek() {
  722. start := this.GetString("start", "")
  723. end := this.GetString("end", "")
  724. patient_id, _ := this.GetInt64("patient_id", 0)
  725. org_id, _ := this.GetInt64("org_id", 0)
  726. if len(start) <= 0 || len(end) <= 0 || patient_id <= 0 || org_id <= 0 {
  727. this.ServeSuccessJSON(map[string]interface{}{
  728. "err_code": 1001,
  729. "err_msg": "缺少参数",
  730. "data": "",
  731. })
  732. }
  733. loc, _ := time.LoadLocation("Local")
  734. startTime, _ := time.ParseInLocation("2006-01-02", start, loc)
  735. startTimeUnix := startTime.Unix()
  736. endTime, _ := time.ParseInLocation("2006-01-02", end, loc)
  737. endTimeUinx := endTime.Unix()
  738. utils.TraceLog("startTime:%v endTime:%v", startTime, endTime)
  739. utils.TraceLog("startTimeUnix:%v endTimeUinx:%v", startTimeUnix, endTimeUinx)
  740. if startTimeUnix < 0 || endTimeUinx < 0 {
  741. this.ServeSuccessJSON(map[string]interface{}{
  742. "err_code": 1001,
  743. "err_msg": "时间超出范围",
  744. "data": "",
  745. })
  746. }
  747. if startTimeUnix > endTimeUinx {
  748. this.ServeSuccessJSON(map[string]interface{}{
  749. "err_code": 1001,
  750. "err_msg": "开始时间大于结束时间",
  751. "data": "",
  752. })
  753. }
  754. if endTimeUinx-startTimeUnix > 60*60*24*60 {
  755. this.ServeSuccessJSON(map[string]interface{}{
  756. "err_code": 1001,
  757. "err_msg": "时间范围超过60天",
  758. "data": "",
  759. })
  760. }
  761. schedule, _ := service.GetScheduleByXcx(org_id, startTimeUnix, endTimeUinx, patient_id)
  762. this.ServeSuccessJSON(map[string]interface{}{
  763. "err_code": 0,
  764. "err_msg": "",
  765. "data": schedule,
  766. })
  767. //now := time.Now()
  768. //offset := int(time.Monday - now.Weekday())
  769. //if offset > 0 {
  770. // offset = -6
  771. //}
  772. //monday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
  773. //endday := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset+6)
  774. //startTime := monday.Unix()
  775. //endTime := endday.Unix()
  776. //
  777. //this.ServeSuccessJSON(map[string]interface{}{
  778. // "monday": startTime,
  779. // "endday": endTime,
  780. //})
  781. }
  782. func (this *XcxApiController) GetScheduleInfo() {
  783. patient_id, _ := this.GetInt64("patient_id")
  784. fmt.Println(patient_id)
  785. thisWeekMonday := service.GetFirstDateOfWeek()
  786. weekDayWeek := service.GetWeekDayOfWeek()
  787. TimeMonday, _ := time.Parse("2006-01-02", thisWeekMonday)
  788. weekDays, _ := time.Parse("2006-01-02", weekDayWeek)
  789. lastWeekMonday := TimeMonday.AddDate(0, 0, -7)
  790. nextWeekMonday := weekDays.AddDate(0, 0, +13)
  791. var weekMonday = lastWeekMonday.Format("2006-01-02")
  792. var weekDay = nextWeekMonday.Format("2006-01-02")
  793. fmt.Println("weekmodonday", weekMonday)
  794. fmt.Println("nextweeekday", weekDay)
  795. timeLayout := "2006-01-02"
  796. loc, _ := time.LoadLocation("Local")
  797. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", weekMonday+" 00:00:00", loc)
  798. fmt.Println("startiem", startTime)
  799. endTime, _ := time.ParseInLocation(timeLayout+"15:04:05", weekDay+"00:00:00", loc)
  800. fmt.Println(startTime.Unix(), endTime.Unix())
  801. schedule, err := service.GetScheduleInfo(startTime.Unix(), endTime.Unix(), patient_id)
  802. //获取当前今日的排班日期
  803. time_now := time.Now().Format("2006-01-02")
  804. fmt.Println("time_now", time_now)
  805. timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
  806. fmt.Println("timeNowUnix", timeNowUnix.Unix())
  807. //获取今日下机日期
  808. order, _ := service.GetTodayDialysis(timeNowUnix.Unix(), patient_id)
  809. //获取今日的处方
  810. prescription, _ := service.GetTodayPrescription(timeNowUnix.Unix(), patient_id)
  811. //获取下一次排班信息
  812. patientSchedule, _ := service.GetNextPatientSchedule(patient_id, timeNowUnix.Unix())
  813. if err != nil {
  814. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  815. return
  816. }
  817. var one = startTime.Unix()
  818. fmt.Println("one2322332", one)
  819. var two = one + 86400
  820. var three = two + 86400
  821. var four = three + 86400
  822. var five = four + 86400
  823. var six = five + 86400
  824. var seven = six + 86400
  825. var nextOne = seven + 86400
  826. var nexttwo = nextOne + 86400
  827. var nextthree = nexttwo + 86400
  828. var nextfour = nextthree + 86400
  829. var nextfive = nextfour + 86400
  830. var nextsix = nextfive + 86400
  831. var nextseven = nextsix + 86400
  832. var lastOne = nextseven + 86400
  833. var lastwo = lastOne + 86400
  834. var lasthree = lastwo + 86400
  835. var lastfour = lasthree + 86400
  836. var lastfive = lastfour + 86400
  837. var lastsix = lastfive + 86400
  838. var lastseven = lastsix + 86400
  839. array := []interface{}{
  840. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  841. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  842. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(one, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  843. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(two, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  844. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(two, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  845. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(two, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  846. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(three, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  847. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(three, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  848. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(three, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  849. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(four, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  850. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(four, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  851. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(four, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  852. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(five, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  853. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(five, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  854. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(five, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  855. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(six, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  856. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(six, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  857. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(six, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  858. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(seven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  859. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(seven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  860. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(seven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  861. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  862. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  863. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  864. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nexttwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  865. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nexttwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  866. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nexttwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  867. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  868. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  869. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  870. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  871. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  872. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  873. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  874. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  875. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  876. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  877. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  878. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  879. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(nextseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  880. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(nextseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  881. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(nextseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  882. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  883. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  884. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastOne, 10), "schedule_week": "1", "mode_id": "", "name": ""},
  885. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  886. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  887. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastwo, 10), "schedule_week": "2", "mode_id": "", "name": ""},
  888. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lasthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  889. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lasthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  890. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lasthree, 10), "schedule_week": "3", "mode_id": "", "name": ""},
  891. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  892. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  893. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastfour, 10), "schedule_week": "4", "mode_id": "", "name": ""},
  894. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  895. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  896. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastfive, 10), "schedule_week": "5", "mode_id": "", "name": ""},
  897. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  898. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  899. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastsix, 10), "schedule_week": "6", "mode_id": "", "name": ""},
  900. map[string]string{"schedule_type": "1", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  901. map[string]string{"schedule_type": "2", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  902. map[string]string{"schedule_type": "3", "schedule_date": strconv.FormatInt(lastseven, 10), "schedule_week": "7", "mode_id": "", "name": ""},
  903. }
  904. this.ServeSuccessJSON(map[string]interface{}{
  905. "list": schedule,
  906. "array": array,
  907. "order": order,
  908. "patientSchedule": patientSchedule,
  909. "prescription": prescription,
  910. })
  911. }
  912. func (this *XcxApiController) GetMobileSchedule() {
  913. patientID, _ := this.GetInt64("patient_id")
  914. info, _ := service.GetXcxPatientInfo(patientID)
  915. timeLayout := "2006-01-02"
  916. loc, _ := time.LoadLocation("Local")
  917. time_now := time.Now().Format("2006-01-02")
  918. timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
  919. //获取该患者最后一次排班
  920. list, _ := service.GetLastScheduleListOne(patientID, timeNowUnix.Unix())
  921. patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
  922. if getPatientErr != nil {
  923. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  924. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  925. return
  926. } else if patient == nil {
  927. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  928. return
  929. }
  930. schedual, getSchedualErr := service.MobileGetSchedualDetailOne(info.UserOrgId, patientID)
  931. if getSchedualErr != nil {
  932. this.ErrorLog("获取患者排班信息失败:%v", getSchedualErr)
  933. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  934. return
  935. }
  936. receiverTreatmentAccess, getRTARErr := service.MobileGetReceiverTreatmentAccessRecordOne(info.UserOrgId, patientID, list.ScheduleDate)
  937. if getRTARErr != nil {
  938. this.ErrorLog("获取接诊评估失败:%v", getRTARErr)
  939. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  940. return
  941. }
  942. predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(info.UserOrgId, patientID, list.ScheduleDate)
  943. if getPEErr != nil {
  944. this.ErrorLog("获取透前评估失败:%v", getPEErr)
  945. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  946. return
  947. }
  948. lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluationOne(info.UserOrgId, patientID)
  949. if getLPEErr != nil {
  950. this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
  951. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  952. return
  953. }
  954. doctorAdvices, getDoctorAdvicesErr := service.MobileGetDoctorAdvicesByGroupsOne(info.UserOrgId, patientID, list.ScheduleDate)
  955. if getDoctorAdvicesErr != nil {
  956. this.ErrorLog("获取临时医嘱失败:%v", getDoctorAdvicesErr)
  957. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  958. return
  959. }
  960. dialysisOrder, getDialysisOrderErr := service.MobileGetSchedualDialysisRecordOne(info.UserOrgId, patientID, list.ScheduleDate)
  961. if getDialysisOrderErr != nil {
  962. this.ErrorLog("获取透析记录失败:%v", getDialysisOrderErr)
  963. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  964. return
  965. }
  966. doubleCheck, getDoubleCheckErr := service.MobileGetDoubleCheckOne(info.UserOrgId, patientID, list.ScheduleDate)
  967. if getDoubleCheckErr != nil {
  968. this.ErrorLog("获取双人核对记录失败:%v", getDoubleCheckErr)
  969. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  970. return
  971. }
  972. monitorRecords, getMonitorRecordsErr := service.MobileGetMonitorRecordsOne(info.UserOrgId, patientID, list.ScheduleDate)
  973. if getMonitorRecordsErr != nil {
  974. this.ErrorLog("获取透析监测记录失败:%v", getMonitorRecordsErr)
  975. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  976. return
  977. }
  978. var lastMonitorRecord *models.MonitoringRecord
  979. lastMonitorRecord, getLastErr := service.MobileGetLastMonitorRecordOne(info.UserOrgId, patientID)
  980. if getLastErr != nil {
  981. this.ErrorLog("获取上一次透析的监测记录失败:%v", getLastErr)
  982. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  983. return
  984. }
  985. assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, list.ScheduleDate)
  986. if getAADErr != nil {
  987. this.ErrorLog("获取透后评估失败:%v", getAADErr)
  988. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  989. return
  990. }
  991. lastAssessmentAfterDislysis, getLAADErr := service.MobileGetAssessmentAfterDislysisOne(info.UserOrgId, patientID, list.ScheduleDate)
  992. if getLAADErr != nil {
  993. this.ErrorLog("获取上一次透后评估失败:%v", getLAADErr)
  994. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  995. return
  996. }
  997. treatmentSummary, getTreatmentSummaryErr := service.MobileGetTreatmentSummaryOne(info.UserOrgId, patientID, list.ScheduleDate)
  998. if getTreatmentSummaryErr != nil {
  999. this.ErrorLog("获取治疗小结失败:%v", getTreatmentSummaryErr)
  1000. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1001. return
  1002. }
  1003. dialysisSolution, _ := service.MobileGetDialysisSolutionByModeId(info.UserOrgId, patientID, schedual.ModeId)
  1004. lastDialysisPrescribe, _ := service.MobileGetLastDialysisPrescribeByModeId(info.UserOrgId, patientID, schedual.ModeId)
  1005. //获取系统透析处方模版
  1006. systemDialysisPrescribe, _ := service.MobileGetSystemDialysisPrescribeByModeId(info.UserOrgId, schedual.ModeId)
  1007. _, is_open_config := service.FindXTHisRecordByOrgId(info.UserOrgId)
  1008. _, is_project_open_config := service.FindXTHisProjectByOrgId(info.UserOrgId)
  1009. projects, _ := service.GetHisPrescriptionProjectsOne(info.UserOrgId, patientID)
  1010. stockType, _ := service.GetStockType(info.UserOrgId)
  1011. prepare, _ := service.GetDialyStockOutOne(info.UserOrgId, patientID)
  1012. //获取最后一次血管通路
  1013. lastAssessment, _ := service.GetLastPassWayAssessment(info.UserOrgId, patientID)
  1014. prescribeOne, _ := service.MobileGetDialysisPrescribeByModeIdFive(info.UserOrgId, patientID, list.ScheduleDate)
  1015. var his_advices []*models.HisDoctorAdviceInfo
  1016. if is_open_config.IsOpen == 1 {
  1017. his_advices, _ = service.GetAllHisDoctorAdviceOne(info.UserOrgId, patientID, list.ScheduleDate)
  1018. }
  1019. if getLPEErr != nil {
  1020. this.ErrorLog("获取上一次透前评估失败:%v", getLPEErr)
  1021. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1022. return
  1023. }
  1024. lastDryWeightDislysis, getDryErr := service.MobileGetLastDryWeight(info.UserOrgId, patientID)
  1025. if getDryErr != nil {
  1026. this.ErrorLog("获取最后一条干体重失败:%v", getDryErr)
  1027. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1028. return
  1029. }
  1030. _, gobalConfig := service.FindAutomaticReduceRecordByOrgId(info.UserOrgId)
  1031. operators, _ := service.GetAllStarfEs(info.UserOrgId)
  1032. returnData := map[string]interface{}{
  1033. "patient": patient,
  1034. "schedual": schedual,
  1035. "prescription": prescribeOne,
  1036. "solution": dialysisSolution,
  1037. "last_prescription": lastDialysisPrescribe,
  1038. "receiver_treatment_access": receiverTreatmentAccess,
  1039. "predialysis_evaluation": predialysisEvaluation,
  1040. "doctor_advices": doctorAdvices,
  1041. "double_check": doubleCheck,
  1042. "assessment_after_dislysis": assessmentAfterDislysis,
  1043. "treatment_summary": treatmentSummary,
  1044. "monitor_records": monitorRecords,
  1045. "dialysis_order": dialysisOrder,
  1046. "operators": operators,
  1047. "last_predialysis_evaluation": lastPredialysisEvaluation,
  1048. "last_assessment_after_dislysis": lastAssessmentAfterDislysis,
  1049. "last_monitor_record": lastMonitorRecord,
  1050. "config": gobalConfig,
  1051. "dry_weight": lastDryWeightDislysis,
  1052. "system_prescription": systemDialysisPrescribe,
  1053. "his_advices": his_advices,
  1054. "is_open_config": is_open_config,
  1055. "stockType": stockType,
  1056. "prepare": prepare,
  1057. "lastAssessment": lastAssessment,
  1058. "is_project_open_config": is_project_open_config,
  1059. "project": projects,
  1060. "scheduleDate": list.ScheduleDate,
  1061. }
  1062. this.ServeSuccessJSON(returnData)
  1063. }
  1064. func (this *XcxApiController) GetPatientInfo() {
  1065. patient_id, _ := this.GetInt64("patient_id")
  1066. patient, _ := service.GetXcxPatientInfo(patient_id)
  1067. this.ServeSuccessJSON(map[string]interface{}{
  1068. "patient": patient,
  1069. })
  1070. }
  1071. func (this *XcxApiController) GetOrgInfo() {
  1072. patient_id, _ := this.GetInt64("patient_id")
  1073. info, _ := service.GetXcxPatientInfo(patient_id)
  1074. orgInfo, _ := service.GetOrgInfo(info.UserOrgId)
  1075. this.ServeSuccessJSON(map[string]interface{}{
  1076. "orgInfo": orgInfo,
  1077. })
  1078. }
  1079. func (this *XcxApiController) GetEducationList() {
  1080. start_time := this.GetString("start_time")
  1081. end_time := this.GetString("end_time")
  1082. patient_id, _ := this.GetInt64("patient_id")
  1083. timeLayout := "2006-01-02"
  1084. loc, _ := time.LoadLocation("Local")
  1085. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  1086. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
  1087. list, _ := service.GetEducationList(startTime.Unix(), endTime.Unix(), patient_id)
  1088. this.ServeSuccessJSON(map[string]interface{}{
  1089. "list": list,
  1090. })
  1091. }
  1092. func (this *XcxApiController) GetDoctorAdvice() {
  1093. //判断是否开启医嘱同步功能
  1094. start_time := this.GetString("start_time")
  1095. end_time := this.GetString("end_time")
  1096. patient_id, _ := this.GetInt64("patient_id")
  1097. fmt.Println("patient_id", patient_id)
  1098. timeLayout := "2006-01-02"
  1099. loc, _ := time.LoadLocation("Local")
  1100. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  1101. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
  1102. info, _ := service.GetXcxPatientInfo(patient_id)
  1103. _, config := service.FindXTHisRecordByOrgId(info.UserOrgId)
  1104. fmt.Println(startTime, endTime, config.IsOpen)
  1105. if config.IsOpen == 0 {
  1106. list, _ := service.GetDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
  1107. advice, _ := service.GetDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
  1108. for _, item := range list {
  1109. for _, it := range advice {
  1110. if item.AdviceDate == it.AdviceDate {
  1111. item.Childs = append(item.Childs, it)
  1112. }
  1113. }
  1114. }
  1115. this.ServeSuccessJSON(map[string]interface{}{
  1116. "list": list,
  1117. })
  1118. }
  1119. if config.IsOpen == 1 {
  1120. list, _ := service.GetHisDoctorAdviceGroup(patient_id, startTime.Unix(), endTime.Unix())
  1121. advice, _ := service.GetHisDoctorAdvice(patient_id, startTime.Unix(), endTime.Unix())
  1122. for _, item := range list {
  1123. for _, it := range advice {
  1124. if item.AdviceDate == it.AdviceDate {
  1125. item.Childs = append(item.Childs, it)
  1126. }
  1127. }
  1128. }
  1129. this.ServeSuccessJSON(map[string]interface{}{
  1130. "list": list,
  1131. })
  1132. }
  1133. }
  1134. func (this *XcxApiController) GetDoctorName() {
  1135. patient_id, _ := this.GetInt64("patient_id")
  1136. fmt.Println("patient_id", patient_id)
  1137. info, _ := service.GetXcxPatientInfo(patient_id)
  1138. user_name, _ := service.GetDoctorName(info.UserOrgId)
  1139. this.ServeSuccessJSON(map[string]interface{}{
  1140. "user_name": user_name,
  1141. })
  1142. }
  1143. func (this *XcxApiController) GetFieldConfig() {
  1144. patient_id, _ := this.GetInt64("patient_id")
  1145. fmt.Println("patient_id", patient_id)
  1146. info, _ := service.GetXcxPatientInfo(patient_id)
  1147. //处方
  1148. prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
  1149. //接诊评估
  1150. receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
  1151. //透前评估
  1152. dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
  1153. //透析上机
  1154. dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
  1155. //透析监测
  1156. monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
  1157. //透后评估
  1158. dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
  1159. treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
  1160. this.ServeSuccessJSON(map[string]interface{}{
  1161. "prescripition_config": prescripition_config,
  1162. "receive_treatement_config": receive_treatement_config,
  1163. "dialysis_befor": dialysis_befor,
  1164. "dialysis_order": dialysis_order,
  1165. "monitor_record": monitor_record,
  1166. "dialysis_after": dialysis_after,
  1167. "treate_ment": treate_ment,
  1168. })
  1169. }
  1170. func (this *XcxApiController) GetDataConfig() {
  1171. var configList interface{}
  1172. patient_id, _ := this.GetInt64("patient_id")
  1173. fmt.Println("patient_id", patient_id)
  1174. info, _ := service.GetXcxPatientInfo(patient_id)
  1175. //list, _ := service.GetDataConfig(info.UserOrgId)
  1176. configList, _ = service.GetConfigList(info.UserOrgId)
  1177. this.ServeSuccessJSON(map[string]interface{}{
  1178. "list": configList,
  1179. })
  1180. }
  1181. func (this *XcxApiController) GetInspectionList() {
  1182. page, _ := this.GetInt64("page", 0)
  1183. number, _ := this.GetInt64("number", 10)
  1184. patient_id, _ := this.GetInt64("patient_id", 0)
  1185. //fmt.Println("patient_id", patient_id)
  1186. //timeLayout := "2006-01-02"
  1187. //loc, _ := time.LoadLocation("Local")
  1188. //startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  1189. //endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  1190. list, err := service.GetInspectionGroupListByXcx(patient_id, page, number)
  1191. if err == gorm.ErrRecordNotFound {
  1192. this.ServeSuccessJSON(map[string]interface{}{
  1193. "error_code": "1001",
  1194. "error_msg": "没有更多数据",
  1195. })
  1196. }
  1197. this.ServeSuccessJSON(map[string]interface{}{
  1198. "error_code": "0",
  1199. "error_msg": "",
  1200. "list": list,
  1201. })
  1202. }
  1203. func (this *XcxApiController) GetInspectionInfo() {
  1204. project_id, _ := this.GetInt64("project_id", 0)
  1205. inspect_date, _ := this.GetInt64("inspect_date", 0)
  1206. patient_id, _ := this.GetInt64("patient_id", 0)
  1207. if project_id <= 0 || inspect_date <= 0 || patient_id <= 0 {
  1208. this.ServeSuccessJSON(map[string]interface{}{
  1209. "error_code": 1001,
  1210. "error_msg": "缺少参数",
  1211. })
  1212. }
  1213. list, _ := service.GetInspectionInfoByXcx(patient_id, project_id, inspect_date)
  1214. this.ServeSuccessJSON(map[string]interface{}{
  1215. "list": list,
  1216. })
  1217. }
  1218. func (this *XcxApiController) GetArticList() {
  1219. page, _ := this.GetInt64("page")
  1220. limit, _ := this.GetInt64("limit")
  1221. activity_id, _ := this.GetInt64("activity_id")
  1222. list, total, _ := service.GetArticList(activity_id, page, limit)
  1223. this.ServeSuccessJSON(map[string]interface{}{
  1224. "list": list,
  1225. "total": total,
  1226. })
  1227. }
  1228. func (this *XcxApiController) GetArticListDetail() {
  1229. id, _ := this.GetInt64("id")
  1230. detail, _ := service.GetArticListDetail(id)
  1231. this.ServeSuccessJSON(map[string]interface{}{
  1232. "story": detail,
  1233. })
  1234. }
  1235. func (this *XcxApiController) GetStoryScoreList() {
  1236. page, _ := this.GetInt64("page")
  1237. limit, _ := this.GetInt64("limit")
  1238. activity_id, _ := this.GetInt64("activity_id")
  1239. list, total, _ := service.GetStoryScoreList(activity_id, page, limit)
  1240. this.ServeSuccessJSON(map[string]interface{}{
  1241. "list": list,
  1242. "total": total,
  1243. })
  1244. }
  1245. func (this *XcxApiController) GetAppId() {
  1246. var appid = "wxcdf53b48b7df107e"
  1247. var secret = "94e944a69ad1d43ac447f5a8769ab801"
  1248. var grant_type = "authorization_code"
  1249. code := this.GetString("js_code")
  1250. //var code = "041pXnGa1eLxTB0iypFa1W6USs1pXnGK"
  1251. openId, _ := service.SendWxAuthAPI(appid, secret, grant_type, code)
  1252. //session_key, _ := service.SendWxAuthAPIOne(appid, secret, grant_type, code)
  1253. this.ServeSuccessJSON(map[string]interface{}{
  1254. "data": openId,
  1255. //"session_key": session_key,
  1256. })
  1257. }