pc_index_evaluation_api_controller.go 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. package controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/service/statistics_service"
  5. "XT_New/utils"
  6. "time"
  7. )
  8. type PCIndexEvaluationApiController struct {
  9. BaseAuthAPIController
  10. }
  11. func (this *PCIndexEvaluationApiController) GetAdminUser() {
  12. admins, _ := statistics_service.GetAllAdminUser(this.GetAdminUserInfo().CurrentOrgId)
  13. this.ServeSuccessJSON(map[string]interface{}{
  14. "admin": admins,
  15. })
  16. }
  17. func (this *PCIndexEvaluationApiController) GetDialysisProcessIndexChartData() {
  18. adminUserInfo := this.GetAdminUserInfo()
  19. statistics_type, _ := this.GetInt("statistics_type")
  20. start_time := this.GetString("start_time")
  21. end_time := this.GetString("end_time")
  22. patient_id, _ := this.GetInt64("patient_id")
  23. timeLayout := "2006-01-02"
  24. loc, _ := time.LoadLocation("Local")
  25. var theStartTIme int64
  26. if len(start_time) > 0 {
  27. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  28. if err != nil {
  29. utils.ErrorLog(err.Error())
  30. }
  31. theStartTIme = theTime.Unix()
  32. }
  33. var theEndtTIme int64
  34. if len(end_time) > 0 {
  35. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  36. if err != nil {
  37. utils.ErrorLog(err.Error())
  38. }
  39. theEndtTIme = theTime.Unix()
  40. }
  41. if patient_id == 0 {
  42. patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
  43. if patientInfo == nil {
  44. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
  45. return
  46. }
  47. if statistics_type == 9 || statistics_type == 10 {
  48. data, _ := statistics_service.GetDialysisProcessIndexOtherChartData(adminUserInfo.CurrentOrgId, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
  49. this.ServeSuccessJSON(map[string]interface{}{
  50. "data": data,
  51. })
  52. } else {
  53. data, _ := statistics_service.GetDialysisProcessIndexChartData(adminUserInfo.CurrentOrgId, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
  54. this.ServeSuccessJSON(map[string]interface{}{
  55. "data": data,
  56. })
  57. }
  58. } else {
  59. if statistics_type == 9 || statistics_type == 10 {
  60. data, _ := statistics_service.GetDialysisProcessIndexOtherChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
  61. this.ServeSuccessJSON(map[string]interface{}{
  62. "data": data,
  63. })
  64. } else {
  65. data, _ := statistics_service.GetDialysisProcessIndexChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
  66. this.ServeSuccessJSON(map[string]interface{}{
  67. "data": data,
  68. })
  69. }
  70. }
  71. }
  72. func (this *PCIndexEvaluationApiController) GetDialysisProcessIndexTableData() {
  73. adminUserInfo := this.GetAdminUserInfo()
  74. start_time := this.GetString("start_time")
  75. end_time := this.GetString("end_time")
  76. patient_id, _ := this.GetInt64("patient_id")
  77. page, _ := this.GetInt64("page")
  78. limit, _ := this.GetInt64("limit")
  79. if page == 0 {
  80. page = 1
  81. }
  82. if limit == 0 {
  83. limit = 20
  84. }
  85. timeLayout := "2006-01-02"
  86. loc, _ := time.LoadLocation("Local")
  87. var theStartTIme int64
  88. if len(start_time) > 0 {
  89. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  90. if err != nil {
  91. utils.ErrorLog(err.Error())
  92. }
  93. theStartTIme = theTime.Unix()
  94. }
  95. var theEndtTIme int64
  96. if len(end_time) > 0 {
  97. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  98. if err != nil {
  99. utils.ErrorLog(err.Error())
  100. }
  101. theEndtTIme = theTime.Unix()
  102. }
  103. if patient_id == 0 {
  104. patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
  105. if patientInfo == nil {
  106. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
  107. return
  108. }
  109. data, total, _ := statistics_service.GetDialysisProcessIndexTableData(adminUserInfo.CurrentOrgId, patientInfo.ID, page, limit, theStartTIme, theEndtTIme)
  110. this.ServeSuccessJSON(map[string]interface{}{
  111. "data": data,
  112. "total": total,
  113. })
  114. } else {
  115. data, total, _ := statistics_service.GetDialysisProcessIndexTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
  116. this.ServeSuccessJSON(map[string]interface{}{
  117. "data": data,
  118. "total": total,
  119. })
  120. }
  121. }
  122. func (this *PCIndexEvaluationApiController) GetDialysisWatchChartData() {
  123. adminUserInfo := this.GetAdminUserInfo()
  124. statistics_type, _ := this.GetInt("statistics_type")
  125. start_time := this.GetString("start_time")
  126. end_time := this.GetString("end_time")
  127. patient_id, _ := this.GetInt64("patient_id")
  128. timeLayout := "2006-01-02"
  129. loc, _ := time.LoadLocation("Local")
  130. var theStartTIme int64
  131. if len(start_time) > 0 {
  132. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  133. if err != nil {
  134. utils.ErrorLog(err.Error())
  135. }
  136. theStartTIme = theTime.Unix()
  137. }
  138. var theEndtTIme int64
  139. if len(end_time) > 0 {
  140. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  141. if err != nil {
  142. utils.ErrorLog(err.Error())
  143. }
  144. theEndtTIme = theTime.Unix()
  145. }
  146. if patient_id == 0 {
  147. patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
  148. if patientInfo == nil {
  149. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
  150. return
  151. }
  152. data, _ := statistics_service.GetDialysisWatchChartData(adminUserInfo.CurrentOrgId, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
  153. this.ServeSuccessJSON(map[string]interface{}{
  154. "data": data,
  155. })
  156. } else {
  157. data, _ := statistics_service.GetDialysisWatchChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
  158. this.ServeSuccessJSON(map[string]interface{}{
  159. "data": data,
  160. })
  161. }
  162. }
  163. func (this *PCIndexEvaluationApiController) GetDialysisWatchTableData() {
  164. adminUserInfo := this.GetAdminUserInfo()
  165. start_time := this.GetString("start_time")
  166. end_time := this.GetString("end_time")
  167. patient_id, _ := this.GetInt64("patient_id")
  168. page, _ := this.GetInt64("page")
  169. limit, _ := this.GetInt64("limit")
  170. if page == 0 {
  171. page = 1
  172. }
  173. if limit == 0 {
  174. limit = 20
  175. }
  176. timeLayout := "2006-01-02"
  177. loc, _ := time.LoadLocation("Local")
  178. var theStartTIme int64
  179. if len(start_time) > 0 {
  180. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  181. if err != nil {
  182. utils.ErrorLog(err.Error())
  183. }
  184. theStartTIme = theTime.Unix()
  185. }
  186. var theEndtTIme int64
  187. if len(end_time) > 0 {
  188. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  189. if err != nil {
  190. utils.ErrorLog(err.Error())
  191. }
  192. theEndtTIme = theTime.Unix()
  193. }
  194. if patient_id == 0 {
  195. patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
  196. if patientInfo == nil {
  197. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
  198. return
  199. }
  200. data, total, _ := statistics_service.GetDialysisWatchTableData(adminUserInfo.CurrentOrgId, patientInfo.ID, page, limit, theStartTIme, theEndtTIme)
  201. this.ServeSuccessJSON(map[string]interface{}{
  202. "data": data,
  203. "total": total,
  204. })
  205. } else {
  206. data, total, _ := statistics_service.GetDialysisWatchTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
  207. this.ServeSuccessJSON(map[string]interface{}{
  208. "data": data,
  209. "total": total,
  210. })
  211. }
  212. }
  213. func (this *PCIndexEvaluationApiController) GetDialysisBloodPressureChartData() {
  214. adminUserInfo := this.GetAdminUserInfo()
  215. statistics_type, _ := this.GetInt("statistics_type")
  216. start_time := this.GetString("start_time")
  217. end_time := this.GetString("end_time")
  218. patient_id, _ := this.GetInt64("patient_id")
  219. timeLayout := "2006-01-02"
  220. loc, _ := time.LoadLocation("Local")
  221. var theStartTIme int64
  222. if len(start_time) > 0 {
  223. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  224. if err != nil {
  225. utils.ErrorLog(err.Error())
  226. }
  227. theStartTIme = theTime.Unix()
  228. }
  229. var theEndtTIme int64
  230. if len(end_time) > 0 {
  231. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  232. if err != nil {
  233. utils.ErrorLog(err.Error())
  234. }
  235. theEndtTIme = theTime.Unix()
  236. }
  237. data, _ := statistics_service.GetBloodPressureChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type, patient_id)
  238. this.ServeSuccessJSON(map[string]interface{}{
  239. "data": data,
  240. })
  241. }
  242. func (this *PCIndexEvaluationApiController) GetDialysisBloodPressureTableData() {
  243. adminUserInfo := this.GetAdminUserInfo()
  244. start_time := this.GetString("start_time")
  245. end_time := this.GetString("end_time")
  246. patient_id, _ := this.GetInt64("patient_id")
  247. page, _ := this.GetInt64("page")
  248. limit, _ := this.GetInt64("limit")
  249. if page == 0 {
  250. page = 1
  251. }
  252. if limit == 0 {
  253. limit = 20
  254. }
  255. timeLayout := "2006-01-02"
  256. loc, _ := time.LoadLocation("Local")
  257. var theStartTIme int64
  258. if len(start_time) > 0 {
  259. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  260. if err != nil {
  261. utils.ErrorLog(err.Error())
  262. }
  263. theStartTIme = theTime.Unix()
  264. }
  265. var theEndtTIme int64
  266. if len(end_time) > 0 {
  267. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  268. if err != nil {
  269. utils.ErrorLog(err.Error())
  270. }
  271. theEndtTIme = theTime.Unix()
  272. }
  273. data, total, _ := statistics_service.GetBloodPressureTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
  274. this.ServeSuccessJSON(map[string]interface{}{
  275. "data": data,
  276. "total": total,
  277. })
  278. }
  279. func (this *PCIndexEvaluationApiController) GetDialysisPatientBloodPressureChartData() {
  280. adminUserInfo := this.GetAdminUserInfo()
  281. statistics_type, _ := this.GetInt("statistics_type")
  282. start_time := this.GetString("start_time")
  283. end_time := this.GetString("end_time")
  284. patient_id, _ := this.GetInt64("patient_id")
  285. timeLayout := "2006-01-02"
  286. loc, _ := time.LoadLocation("Local")
  287. var theStartTIme int64
  288. if len(start_time) > 0 {
  289. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  290. if err != nil {
  291. utils.ErrorLog(err.Error())
  292. }
  293. theStartTIme = theTime.Unix()
  294. }
  295. var theEndtTIme int64
  296. if len(end_time) > 0 {
  297. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  298. if err != nil {
  299. utils.ErrorLog(err.Error())
  300. }
  301. theEndtTIme = theTime.Unix()
  302. }
  303. data, _ := statistics_service.GetPatientBloodPressureChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
  304. this.ServeSuccessJSON(map[string]interface{}{
  305. "data": data,
  306. })
  307. }
  308. func (this *PCIndexEvaluationApiController) GetDialysisWeightChartData() {
  309. adminUserInfo := this.GetAdminUserInfo()
  310. statistics_type, _ := this.GetInt("statistics_type")
  311. start_time := this.GetString("start_time")
  312. end_time := this.GetString("end_time")
  313. timeLayout := "2006-01-02"
  314. loc, _ := time.LoadLocation("Local")
  315. var theStartTIme int64
  316. if len(start_time) > 0 {
  317. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  318. if err != nil {
  319. utils.ErrorLog(err.Error())
  320. }
  321. theStartTIme = theTime.Unix()
  322. }
  323. var theEndtTIme int64
  324. if len(end_time) > 0 {
  325. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  326. if err != nil {
  327. utils.ErrorLog(err.Error())
  328. }
  329. theEndtTIme = theTime.Unix()
  330. }
  331. data, _ := statistics_service.GetDialysisWeightChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type)
  332. this.ServeSuccessJSON(map[string]interface{}{
  333. "data": data,
  334. })
  335. }
  336. func (this *PCIndexEvaluationApiController) GetDialysisWeightTableData() {
  337. adminUserInfo := this.GetAdminUserInfo()
  338. start_time := this.GetString("start_time")
  339. end_time := this.GetString("end_time")
  340. patient_id, _ := this.GetInt64("patient_id")
  341. page, _ := this.GetInt64("page")
  342. limit, _ := this.GetInt64("limit")
  343. if page == 0 {
  344. page = 1
  345. }
  346. if limit == 0 {
  347. limit = 20
  348. }
  349. timeLayout := "2006-01-02"
  350. loc, _ := time.LoadLocation("Local")
  351. var theStartTIme int64
  352. if len(start_time) > 0 {
  353. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  354. if err != nil {
  355. utils.ErrorLog(err.Error())
  356. }
  357. theStartTIme = theTime.Unix()
  358. }
  359. var theEndtTIme int64
  360. if len(end_time) > 0 {
  361. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  362. if err != nil {
  363. utils.ErrorLog(err.Error())
  364. }
  365. theEndtTIme = theTime.Unix()
  366. }
  367. data, total, _ := statistics_service.GetDialysisWeightTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
  368. this.ServeSuccessJSON(map[string]interface{}{
  369. "data": data,
  370. "total": total,
  371. })
  372. }
  373. func (this *PCIndexEvaluationApiController) GetDialysisPatientWeightChartData() {
  374. adminUserInfo := this.GetAdminUserInfo()
  375. statistics_type, _ := this.GetInt("statistics_type")
  376. start_time := this.GetString("start_time")
  377. end_time := this.GetString("end_time")
  378. patient_id, _ := this.GetInt64("patient_id")
  379. timeLayout := "2006-01-02"
  380. loc, _ := time.LoadLocation("Local")
  381. var theStartTIme int64
  382. if len(start_time) > 0 {
  383. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  384. if err != nil {
  385. utils.ErrorLog(err.Error())
  386. }
  387. theStartTIme = theTime.Unix()
  388. }
  389. var theEndtTIme int64
  390. if len(end_time) > 0 {
  391. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  392. if err != nil {
  393. utils.ErrorLog(err.Error())
  394. }
  395. theEndtTIme = theTime.Unix()
  396. }
  397. data, _ := statistics_service.GetPatientDialysisWeightChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
  398. this.ServeSuccessJSON(map[string]interface{}{
  399. "data": data,
  400. })
  401. }
  402. func (this *PCIndexEvaluationApiController) GetDoctorWorkloadChartData() {
  403. adminUserInfo := this.GetAdminUserInfo()
  404. statistics_type, _ := this.GetInt("statistics_type")
  405. start_time := this.GetString("start_time")
  406. end_time := this.GetString("end_time")
  407. timeLayout := "2006-01-02"
  408. loc, _ := time.LoadLocation("Local")
  409. var theStartTIme int64
  410. if len(start_time) > 0 {
  411. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  412. if err != nil {
  413. utils.ErrorLog(err.Error())
  414. }
  415. theStartTIme = theTime.Unix()
  416. }
  417. var theEndtTIme int64
  418. if len(end_time) > 0 {
  419. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  420. if err != nil {
  421. utils.ErrorLog(err.Error())
  422. }
  423. theEndtTIme = theTime.Unix()
  424. }
  425. data, _ := statistics_service.GetDoctorWorkloadChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type)
  426. this.ServeSuccessJSON(map[string]interface{}{
  427. "data": data,
  428. })
  429. }
  430. func (this *PCIndexEvaluationApiController) GetDoctorWorkloadTableData() {
  431. adminUserInfo := this.GetAdminUserInfo()
  432. start_time := this.GetString("start_time")
  433. end_time := this.GetString("end_time")
  434. admin_user_id, _ := this.GetInt64("admin_user_id")
  435. page, _ := this.GetInt64("page")
  436. limit, _ := this.GetInt64("limit")
  437. if page == 0 {
  438. page = 1
  439. }
  440. if limit == 0 {
  441. limit = 20
  442. }
  443. timeLayout := "2006-01-02"
  444. loc, _ := time.LoadLocation("Local")
  445. var theStartTIme int64
  446. if len(start_time) > 0 {
  447. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  448. if err != nil {
  449. utils.ErrorLog(err.Error())
  450. }
  451. theStartTIme = theTime.Unix()
  452. }
  453. var theEndtTIme int64
  454. if len(end_time) > 0 {
  455. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  456. if err != nil {
  457. utils.ErrorLog(err.Error())
  458. }
  459. theEndtTIme = theTime.Unix()
  460. }
  461. data, _ := statistics_service.GetDoctorWorkloadTableData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, admin_user_id)
  462. this.ServeSuccessJSON(map[string]interface{}{
  463. "data": data,
  464. })
  465. }
  466. func (this *PCIndexEvaluationApiController) GetNurseWorkloadChartData() {
  467. adminUserInfo := this.GetAdminUserInfo()
  468. statistics_type, _ := this.GetInt("statistics_type")
  469. start_time := this.GetString("start_time")
  470. end_time := this.GetString("end_time")
  471. timeLayout := "2006-01-02"
  472. loc, _ := time.LoadLocation("Local")
  473. var theStartTIme int64
  474. if len(start_time) > 0 {
  475. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  476. if err != nil {
  477. utils.ErrorLog(err.Error())
  478. }
  479. theStartTIme = theTime.Unix()
  480. }
  481. var theEndtTIme int64
  482. if len(end_time) > 0 {
  483. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  484. if err != nil {
  485. utils.ErrorLog(err.Error())
  486. }
  487. theEndtTIme = theTime.Unix()
  488. }
  489. data, _ := statistics_service.GetNurseWorkloadChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type)
  490. this.ServeSuccessJSON(map[string]interface{}{
  491. "data": data,
  492. })
  493. }
  494. func (this *PCIndexEvaluationApiController) GetNurseWorkloadTableData() {
  495. adminUserInfo := this.GetAdminUserInfo()
  496. start_time := this.GetString("start_time")
  497. end_time := this.GetString("end_time")
  498. admin_user_id, _ := this.GetInt64("admin_user_id")
  499. page, _ := this.GetInt64("page")
  500. limit, _ := this.GetInt64("limit")
  501. if page == 0 {
  502. page = 1
  503. }
  504. if limit == 0 {
  505. limit = 20
  506. }
  507. timeLayout := "2006-01-02"
  508. loc, _ := time.LoadLocation("Local")
  509. var theStartTIme int64
  510. if len(start_time) > 0 {
  511. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  512. if err != nil {
  513. utils.ErrorLog(err.Error())
  514. }
  515. theStartTIme = theTime.Unix()
  516. }
  517. var theEndtTIme int64
  518. if len(end_time) > 0 {
  519. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  520. if err != nil {
  521. utils.ErrorLog(err.Error())
  522. }
  523. theEndtTIme = theTime.Unix()
  524. }
  525. data, _ := statistics_service.GetNurseWorkloadTableData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, admin_user_id)
  526. this.ServeSuccessJSON(map[string]interface{}{
  527. "data": data,
  528. })
  529. }
  530. func (this *PCIndexEvaluationApiController) GetDefaultPatient() {
  531. adminUserInfo := this.GetAdminUserInfo()
  532. patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
  533. if patientInfo == nil {
  534. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
  535. return
  536. }
  537. this.ServeSuccessJSON(map[string]interface{}{
  538. "patient": patientInfo,
  539. })
  540. }