common_api_controller.go 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. package new_mobile_api_controllers
  2. import (
  3. "XT_New/controllers"
  4. "XT_New/enums"
  5. "XT_New/models"
  6. "XT_New/service"
  7. "XT_New/utils"
  8. "encoding/json"
  9. "fmt"
  10. "github.com/jinzhu/gorm"
  11. "strconv"
  12. "time"
  13. )
  14. type CommonApiController struct {
  15. controllers.BaseAuthAPIController
  16. }
  17. func (this *CommonApiController) GetInspectionMajor() {
  18. adminInfo := this.GetAdminUserInfo()
  19. orgid := adminInfo.CurrentOrgId
  20. major, err := service.GetInspectionMajor(orgid)
  21. if len(major) == 0 {
  22. major, _ := service.GetInspectionMajor(0)
  23. if err != nil {
  24. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  25. return
  26. }
  27. this.ServeSuccessJSON(map[string]interface{}{
  28. "inspection": major,
  29. })
  30. }
  31. if err != nil {
  32. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  33. return
  34. }
  35. this.ServeSuccessJSON(map[string]interface{}{
  36. "inspection": major,
  37. })
  38. }
  39. func (this *CommonApiController) GetInspectionMinor() {
  40. id, _ := this.GetInt64("id")
  41. minor, err := service.GetInspectionMinor(id)
  42. if err != nil {
  43. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  44. return
  45. }
  46. this.ServeSuccessJSON(map[string]interface{}{
  47. "inspection": minor,
  48. })
  49. }
  50. func (this *CommonApiController) GetInspectionRange() {
  51. id, _ := this.GetInt64("id")
  52. fmt.Println("id", id)
  53. inspectionRange, err := service.GetInspectionRange(id)
  54. if err != nil {
  55. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  56. return
  57. }
  58. this.ServeSuccessJSON(map[string]interface{}{
  59. "inspectionRange": inspectionRange,
  60. })
  61. }
  62. func (this *CommonApiController) SaveConfiguration() {
  63. adminInfo := this.GetAdminUserInfo()
  64. orgid := adminInfo.CurrentOrgId
  65. dataBody := make(map[string]interface{}, 0)
  66. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  67. fmt.Println("err", err)
  68. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  69. fmt.Println("大项", inspectionmajor)
  70. inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
  71. fmt.Println("小项", inspectionMinor)
  72. minrange := dataBody["min_range"].(string)
  73. fmt.Println("minragne", minrange)
  74. largerange := dataBody["large_range"].(string)
  75. fmt.Println("largerange", largerange)
  76. sort := dataBody["sort"].(string)
  77. sorts, err := strconv.ParseInt(sort, 10, 64)
  78. fmt.Println("sort", sort)
  79. _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
  80. if errcode == gorm.ErrRecordNotFound {
  81. standard := models.XtQualityControlStandard{
  82. InspectionMajor: inspectionmajor,
  83. InspectionMinor: inspectionMinor,
  84. MinRange: minrange,
  85. LargeRange: largerange,
  86. Sort: sorts,
  87. UserOrgId: orgid,
  88. Status: 1,
  89. CreatedTime: time.Now().Unix(),
  90. }
  91. fmt.Println(standard)
  92. err = service.SaveInspection(&standard)
  93. if err != nil {
  94. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  95. return
  96. }
  97. this.ServeSuccessJSON(map[string]interface{}{
  98. "standard": standard,
  99. })
  100. } else if errcode == nil {
  101. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  102. return
  103. }
  104. }
  105. func (this *CommonApiController) GetConfigurationlist() {
  106. limit, _ := this.GetInt64("limit")
  107. page, _ := this.GetInt64("page")
  108. adminUser := this.GetAdminUserInfo()
  109. orgid := adminUser.CurrentOrgId
  110. configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
  111. if err != nil {
  112. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  113. return
  114. }
  115. this.ServeSuccessJSON(map[string]interface{}{
  116. "configurationlist": configurationlist,
  117. "total": total,
  118. })
  119. }
  120. func (this *CommonApiController) GetConfigurationDetail() {
  121. id, _ := this.GetInt64("id")
  122. fmt.Println("id是", id)
  123. detail, err := service.GetConfigurationDetail(id)
  124. if err != nil {
  125. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  126. return
  127. }
  128. this.ServeSuccessJSON(map[string]interface{}{
  129. "configurationdetail": detail,
  130. })
  131. }
  132. func (this *CommonApiController) GetAllInspectionminor() {
  133. minor, err := service.GetAllInspectionMinor(0)
  134. if err != nil {
  135. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  136. return
  137. }
  138. this.ServeSuccessJSON(map[string]interface{}{
  139. "minor": minor,
  140. })
  141. }
  142. func (this *CommonApiController) UpdateConfiguration() {
  143. id, _ := this.GetInt64("id")
  144. fmt.Println("id", id)
  145. dataBody := make(map[string]interface{}, 0)
  146. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  147. fmt.Println("err", err)
  148. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  149. fmt.Println("大项", inspectionmajor)
  150. inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
  151. fmt.Println("小项", inspectionMinor)
  152. minrange := dataBody["min_range"].(string)
  153. fmt.Println("minragne", minrange)
  154. largerange := dataBody["large_range"].(string)
  155. fmt.Println("largerange", largerange)
  156. sort := int64(dataBody["sort"].(float64))
  157. fmt.Println("排序", sort)
  158. adminInfo := this.GetAdminUserInfo()
  159. orgId := adminInfo.CurrentOrgId
  160. configuration, err := service.GetConfigurationByIdTwo(inspectionmajor, inspectionMinor, orgId)
  161. fmt.Println("err", err)
  162. if configuration.ID > 0 && configuration.ID != id {
  163. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  164. return
  165. }
  166. standard := models.XtQualityControlStandard{
  167. InspectionMajor: inspectionmajor,
  168. InspectionMinor: inspectionMinor,
  169. MinRange: minrange,
  170. LargeRange: largerange,
  171. Sort: sort,
  172. }
  173. err = service.UpdarteConfiguration(&standard, id)
  174. if err != nil {
  175. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  176. return
  177. }
  178. this.ServeSuccessJSON(map[string]interface{}{
  179. "standard": standard,
  180. })
  181. }
  182. func (this *CommonApiController) DeleteConfiguration() {
  183. id, _ := this.GetInt64("id")
  184. err := service.DeleteConfiguration(id)
  185. if err != nil {
  186. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  187. return
  188. }
  189. returnData := make(map[string]interface{}, 0)
  190. returnData["msg"] = "ok"
  191. this.ServeSuccessJSON(returnData)
  192. return
  193. }
  194. func (this *CommonApiController) GetAllInspectiondata() {
  195. adminUser := this.GetAdminUserInfo()
  196. orgid := adminUser.CurrentOrgId
  197. //查询该机构是否有数据
  198. _, errcode := service.GetAllInspectionData(orgid)
  199. if errcode == gorm.ErrRecordNotFound {
  200. inspection, err := service.GetAllInspectiondatatwo(0)
  201. if err != nil {
  202. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  203. return
  204. }
  205. this.ServeSuccessJSON(map[string]interface{}{
  206. "inspection": inspection,
  207. })
  208. } else if errcode == nil {
  209. inspection, err := service.GetAllInspectiondatatwo(orgid)
  210. if err != nil {
  211. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  212. return
  213. }
  214. this.ServeSuccessJSON(map[string]interface{}{
  215. "inspection": inspection,
  216. })
  217. }
  218. }
  219. func (this *CommonApiController) SaveCheckConfiguration() {
  220. dataBody := make(map[string]interface{}, 0)
  221. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  222. fmt.Println("err", err)
  223. adminUser := this.GetAdminUserInfo()
  224. orgid := adminUser.CurrentOrgId
  225. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  226. fmt.Println("大项", inspectionmajor)
  227. frequency := dataBody["frequency"].(string)
  228. fmt.Println("凭次", frequency)
  229. sort := dataBody["sort"].(string)
  230. sorts, err := strconv.ParseInt(sort, 10, 64)
  231. fmt.Println("sort", sort)
  232. _, errcode := service.GetInspectionMajorById(inspectionmajor, orgid)
  233. if errcode == gorm.ErrRecordNotFound {
  234. configuration := models.XtCheckConfiguration{
  235. InspectionMajor: inspectionmajor,
  236. InspectionFrequency: frequency,
  237. Sort: sorts,
  238. UserOrgId: orgid,
  239. Status: 1,
  240. CreatedTime: time.Now().Unix(),
  241. }
  242. err := service.CreateCheckConfiguration(&configuration)
  243. if err != nil {
  244. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  245. return
  246. }
  247. this.ServeSuccessJSON(map[string]interface{}{
  248. "configuration": configuration,
  249. })
  250. } else if errcode == nil {
  251. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  252. return
  253. }
  254. }
  255. func (this *CommonApiController) GetAllCheckList() {
  256. adminUser := this.GetAdminUserInfo()
  257. orgid := adminUser.CurrentOrgId
  258. fmt.Println("org", orgid)
  259. page, _ := this.GetInt64("page")
  260. limit, _ := this.GetInt64("limit")
  261. checkList, total, err := service.GetAllCheckList(orgid, page, limit)
  262. if err != nil {
  263. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  264. return
  265. }
  266. this.ServeSuccessJSON(map[string]interface{}{
  267. "checklist": checkList,
  268. "total": total,
  269. })
  270. }
  271. func (this *CommonApiController) GetCheckdetail() {
  272. id, _ := this.GetInt64("id")
  273. detail, err := service.GetCheckDetail(id)
  274. if err != nil {
  275. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  276. return
  277. }
  278. this.ServeSuccessJSON(map[string]interface{}{
  279. "checkdetail": detail,
  280. })
  281. }
  282. func (this *CommonApiController) UpdateCheck() {
  283. id, _ := this.GetInt64("id")
  284. fmt.Println(id)
  285. dataBody := make(map[string]interface{}, 0)
  286. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  287. fmt.Println(err)
  288. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  289. fmt.Println("大项", inspectionmajor)
  290. frequency := dataBody["frequency"].(string)
  291. fmt.Println("凭次", frequency)
  292. sort := int64(dataBody["sort"].(float64))
  293. fmt.Println("sort", sort)
  294. adminInfo := this.GetAdminUserInfo()
  295. orgId := adminInfo.CurrentOrgId
  296. Inspection, err := service.GetInspectionMajorByIdTwo(inspectionmajor, orgId)
  297. if Inspection.ID > 0 && Inspection.ID != id {
  298. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  299. return
  300. }
  301. configuration := models.XtCheckConfiguration{
  302. InspectionMajor: inspectionmajor,
  303. InspectionFrequency: frequency,
  304. Sort: sort,
  305. }
  306. err = service.UpdateCheck(&configuration, id)
  307. if err != nil {
  308. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  309. return
  310. }
  311. this.ServeSuccessJSON(map[string]interface{}{
  312. "configuration": configuration,
  313. })
  314. }
  315. func (this *CommonApiController) DeleteCheck() {
  316. id, _ := this.GetInt64("id")
  317. err := service.DeleteCheck(id)
  318. if err != nil {
  319. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  320. return
  321. }
  322. returnData := make(map[string]interface{}, 0)
  323. returnData["msg"] = "ok"
  324. this.ServeSuccessJSON(returnData)
  325. return
  326. }
  327. func (this *CommonApiController) GetDialysisModeType() {
  328. timeLayout := "2006-01-02"
  329. loc, _ := time.LoadLocation("Local")
  330. startime := this.GetString("startime")
  331. endtime := this.GetString("endtime")
  332. fmt.Println("endtime", endtime)
  333. startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  334. startimes := startTimes.Unix()
  335. // fmt.Println("startime",startimes)
  336. endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  337. endtimeData := endtimes.Unix()
  338. // fmt.Println("结束日期",endtimeData)
  339. adminUser := this.GetAdminUserInfo()
  340. orgid := adminUser.CurrentOrgId
  341. //统计透析总量
  342. _, total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid)
  343. modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid)
  344. if err != nil {
  345. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  346. return
  347. }
  348. this.ServeSuccessJSON(map[string]interface{}{
  349. "total": total,
  350. "modetype": modeType,
  351. })
  352. }
  353. func (this *CommonApiController) GetTotalLapseCount() {
  354. adminUser := this.GetAdminUserInfo()
  355. orgid := adminUser.CurrentOrgId
  356. startime, _ := this.GetInt64("startime")
  357. fmt.Println("startime", startime)
  358. endtime, _ := this.GetInt64("endtime")
  359. fmt.Println("endtime", endtime)
  360. //统计一个月内转出的病人
  361. //patients, total, err := service.GetTotalRollOut(startime, endtime, orgid)
  362. //统计该机构的转出人数
  363. patients, total, err := service.GetTotalRollOutPatients(orgid)
  364. //统计总共病人
  365. // _, count, _ := service.GetPatientTotalCountTwo(orgid, startime, endtime)
  366. count := service.GetPatientTotalCount(orgid)
  367. if err != nil {
  368. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  369. return
  370. }
  371. this.ServeSuccessJSON(map[string]interface{}{
  372. "patients": patients,
  373. "total": total,
  374. "count": count,
  375. })
  376. }
  377. func (this *CommonApiController) GetTotalSexCount() {
  378. adminUser := this.GetAdminUserInfo()
  379. orgid := adminUser.CurrentOrgId
  380. fmt.Println("orgid", orgid)
  381. startime, _ := this.GetInt64("startime")
  382. fmt.Println("开始时间", startime)
  383. endtime, _ := this.GetInt64("endtime")
  384. fmt.Println("结束时间", endtime)
  385. total := service.GetPatientTotalCount(orgid)
  386. _, totalSex, err := service.GetManPatientTotal(orgid)
  387. if err != nil {
  388. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  389. return
  390. }
  391. this.ServeSuccessJSON(map[string]interface{}{
  392. "total": total,
  393. "totalSex": totalSex,
  394. })
  395. }
  396. func (this *CommonApiController) GetTotalInfectiouscount() {
  397. adminUser := this.GetAdminUserInfo()
  398. orgid := adminUser.CurrentOrgId
  399. fmt.Println("orgid", orgid)
  400. startime, _ := this.GetInt64("startime")
  401. fmt.Println("开始时间", startime)
  402. endtime, _ := this.GetInt64("endtime")
  403. fmt.Println("结束时间", endtime)
  404. //统计透析总人数
  405. total := service.GetPatientTotalCount(orgid)
  406. //统计透析人数传染病所占比例
  407. count, err := service.GetPatientInfectiousCount(orgid)
  408. //统计其他
  409. _, otherTotal, err := service.GetPatientOtherInfectious(orgid)
  410. if err != nil {
  411. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  412. return
  413. }
  414. this.ServeSuccessJSON(map[string]interface{}{
  415. "total": total,
  416. "count": count,
  417. "otherTotal": otherTotal,
  418. })
  419. }
  420. func (this *CommonApiController) GetTotalAgeCount() {
  421. adminUser := this.GetAdminUserInfo()
  422. orgid := adminUser.CurrentOrgId
  423. fmt.Println("orgid", orgid)
  424. startime, _ := this.GetInt64("startime")
  425. fmt.Println("开始时间", startime)
  426. endtime, _ := this.GetInt64("endtime")
  427. fmt.Println("结束时间", endtime)
  428. //统计透析总人数
  429. total := service.GetPatientTotalCount(orgid)
  430. agecount, err := service.GetTotalAgeCount(orgid)
  431. //two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
  432. if err != nil {
  433. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  434. return
  435. }
  436. this.ServeSuccessJSON(map[string]interface{}{
  437. "total": total,
  438. "ageCount": agecount,
  439. })
  440. }
  441. func (this *CommonApiController) GetTotalDialysisCount() {
  442. adminUser := this.GetAdminUserInfo()
  443. orgid := adminUser.CurrentOrgId
  444. fmt.Println("org", orgid)
  445. startime, _ := this.GetInt64("startime")
  446. fmt.Println(startime)
  447. endtime, _ := this.GetInt64("endtime")
  448. fmt.Println(endtime)
  449. recordDateStr := time.Now().Format("2006-01-02")
  450. recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
  451. fmt.Println("parseDateErr", parseDateErr)
  452. nowtime := recordDate.Unix()
  453. //统计透析总人数
  454. total := service.GetPatientTotalCount(orgid)
  455. fmt.Println("total", total)
  456. //获取该机构下的所有病人数据
  457. patients, err := service.GetTotalDialysisAgeCount(orgid)
  458. fmt.Println("patients", patients)
  459. //统计透年龄
  460. dataage, _ := service.GetDialysisAgeData(orgid)
  461. if err != nil {
  462. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  463. return
  464. }
  465. this.ServeSuccessJSON(map[string]interface{}{
  466. "total": total,
  467. "patients": patients,
  468. "nowtime": nowtime,
  469. "dataage": dataage,
  470. })
  471. }
  472. func (this *CommonApiController) GetCurentOrgPatients() {
  473. adminUser := this.GetAdminUserInfo()
  474. orgid := adminUser.CurrentOrgId
  475. patients, err := service.GetCurentOrgPatients(orgid)
  476. if err != nil {
  477. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  478. return
  479. }
  480. this.ServeSuccessJSON(map[string]interface{}{
  481. "patients": patients,
  482. })
  483. }
  484. func (this *CommonApiController) GetDialysislist() {
  485. startime := this.GetString("startime")
  486. fmt.Println("startime", startime)
  487. endtime := this.GetString("endtime")
  488. fmt.Println("enditme", endtime)
  489. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  490. fmt.Println("parseDateErr", parseDateErr)
  491. statime := startDate.Unix()
  492. fmt.Println("开始时间", statime)
  493. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  494. entime := endDate.Unix()
  495. fmt.Println("开始时间", statime)
  496. page, _ := this.GetInt64("page")
  497. fmt.Println("page", page)
  498. limit, _ := this.GetInt64("limit")
  499. fmt.Println("limit", limit)
  500. adminUser := this.GetAdminUserInfo()
  501. orgId := adminUser.CurrentOrgId
  502. dialysislist, total, err := service.GetDialysisList(statime, entime, page, limit, orgId)
  503. prescriptionList, _ := service.GetAllDialysisList(statime, entime, orgId)
  504. list, totallist, _ := service.GetDialysisPatientList(statime, entime, page, limit, orgId)
  505. fmt.Println("err", err)
  506. if err != nil {
  507. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  508. return
  509. }
  510. this.ServeSuccessJSON(map[string]interface{}{
  511. "dialysislist": dialysislist,
  512. "total": total,
  513. "list": list,
  514. "totallist": totallist,
  515. "prescriptionList": prescriptionList,
  516. })
  517. }
  518. func (this *CommonApiController) GetLastSort() {
  519. adminUser := this.GetAdminUserInfo()
  520. orgid := adminUser.CurrentOrgId
  521. standard, err := service.GetLastSort(orgid)
  522. if err != nil {
  523. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  524. return
  525. }
  526. this.ServeSuccessJSON(map[string]interface{}{
  527. "standard": standard,
  528. })
  529. }
  530. func (this *CommonApiController) GetLastCheckList() {
  531. adminUser := this.GetAdminUserInfo()
  532. orgid := adminUser.CurrentOrgId
  533. checkList, err := service.GetLastCheckList(orgid)
  534. if err != nil {
  535. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  536. return
  537. }
  538. this.ServeSuccessJSON(map[string]interface{}{
  539. "checkList": checkList,
  540. })
  541. }
  542. func (this *CommonApiController) GetDialysisDetailById() {
  543. adminUser := this.GetAdminUserInfo()
  544. orgId := adminUser.CurrentOrgId
  545. id, _ := this.GetInt64("id")
  546. fmt.Println("id", id)
  547. startime := this.GetString("startime")
  548. fmt.Println(startime)
  549. endtime := this.GetString("endtime")
  550. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  551. fmt.Println("parseDateErr", parseDateErr)
  552. statime := startDate.Unix()
  553. fmt.Println("开始时间", statime)
  554. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  555. entime := endDate.Unix()
  556. fmt.Println("开始时间", statime)
  557. fmt.Println(endtime)
  558. limit, _ := this.GetInt64("limit")
  559. fmt.Println("limit", limit)
  560. page, _ := this.GetInt64("page")
  561. fmt.Println("page", page)
  562. patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
  563. if err != nil {
  564. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  565. return
  566. }
  567. this.ServeSuccessJSON(map[string]interface{}{
  568. "patients": patients,
  569. "total": total,
  570. })
  571. }
  572. func (this *CommonApiController) GetPrescritionByName() {
  573. adminUser := this.GetAdminUserInfo()
  574. orgId := adminUser.CurrentOrgId
  575. keyword := this.GetString("keyword")
  576. startime := this.GetString("startime")
  577. fmt.Println(startime)
  578. endtime := this.GetString("endtime")
  579. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  580. fmt.Println("parseDateErr", parseDateErr)
  581. statime := startDate.Unix()
  582. fmt.Println("开始时间", statime)
  583. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  584. entime := endDate.Unix()
  585. fmt.Println("开始时间", statime)
  586. fmt.Println(endtime)
  587. limit, _ := this.GetInt64("limit")
  588. fmt.Println("limit", limit)
  589. page, _ := this.GetInt64("page")
  590. fmt.Println("page", page)
  591. patient, total, err := service.GetPrescritionByName(orgId, keyword, statime, entime, limit, page)
  592. if err != nil {
  593. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  594. return
  595. }
  596. this.ServeSuccessJSON(map[string]interface{}{
  597. "patient": patient,
  598. "total": total,
  599. })
  600. }
  601. func (this *CommonApiController) GetStatistics() {
  602. adminUser := this.GetAdminUserInfo()
  603. orgId := adminUser.CurrentOrgId
  604. fmt.Println("orgid", orgId)
  605. startime := this.GetString("start_time")
  606. fmt.Println(startime)
  607. endtime := this.GetString("end_time")
  608. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  609. fmt.Println("parseDateErr", parseDateErr)
  610. statime := startDate.Unix()
  611. fmt.Println("开始时间", statime)
  612. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  613. entime := endDate.Unix()
  614. fmt.Println("结束日期", entime)
  615. value, _ := this.GetInt64("value")
  616. fmt.Println("value", value)
  617. limit, _ := this.GetInt64("limit")
  618. fmt.Println("limit", limit)
  619. page, _ := this.GetInt64("page")
  620. fmt.Println("page", page)
  621. modeId, _ := this.GetInt64("mode_id")
  622. statistics, ttd, total, err := service.GetStatistics(orgId, statime, entime, value, limit, page, modeId)
  623. if err != nil {
  624. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  625. return
  626. }
  627. this.ServeSuccessJSON(map[string]interface{}{
  628. "statistics": statistics,
  629. "ttd": ttd,
  630. "total": total,
  631. })
  632. }
  633. func (this *CommonApiController) GetInspectionTatolCount() {
  634. adminUser := this.GetAdminUserInfo()
  635. orgid := adminUser.CurrentOrgId
  636. startime := this.GetString("startime")
  637. fmt.Println(startime)
  638. endtime := this.GetString("endtime")
  639. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  640. fmt.Println("parseDateErr", parseDateErr)
  641. statime := startDate.Unix()
  642. fmt.Println("开始时间", statime)
  643. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  644. entime := endDate.Unix()
  645. fmt.Println("结束日期", entime)
  646. references, err := service.GetInspectionTotalCount(orgid)
  647. if err != nil {
  648. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  649. return
  650. }
  651. counts, err := service.GetInspectionProjectCount(orgid, statime, entime)
  652. this.ServeSuccessJSON(map[string]interface{}{
  653. "Inspection": references,
  654. "counts": counts,
  655. })
  656. }
  657. func (this *CommonApiController) GetInspectionDetailById() {
  658. adminUser := this.GetAdminUserInfo()
  659. orgId := adminUser.CurrentOrgId
  660. id, _ := this.GetInt64("id")
  661. fmt.Println("id", id)
  662. startime := this.GetString("startime")
  663. endtime := this.GetString("endtime")
  664. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  665. fmt.Println("parseDateErr", parseDateErr)
  666. statime := startDate.Unix()
  667. fmt.Println("开始时间", statime)
  668. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  669. entime := endDate.Unix()
  670. fmt.Println("结束日期", entime)
  671. patientdetail, err := service.GetInspectionDetailById(id, orgId, statime, entime)
  672. if err != nil {
  673. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  674. return
  675. }
  676. this.ServeSuccessJSON(map[string]interface{}{
  677. "patientdetail": patientdetail,
  678. })
  679. }
  680. func (this *CommonApiController) GetSearchPatientInfo() {
  681. adminUser := this.GetAdminUserInfo()
  682. orgId := adminUser.CurrentOrgId
  683. keyword := this.GetString("keyword")
  684. fmt.Println("keyword", keyword)
  685. startime := this.GetString("startime")
  686. endtime := this.GetString("endtime")
  687. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  688. fmt.Println("parseDateErr", parseDateErr)
  689. statime := startDate.Unix()
  690. fmt.Println("开始时间", statime)
  691. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  692. entime := endDate.Unix()
  693. fmt.Println("结束日期", entime)
  694. PatientsInfo, err := service.GetSearchPatientInfo(orgId, keyword, statime, entime)
  695. if err != nil {
  696. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  697. return
  698. }
  699. this.ServeSuccessJSON(map[string]interface{}{
  700. "PatientsInfo": PatientsInfo,
  701. })
  702. }
  703. func (this *CommonApiController) GetAllMajorInspection() {
  704. adminUser := this.GetAdminUserInfo()
  705. orgid := adminUser.CurrentOrgId
  706. inspection, err := service.GetMajorInspectionByOrgid(orgid)
  707. if len(inspection) == 0 {
  708. inspect, err := service.GetDefaultByOrgId(0)
  709. if err != nil {
  710. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  711. return
  712. }
  713. this.ServeSuccessJSON(map[string]interface{}{
  714. "inspection": inspect,
  715. })
  716. } else {
  717. if err != nil {
  718. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  719. return
  720. }
  721. this.ServeSuccessJSON(map[string]interface{}{
  722. "inspection": inspection,
  723. })
  724. }
  725. }
  726. func (this *CommonApiController) GetPatientList() {
  727. adminUser := this.GetAdminUserInfo()
  728. orgid := adminUser.CurrentOrgId
  729. startime := this.GetString("startime")
  730. endtime := this.GetString("endtime")
  731. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  732. fmt.Println("parseDateErr", parseDateErr)
  733. statime := startDate.Unix()
  734. fmt.Println("开始时间", statime)
  735. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  736. entime := endDate.Unix()
  737. fmt.Println("结束日期", entime)
  738. limit, _ := this.GetInt64("limit")
  739. fmt.Println("limit", limit)
  740. page, _ := this.GetInt64("page")
  741. fmt.Println("page", page)
  742. patientInfo, total, err := service.GetPatientListData(orgid, statime, entime, limit, page)
  743. info, _ := service.GetPatientListInfo(orgid, statime, entime)
  744. if err != nil {
  745. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  746. return
  747. }
  748. this.ServeSuccessJSON(map[string]interface{}{
  749. "patientInfo": patientInfo,
  750. "total": total,
  751. "list": info,
  752. })
  753. }
  754. func (this *CommonApiController) GetPatientDetailCheck() {
  755. adminUser := this.GetAdminUserInfo()
  756. orgid := adminUser.CurrentOrgId
  757. id, _ := this.GetInt64("id")
  758. startime := this.GetString("startime")
  759. endtime := this.GetString("endtime")
  760. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  761. fmt.Println("parseDateErr", parseDateErr)
  762. statime := startDate.Unix()
  763. fmt.Println("开始时间", statime)
  764. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  765. entime := endDate.Unix()
  766. fmt.Println("结束日期", entime)
  767. checkDetail, err := service.GetPatientDetailCheck(id, orgid, statime, entime)
  768. if err != nil {
  769. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  770. return
  771. }
  772. this.ServeSuccessJSON(map[string]interface{}{
  773. "checkDetail": checkDetail,
  774. })
  775. }
  776. func (this *CommonApiController) GetSearchDetailCheck() {
  777. adminUser := this.GetAdminUserInfo()
  778. orgid := adminUser.CurrentOrgId
  779. keyword := this.GetString("keyword")
  780. startime := this.GetString("startime")
  781. endtime := this.GetString("endtime")
  782. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  783. fmt.Println("parseDateErr", parseDateErr)
  784. statime := startDate.Unix()
  785. fmt.Println("开始时间", statime)
  786. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  787. entime := endDate.Unix()
  788. fmt.Println("结束日期", entime)
  789. checkDetail, err := service.GetSearchDetailCheck(orgid, keyword, statime, entime)
  790. if err != nil {
  791. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  792. return
  793. }
  794. this.ServeSuccessJSON(map[string]interface{}{
  795. "checkDetail": checkDetail,
  796. })
  797. }
  798. func (this *CommonApiController) GetNormData() {
  799. orgid := this.GetAdminUserInfo().CurrentOrgId
  800. //获取系统数据
  801. normdata, err := service.GetNormDataByOrgId(orgid)
  802. if len(normdata) == 0 {
  803. normdata, err := service.GetNormData(0)
  804. if err != nil {
  805. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  806. return
  807. }
  808. this.ServeSuccessJSON(map[string]interface{}{
  809. "normdata": normdata,
  810. })
  811. }
  812. if err != nil {
  813. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  814. return
  815. }
  816. this.ServeSuccessJSON(map[string]interface{}{
  817. "normdata": normdata,
  818. })
  819. }
  820. func (this *CommonApiController) GetFirstQuarter() {
  821. orgid := this.GetAdminUserInfo().CurrentOrgId
  822. lapseto, _ := this.GetInt64("lapseto")
  823. fmt.Println("转归", lapseto)
  824. startime := this.GetString("startime")
  825. fmt.Println("startime", startime)
  826. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  827. fmt.Println("parseDateErr", parseDateErr)
  828. statime := startDate.Unix()
  829. fmt.Println("开始时间", statime)
  830. endtime := this.GetString("endtime")
  831. fmt.Println("endtime", endtime)
  832. endTimeYMDHmsStr := endtime + " 23:59:59"
  833. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  834. entime := endDate.Unix()
  835. fmt.Println("结束日期", entime)
  836. //group, parseDateErr := service.GetItemNameGroup(orgid, statime, entime)
  837. //quarter, err := service.GetFirstQuarter(orgid, statime, entime)
  838. count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
  839. if err != nil {
  840. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  841. return
  842. }
  843. this.ServeSuccessJSON(map[string]interface{}{
  844. "count": count,
  845. })
  846. }
  847. func (this *CommonApiController) GetProjectList() {
  848. startime := this.GetString("startime")
  849. fmt.Println("startime", startime)
  850. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  851. fmt.Println("parseDateErr", parseDateErr)
  852. statime := startDate.Unix()
  853. fmt.Println("开始时间", statime)
  854. endtime := this.GetString("endtime")
  855. fmt.Println("endtime", endtime)
  856. endTimeYMDHmsStr := endtime + " 23:59:59"
  857. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  858. entime := endDate.Unix()
  859. fmt.Println("结束日期", entime)
  860. adminInfo := this.GetAdminUserInfo()
  861. orgid := adminInfo.CurrentOrgId
  862. fmt.Println("orgid", orgid)
  863. lapseto, _ := this.GetInt64("lapseto")
  864. fmt.Println("lapseto", lapseto)
  865. itemtype, _ := this.GetInt64("itemtype")
  866. fmt.Println("type", itemtype)
  867. modetype, _ := this.GetInt64("modetype")
  868. fmt.Println("modetype", modetype)
  869. firstQuarterStart := this.GetString("first_quarter_start")
  870. firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
  871. firstQuarterStartUnix := firstQuarterStartStr.Unix()
  872. fmt.Println("第一季度开始时间", firstQuarterStartUnix)
  873. fisrtQuarterEnd := this.GetString("first_qurter_end")
  874. fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
  875. fisrtQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
  876. fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
  877. fmt.Println("第一季度结束时间", fisrtQuarterEndStrUnix)
  878. secondeQuarterStart := this.GetString("second_qurter_start")
  879. secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
  880. secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
  881. fmt.Println("第二季度开始时间", secondeQuarterStartUnix)
  882. secondQuarterEnd := this.GetString("second_qurter_end")
  883. secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
  884. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  885. secondQuarterEndStrUnix := secondQuarterEnds.Unix()
  886. fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
  887. threeQuarterStart := this.GetString("three_qurter_start")
  888. threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
  889. threeQuarterStartUnix := threeQuarterStartStr.Unix()
  890. fmt.Println("第三季度开始时间", threeQuarterStartUnix)
  891. threeQuarterEnd := this.GetString("three_qurter_end")
  892. threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
  893. threeQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
  894. threeQuarterEndStrUnix := threeQuarterEnds.Unix()
  895. fmt.Println("第三季度结束时间", threeQuarterEndStrUnix)
  896. fourQuarterStart := this.GetString("four_qurter_start")
  897. fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
  898. fourQuarterStartUnix := fourQuarterStartStr.Unix()
  899. fmt.Println("第四季度开始时间", fourQuarterStartUnix)
  900. fourQuarterEnd := this.GetString("four_qurter_end")
  901. fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
  902. fourQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
  903. fourQuarterEndStrUnix := fourQuarterEnds.Unix()
  904. fmt.Println("第四季度结束时间", fourQuarterEndStrUnix)
  905. //按季度统计
  906. if itemtype == 1 {
  907. //统计总共
  908. list, err := service.GetProjectList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  909. //统计达标个数
  910. standList, err := service.GetProjectStandList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  911. if err != nil {
  912. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  913. return
  914. }
  915. this.ServeSuccessJSON(map[string]interface{}{
  916. "list": list,
  917. "standList": standList,
  918. })
  919. }
  920. }
  921. func (this *CommonApiController) GetMonthProjectList() {
  922. adminUser := this.GetAdminUserInfo()
  923. orgid := adminUser.CurrentOrgId
  924. fmt.Println("orgid", orgid)
  925. lapseto, _ := this.GetInt64("lapseto")
  926. fmt.Println("lapseto", lapseto)
  927. itemtype, _ := this.GetInt64("itemtype")
  928. fmt.Println("itemtype", itemtype)
  929. modetype, _ := this.GetInt64("modetype")
  930. fmt.Println("modetype", modetype)
  931. januaryStart := this.GetString("januaryStart")
  932. fmt.Println("一月始", januaryStart)
  933. januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
  934. januaryStartStrUnix := januaryStartStr.Unix()
  935. fmt.Println("一月使", januaryStartStrUnix)
  936. januaryEnd := this.GetString("januaryEnd")
  937. fmt.Println("一月末", januaryEnd)
  938. januaryEndStr := januaryEnd + " 23:59:59"
  939. januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
  940. januaryEndStrUnix := januaryEndStrs.Unix()
  941. fmt.Println("一月末", januaryEndStrUnix)
  942. febStart := this.GetString("febStart")
  943. fmt.Println("二月始", febStart)
  944. febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
  945. febStartStrStrUnix := febStartStr.Unix()
  946. fmt.Println("二月使", febStartStrStrUnix)
  947. febEnd := this.GetString("febEnd")
  948. fmt.Println("二月末", febEnd)
  949. febEndStr := febEnd + " 23:59:59"
  950. febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
  951. febEndStrUnix := febEndStrs.Unix()
  952. fmt.Println("二月末", febEndStrUnix)
  953. marchStart := this.GetString("marchStart")
  954. fmt.Println("三月始", marchStart)
  955. marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
  956. marchStartStrUnix := marchStartStr.Unix()
  957. fmt.Println("三月使", marchStartStrUnix)
  958. marchEnd := this.GetString("marchEnd")
  959. fmt.Println("三月末", febEnd)
  960. marchEndStr := marchEnd + " 23:59:59"
  961. marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
  962. marchEndStrUnix := marchEndStrs.Unix()
  963. fmt.Println("三月末", marchEndStrUnix)
  964. aprStart := this.GetString("aprStart")
  965. fmt.Println("四月始", aprStart)
  966. aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
  967. aprStartStrUnix := aprStartStr.Unix()
  968. fmt.Println("四月使", aprStartStrUnix)
  969. aprEnd := this.GetString("aprEnd")
  970. fmt.Println("四月末", aprEnd)
  971. aprEndStr := aprEnd + " 23:59:59"
  972. aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
  973. aprEndStrsUnix := aprEndStrs.Unix()
  974. fmt.Println("四月末", aprEndStrsUnix)
  975. mayStart := this.GetString("mayStart")
  976. fmt.Println("五月始", mayStart)
  977. mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
  978. mayStartStrUnix := mayStartStr.Unix()
  979. fmt.Println("五月使", mayStartStrUnix)
  980. mayEnd := this.GetString("mayEnd")
  981. fmt.Println("五月末", mayEnd)
  982. mayEndStr := mayEnd + " 23:59:59"
  983. mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
  984. mayEndStrsUnix := mayEndStrs.Unix()
  985. fmt.Println("五月末", mayEndStrsUnix)
  986. junStart := this.GetString("junStart")
  987. fmt.Println("六月始", mayStart)
  988. junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
  989. junStartStrUnix := junStartStr.Unix()
  990. fmt.Println("六月使", junStartStrUnix)
  991. junEnd := this.GetString("junEnd")
  992. fmt.Println("六月末", junEnd)
  993. junEndStr := junEnd + " 23:59:59"
  994. junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
  995. junEndStrsUnix := junEndStrs.Unix()
  996. fmt.Println("六月末", junEndStrsUnix)
  997. julStart := this.GetString("julStart")
  998. fmt.Println("七月始", julStart)
  999. julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
  1000. julStartStrUnix := julStartStr.Unix()
  1001. fmt.Println("七月使", julStartStrUnix)
  1002. julEnd := this.GetString("julEnd")
  1003. fmt.Println("七月末", julEnd)
  1004. julEndStr := julEnd + " 23:59:59"
  1005. julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
  1006. julEndStrsUnix := julEndStrs.Unix()
  1007. fmt.Println("七月末", julEndStrsUnix)
  1008. augStart := this.GetString("augStart")
  1009. fmt.Println("八月始", augStart)
  1010. augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
  1011. augStartStrUnix := augStartStr.Unix()
  1012. fmt.Println("八月使", augStartStrUnix)
  1013. augEnd := this.GetString("augEnd")
  1014. fmt.Println("八月末", augEnd)
  1015. augEndStr := augEnd + " 23:59:59"
  1016. augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
  1017. augEndStrsUnix := augEndStrs.Unix()
  1018. fmt.Println("八月末", augEndStrsUnix)
  1019. sepStart := this.GetString("sepStart")
  1020. fmt.Println("九月始", sepStart)
  1021. sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
  1022. sepStartStrUnix := sepStartStr.Unix()
  1023. fmt.Println("九月使", sepStartStrUnix)
  1024. sepEnd := this.GetString("sepEnd")
  1025. fmt.Println("九月末", sepEnd)
  1026. sepEndStr := sepEnd + " 23:59:59"
  1027. sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
  1028. sepEndStrsUnix := sepEndStrs.Unix()
  1029. fmt.Println("九月末", sepEndStrsUnix)
  1030. octStart := this.GetString("octStart")
  1031. fmt.Println("10月始", octStart)
  1032. octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
  1033. octStartStrUnix := octStartStr.Unix()
  1034. fmt.Println("10月使", octStartStrUnix)
  1035. octEnd := this.GetString("octEnd")
  1036. fmt.Println("10月末", octEnd)
  1037. octEndStr := octEnd + " 23:59:59"
  1038. octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
  1039. octEndStrsUnix := octEndStrs.Unix()
  1040. fmt.Println("10月末", octEndStrsUnix)
  1041. novStart := this.GetString("novStart")
  1042. fmt.Println("11月始", novStart)
  1043. novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
  1044. novStartStrUnix := novStartStr.Unix()
  1045. fmt.Println("11月使", novStartStrUnix)
  1046. novEnd := this.GetString("novEnd")
  1047. fmt.Println("11月末", novEnd)
  1048. novEndStr := novEnd + " 23:59:59"
  1049. novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
  1050. novEndStrsUnix := novEndStrs.Unix()
  1051. fmt.Println("10月末", novEndStrsUnix)
  1052. decStart := this.GetString("decStart")
  1053. fmt.Println("12月始", novStart)
  1054. decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
  1055. decStartStrUnix := decStartStr.Unix()
  1056. fmt.Println("12月使", decStartStrUnix)
  1057. decEnd := this.GetString("decEnd")
  1058. fmt.Println("12月末", novEnd)
  1059. decEndStr := decEnd + " 23:59:59"
  1060. decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
  1061. decEndStrsUnix := decEndStrs.Unix()
  1062. fmt.Println("12月末", decEndStrsUnix)
  1063. //统计总共
  1064. monthlist, err := service.GetMonthProjectList(orgid, lapseto, modetype, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
  1065. //统计不合格
  1066. monthNolist, err := service.GetMonthProjectListTwo(orgid, lapseto, modetype, januaryStartStrUnix, januaryEndStrUnix, febStartStrStrUnix, febEndStrUnix, marchStartStrUnix, marchEndStrUnix, aprStartStrUnix, aprEndStrsUnix, mayStartStrUnix, mayEndStrsUnix, junStartStrUnix, junEndStrsUnix, julStartStrUnix, julEndStrsUnix, augStartStrUnix, augEndStrsUnix, sepStartStrUnix, sepEndStrsUnix, octStartStrUnix, octEndStrsUnix, novStartStrUnix, novEndStrsUnix, decStartStrUnix, decEndStrsUnix)
  1067. if err != nil {
  1068. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1069. return
  1070. }
  1071. this.ServeSuccessJSON(map[string]interface{}{
  1072. "monthlist": monthlist,
  1073. "monthNolist": monthNolist,
  1074. })
  1075. }