common_api_controller.go 70KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035
  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. adminInfo := this.GetAdminUserInfo()
  42. orgId := adminInfo.CurrentOrgId
  43. //查询该机构是否存在小项
  44. major, _ := service.GetInspectionMajor(orgId)
  45. if len(major) == 0 {
  46. minor, err := service.GetInspectionMinor(id, 0)
  47. if err != nil {
  48. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  49. return
  50. }
  51. this.ServeSuccessJSON(map[string]interface{}{
  52. "inspection": minor,
  53. })
  54. } else {
  55. minor, err := service.GetInspectionMinor(id, orgId)
  56. if err != nil {
  57. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  58. return
  59. }
  60. this.ServeSuccessJSON(map[string]interface{}{
  61. "inspection": minor,
  62. })
  63. }
  64. }
  65. func (this *CommonApiController) GetInspectionRange() {
  66. id, _ := this.GetInt64("id")
  67. fmt.Println("id", id)
  68. inspectionRange, err := service.GetInspectionRange(id)
  69. if err != nil {
  70. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  71. return
  72. }
  73. this.ServeSuccessJSON(map[string]interface{}{
  74. "inspectionRange": inspectionRange,
  75. })
  76. }
  77. func (this *CommonApiController) SaveConfiguration() {
  78. adminInfo := this.GetAdminUserInfo()
  79. orgid := adminInfo.CurrentOrgId
  80. dataBody := make(map[string]interface{}, 0)
  81. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  82. fmt.Println("err", err)
  83. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  84. inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
  85. minrange := dataBody["min_range"].(string)
  86. largerange := dataBody["large_range"].(string)
  87. fmt.Println("largerange", largerange)
  88. sort := dataBody["sort"].(string)
  89. sorts, err := strconv.ParseInt(sort, 10, 64)
  90. checktype := int64(dataBody["check_type"].(float64))
  91. rangvalue := dataBody["range_value"].(string)
  92. if rangvalue == "0" {
  93. rangvalue = ""
  94. }
  95. // 参与集成的机构根据小项id获取item_id
  96. itemid, err := service.GetItemid(inspectionMinor)
  97. //查询小项是否有值
  98. fmt.Println("小项id", itemid.ItemId)
  99. major, err := service.GetInspectionMajor(orgid)
  100. if len(major) == 0 {
  101. _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
  102. if errcode == gorm.ErrRecordNotFound {
  103. standard := models.XtQualityControlStandard{
  104. InspectionMajor: inspectionmajor,
  105. InspectionMinor: inspectionMinor,
  106. MinRange: minrange,
  107. LargeRange: largerange,
  108. Sort: sorts,
  109. UserOrgId: orgid,
  110. Status: 1,
  111. RangeType: checktype,
  112. RangeValue: rangvalue,
  113. CreatedTime: time.Now().Unix(),
  114. IsStatus: 1,
  115. }
  116. fmt.Println(standard)
  117. err = service.SaveInspection(&standard)
  118. if err != nil {
  119. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  120. return
  121. }
  122. this.ServeSuccessJSON(map[string]interface{}{
  123. "standard": standard,
  124. })
  125. } else if errcode == nil {
  126. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  127. return
  128. }
  129. } else {
  130. _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
  131. if errcode == gorm.ErrRecordNotFound {
  132. standard := models.XtQualityControlStandard{
  133. InspectionMajor: inspectionmajor,
  134. InspectionMinor: itemid.ItemId,
  135. MinRange: minrange,
  136. LargeRange: largerange,
  137. Sort: sorts,
  138. UserOrgId: orgid,
  139. Status: 1,
  140. RangeType: checktype,
  141. RangeValue: rangvalue,
  142. CreatedTime: time.Now().Unix(),
  143. }
  144. fmt.Println(standard)
  145. err = service.SaveInspection(&standard)
  146. if err != nil {
  147. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  148. return
  149. }
  150. this.ServeSuccessJSON(map[string]interface{}{
  151. "standard": standard,
  152. })
  153. } else if errcode == nil {
  154. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  155. return
  156. }
  157. }
  158. }
  159. func (this *CommonApiController) GetConfigurationlist() {
  160. limit, _ := this.GetInt64("limit")
  161. page, _ := this.GetInt64("page")
  162. adminUser := this.GetAdminUserInfo()
  163. orgid := adminUser.CurrentOrgId
  164. major, _ := service.GetInspectionMajor(orgid)
  165. if len(major) == 0 {
  166. configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
  167. pressure, err := service.GetDefaultBloodPressure(orgid)
  168. if err != nil {
  169. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  170. return
  171. }
  172. this.ServeSuccessJSON(map[string]interface{}{
  173. "configurationlist": configurationlist,
  174. "total": total,
  175. "pressure": pressure,
  176. })
  177. } else {
  178. configurationlist, total, err := service.GetConfigurationListTwo(orgid, limit, page)
  179. pressure, err := service.GetDefaultBloodPressure(orgid)
  180. if err != nil {
  181. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  182. return
  183. }
  184. this.ServeSuccessJSON(map[string]interface{}{
  185. "configurationlist": configurationlist,
  186. "total": total,
  187. "pressure": pressure,
  188. })
  189. }
  190. }
  191. func (this *CommonApiController) GetConfigurationDetail() {
  192. id, _ := this.GetInt64("id")
  193. fmt.Println("id是", id)
  194. orgId := this.GetAdminUserInfo().CurrentOrgId
  195. detail, err := service.GetConfigurationDetail(id)
  196. major, err := service.GetInspectionMajor(orgId)
  197. var vid = 0
  198. if len(major) == 0 {
  199. if err != nil {
  200. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  201. return
  202. }
  203. this.ServeSuccessJSON(map[string]interface{}{
  204. "configurationdetail": detail,
  205. "vid": vid,
  206. })
  207. } else {
  208. itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
  209. if err != nil {
  210. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  211. return
  212. }
  213. this.ServeSuccessJSON(map[string]interface{}{
  214. "configurationdetail": detail,
  215. "vid": itemId.ID,
  216. })
  217. }
  218. }
  219. func (this *CommonApiController) GetAllInspectionminor() {
  220. info := this.GetAdminUserInfo()
  221. orgid := info.CurrentOrgId
  222. major, _ := service.GetInspectionMajor(orgid)
  223. if len(major) == 0 {
  224. minor, err := service.GetAllInspectionMinor(0)
  225. if err != nil {
  226. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  227. return
  228. }
  229. this.ServeSuccessJSON(map[string]interface{}{
  230. "minor": minor,
  231. })
  232. } else {
  233. minor, err := service.GetAllInspectionMinor(orgid)
  234. if err != nil {
  235. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  236. return
  237. }
  238. this.ServeSuccessJSON(map[string]interface{}{
  239. "minor": minor,
  240. })
  241. }
  242. }
  243. func (this *CommonApiController) UpdateConfiguration() {
  244. id, _ := this.GetInt64("id")
  245. dataBody := make(map[string]interface{}, 0)
  246. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  247. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  248. inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
  249. minrange := dataBody["min_range"].(string)
  250. largerange := dataBody["large_range"].(string)
  251. sort := int64(dataBody["sort"].(float64))
  252. rangvalue := dataBody["range_value"].(string)
  253. if rangvalue == "0" {
  254. rangvalue = ""
  255. }
  256. rangtype := int64(dataBody["check_type"].(float64))
  257. adminInfo := this.GetAdminUserInfo()
  258. orgId := adminInfo.CurrentOrgId
  259. configuration, err := service.GetConfigurationByIdTwo(inspectionmajor, inspectionMinor, orgId)
  260. fmt.Println("err", err)
  261. if configuration.ID > 0 && configuration.ID != id {
  262. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  263. return
  264. }
  265. major, err := service.GetInspectionMajor(orgId)
  266. if len(major) == 0 {
  267. standard := models.XtQualityControlStandard{
  268. InspectionMajor: inspectionmajor,
  269. InspectionMinor: inspectionMinor,
  270. MinRange: minrange,
  271. LargeRange: largerange,
  272. Sort: sort,
  273. RangeValue: rangvalue,
  274. RangeType: rangtype,
  275. Status: 1,
  276. UserOrgId: orgId,
  277. CreatedTime: time.Now().Unix(),
  278. UpdatedTime: time.Now().Unix(),
  279. }
  280. err = service.UpdarteConfiguration(&standard, id)
  281. if err != nil {
  282. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  283. return
  284. }
  285. this.ServeSuccessJSON(map[string]interface{}{
  286. "standard": standard,
  287. })
  288. } else {
  289. itemid, _ := service.GetItemid(inspectionMinor)
  290. standard := models.XtQualityControlStandard{
  291. InspectionMajor: inspectionmajor,
  292. InspectionMinor: itemid.ItemId,
  293. MinRange: minrange,
  294. LargeRange: largerange,
  295. Sort: sort,
  296. RangeValue: rangvalue,
  297. RangeType: rangtype,
  298. Status: 1,
  299. UserOrgId: orgId,
  300. CreatedTime: time.Now().Unix(),
  301. UpdatedTime: time.Now().Unix(),
  302. }
  303. err = service.UpdarteConfiguration(&standard, id)
  304. if err != nil {
  305. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  306. return
  307. }
  308. this.ServeSuccessJSON(map[string]interface{}{
  309. "standard": standard,
  310. })
  311. }
  312. }
  313. func (this *CommonApiController) DeleteConfiguration() {
  314. id, _ := this.GetInt64("id")
  315. err := service.DeleteConfiguration(id)
  316. if err != nil {
  317. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  318. return
  319. }
  320. returnData := make(map[string]interface{}, 0)
  321. returnData["msg"] = "ok"
  322. this.ServeSuccessJSON(returnData)
  323. return
  324. }
  325. func (this *CommonApiController) GetAllInspectiondata() {
  326. adminUser := this.GetAdminUserInfo()
  327. orgid := adminUser.CurrentOrgId
  328. //查询该机构是否有数据
  329. _, errcode := service.GetAllInspectionData(orgid)
  330. if errcode == gorm.ErrRecordNotFound {
  331. inspection, err := service.GetAllInspectiondatatwo(0)
  332. if err != nil {
  333. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  334. return
  335. }
  336. this.ServeSuccessJSON(map[string]interface{}{
  337. "inspection": inspection,
  338. })
  339. } else if errcode == nil {
  340. inspection, err := service.GetAllInspectiondatatwo(orgid)
  341. if err != nil {
  342. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  343. return
  344. }
  345. this.ServeSuccessJSON(map[string]interface{}{
  346. "inspection": inspection,
  347. })
  348. }
  349. }
  350. func (this *CommonApiController) SaveCheckConfiguration() {
  351. dataBody := make(map[string]interface{}, 0)
  352. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  353. fmt.Println("err", err)
  354. adminUser := this.GetAdminUserInfo()
  355. orgid := adminUser.CurrentOrgId
  356. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  357. //fmt.Println("大项", inspectionmajor)
  358. frequency := dataBody["frequency"].(string)
  359. //fmt.Println("凭次", frequency)
  360. sort := dataBody["sort"].(string)
  361. sorts, err := strconv.ParseInt(sort, 10, 64)
  362. //fmt.Println("sort", sort)
  363. _, errcode := service.GetInspectionMajorById(inspectionmajor, orgid)
  364. if errcode == gorm.ErrRecordNotFound {
  365. configuration := models.XtCheckConfiguration{
  366. InspectionMajor: inspectionmajor,
  367. InspectionFrequency: frequency,
  368. Sort: sorts,
  369. UserOrgId: orgid,
  370. Status: 1,
  371. CreatedTime: time.Now().Unix(),
  372. }
  373. err := service.CreateCheckConfiguration(&configuration)
  374. if err != nil {
  375. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  376. return
  377. }
  378. this.ServeSuccessJSON(map[string]interface{}{
  379. "configuration": configuration,
  380. })
  381. } else if errcode == nil {
  382. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  383. return
  384. }
  385. }
  386. func (this *CommonApiController) GetAllCheckList() {
  387. adminUser := this.GetAdminUserInfo()
  388. orgid := adminUser.CurrentOrgId
  389. //fmt.Println("org", orgid)
  390. page, _ := this.GetInt64("page")
  391. limit, _ := this.GetInt64("limit")
  392. major, _ := service.GetInspectionMajor(orgid)
  393. if len(major) == 0 {
  394. checklist, total, err := service.GetAllChekcListTwo(orgid, page, limit)
  395. if err != nil {
  396. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  397. return
  398. }
  399. this.ServeSuccessJSON(map[string]interface{}{
  400. "checklist": checklist,
  401. "total": total,
  402. })
  403. } else {
  404. checkList, total, err := service.GetAllCheckList(orgid, page, limit)
  405. if err != nil {
  406. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  407. return
  408. }
  409. this.ServeSuccessJSON(map[string]interface{}{
  410. "checklist": checkList,
  411. "total": total,
  412. })
  413. }
  414. }
  415. func (this *CommonApiController) GetCheckdetail() {
  416. id, _ := this.GetInt64("id")
  417. detail, err := service.GetCheckDetail(id)
  418. if err != nil {
  419. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  420. return
  421. }
  422. this.ServeSuccessJSON(map[string]interface{}{
  423. "checkdetail": detail,
  424. })
  425. }
  426. func (this *CommonApiController) UpdateCheck() {
  427. id, _ := this.GetInt64("id")
  428. fmt.Println(id)
  429. dataBody := make(map[string]interface{}, 0)
  430. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  431. fmt.Println(err)
  432. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  433. //fmt.Println("大项", inspectionmajor)
  434. frequency := dataBody["frequency"].(string)
  435. //fmt.Println("凭次", frequency)
  436. sort := int64(dataBody["sort"].(float64))
  437. //fmt.Println("sort", sort)
  438. adminInfo := this.GetAdminUserInfo()
  439. orgId := adminInfo.CurrentOrgId
  440. Inspection, err := service.GetInspectionMajorByIdTwo(inspectionmajor, orgId)
  441. if Inspection.ID > 0 && Inspection.ID != id {
  442. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  443. return
  444. }
  445. configuration := models.XtCheckConfiguration{
  446. InspectionMajor: inspectionmajor,
  447. InspectionFrequency: frequency,
  448. Sort: sort,
  449. }
  450. err = service.UpdateCheck(&configuration, id)
  451. if err != nil {
  452. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  453. return
  454. }
  455. this.ServeSuccessJSON(map[string]interface{}{
  456. "configuration": configuration,
  457. })
  458. }
  459. func (this *CommonApiController) DeleteCheck() {
  460. id, _ := this.GetInt64("id")
  461. err := service.DeleteCheck(id)
  462. if err != nil {
  463. this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
  464. return
  465. }
  466. returnData := make(map[string]interface{}, 0)
  467. returnData["msg"] = "ok"
  468. this.ServeSuccessJSON(returnData)
  469. return
  470. }
  471. func (this *CommonApiController) GetDialysisModeType() {
  472. timeLayout := "2006-01-02"
  473. loc, _ := time.LoadLocation("Local")
  474. startime := this.GetString("startime")
  475. endtime := this.GetString("endtime")
  476. //fmt.Println("endtime", endtime)
  477. startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  478. startimes := startTimes.Unix()
  479. // fmt.Println("startime",startimes)
  480. endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
  481. endtimeData := endtimes.Unix()
  482. // fmt.Println("结束日期",endtimeData)
  483. adminUser := this.GetAdminUserInfo()
  484. orgid := adminUser.CurrentOrgId
  485. //统计透析总量
  486. _, total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid)
  487. modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid)
  488. if err != nil {
  489. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  490. return
  491. }
  492. this.ServeSuccessJSON(map[string]interface{}{
  493. "total": total,
  494. "modetype": modeType,
  495. })
  496. }
  497. func (this *CommonApiController) GetTotalLapseCount() {
  498. timeLayout := "2006-01-02"
  499. loc, _ := time.LoadLocation("Local")
  500. adminUser := this.GetAdminUserInfo()
  501. orgid := adminUser.CurrentOrgId
  502. startime := this.GetString("startime")
  503. startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  504. startnunix := startTimes.Unix()
  505. fmt.Println("开始时间---------------", startnunix)
  506. endtime := this.GetString("endtime")
  507. endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
  508. endunix := endtimes.Unix()
  509. fmt.Println("endunix==========", endunix)
  510. //统计该机构的转出人数
  511. patients, err := service.GetTotalRollOutPatients(orgid, startnunix, endunix)
  512. //统计该机构转出病人
  513. patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startnunix, endunix)
  514. count := service.GetPatientTotalCount(orgid)
  515. if err != nil {
  516. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  517. return
  518. }
  519. this.ServeSuccessJSON(map[string]interface{}{
  520. "patients": patients,
  521. "count": count,
  522. "patienttwo": patienttwo,
  523. })
  524. }
  525. func (this *CommonApiController) GetTotalSexCount() {
  526. adminUser := this.GetAdminUserInfo()
  527. orgid := adminUser.CurrentOrgId
  528. fmt.Println("orgid", orgid)
  529. startime, _ := this.GetInt64("startime")
  530. fmt.Println("开始时间", startime)
  531. endtime, _ := this.GetInt64("endtime")
  532. fmt.Println("结束时间", endtime)
  533. total := service.GetPatientTotalCount(orgid)
  534. _, totalSex, err := service.GetManPatientTotal(orgid)
  535. if err != nil {
  536. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  537. return
  538. }
  539. this.ServeSuccessJSON(map[string]interface{}{
  540. "total": total,
  541. "totalSex": totalSex,
  542. })
  543. }
  544. func (this *CommonApiController) GetTotalInfectiouscount() {
  545. adminUser := this.GetAdminUserInfo()
  546. orgid := adminUser.CurrentOrgId
  547. fmt.Println("orgid", orgid)
  548. timeLayout := "2006-01-02"
  549. loc, _ := time.LoadLocation("Local")
  550. startime := this.GetString("startime")
  551. startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
  552. startnunix := startTimes.Unix()
  553. endtime := this.GetString("endtime")
  554. endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
  555. endunix := endtimes.Unix()
  556. //统计透析总人数
  557. total := service.GetPatientTotalCount(orgid)
  558. //统计透析人数传染病所占比例
  559. count, err := service.GetPatientInfectiousCount(orgid, startnunix, endunix)
  560. //统计其他
  561. _, otherTotal, err := service.GetPatientOtherInfectious(orgid)
  562. if err != nil {
  563. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  564. return
  565. }
  566. this.ServeSuccessJSON(map[string]interface{}{
  567. "total": total,
  568. "count": count,
  569. "otherTotal": otherTotal,
  570. })
  571. }
  572. func (this *CommonApiController) GetTotalAgeCount() {
  573. adminUser := this.GetAdminUserInfo()
  574. orgid := adminUser.CurrentOrgId
  575. fmt.Println("orgid", orgid)
  576. startime, _ := this.GetInt64("startime")
  577. fmt.Println("开始时间", startime)
  578. endtime, _ := this.GetInt64("endtime")
  579. fmt.Println("结束时间", endtime)
  580. //统计透析总人数
  581. total := service.GetPatientTotalCount(orgid)
  582. agecount, err := service.GetTotalAgeCount(orgid)
  583. //two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
  584. if err != nil {
  585. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  586. return
  587. }
  588. this.ServeSuccessJSON(map[string]interface{}{
  589. "total": total,
  590. "ageCount": agecount,
  591. })
  592. }
  593. func (this *CommonApiController) GetTotalDialysisCount() {
  594. adminUser := this.GetAdminUserInfo()
  595. orgid := adminUser.CurrentOrgId
  596. fmt.Println("org", orgid)
  597. startime, _ := this.GetInt64("startime")
  598. fmt.Println(startime)
  599. endtime, _ := this.GetInt64("endtime")
  600. fmt.Println(endtime)
  601. recordDateStr := time.Now().Format("2006-01-02")
  602. recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
  603. fmt.Println("parseDateErr", parseDateErr)
  604. nowtime := recordDate.Unix()
  605. //统计透析总人数
  606. total := service.GetPatientTotalCount(orgid)
  607. fmt.Println("total", total)
  608. //获取该机构下的所有病人数据
  609. patients, err := service.GetTotalDialysisAgeCount(orgid)
  610. fmt.Println("patients", patients)
  611. //统计透年龄
  612. dataage, _ := service.GetDialysisAgeData(orgid)
  613. if err != nil {
  614. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  615. return
  616. }
  617. this.ServeSuccessJSON(map[string]interface{}{
  618. "total": total,
  619. "patients": patients,
  620. "nowtime": nowtime,
  621. "dataage": dataage,
  622. })
  623. }
  624. func (this *CommonApiController) GetCurentOrgPatients() {
  625. adminUser := this.GetAdminUserInfo()
  626. orgid := adminUser.CurrentOrgId
  627. patients, err := service.GetCurentOrgPatients(orgid)
  628. if err != nil {
  629. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  630. return
  631. }
  632. this.ServeSuccessJSON(map[string]interface{}{
  633. "patients": patients,
  634. })
  635. }
  636. func (this *CommonApiController) GetDialysislist() {
  637. startime := this.GetString("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. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  643. entime := endDate.Unix()
  644. page, _ := this.GetInt64("page")
  645. limit, _ := this.GetInt64("limit")
  646. adminUser := this.GetAdminUserInfo()
  647. orgId := adminUser.CurrentOrgId
  648. count, _ := service.TotalDialysisCount(statime, entime, orgId)
  649. dialysislist, total, err := service.GetDialysisList(statime, entime, page, limit, orgId)
  650. prescriptionList, _ := service.GetAllDialysisList(statime, entime, orgId)
  651. list, totallist, _ := service.GetDialysisPatientList(statime, entime, page, limit, orgId)
  652. fmt.Println("err", err)
  653. if err != nil {
  654. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  655. return
  656. }
  657. this.ServeSuccessJSON(map[string]interface{}{
  658. "dialysislist": dialysislist,
  659. "total": total,
  660. "list": list,
  661. "totallist": totallist,
  662. "prescriptionList": prescriptionList,
  663. "count": count,
  664. })
  665. }
  666. func (this *CommonApiController) GetLastSort() {
  667. adminUser := this.GetAdminUserInfo()
  668. orgid := adminUser.CurrentOrgId
  669. standard, err := service.GetLastSort(orgid)
  670. if err != nil {
  671. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  672. return
  673. }
  674. this.ServeSuccessJSON(map[string]interface{}{
  675. "standard": standard,
  676. })
  677. }
  678. func (this *CommonApiController) GetLastCheckList() {
  679. adminUser := this.GetAdminUserInfo()
  680. orgid := adminUser.CurrentOrgId
  681. checkList, err := service.GetLastCheckList(orgid)
  682. if err != nil {
  683. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  684. return
  685. }
  686. this.ServeSuccessJSON(map[string]interface{}{
  687. "checkList": checkList,
  688. })
  689. }
  690. func (this *CommonApiController) GetDialysisDetailById() {
  691. adminUser := this.GetAdminUserInfo()
  692. orgId := adminUser.CurrentOrgId
  693. id, _ := this.GetInt64("id")
  694. fmt.Println("id", id)
  695. startime := this.GetString("startime")
  696. fmt.Println(startime)
  697. endtime := this.GetString("endtime")
  698. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  699. fmt.Println("parseDateErr", parseDateErr)
  700. statime := startDate.Unix()
  701. fmt.Println("开始时间", statime)
  702. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  703. entime := endDate.Unix()
  704. fmt.Println("开始时间", statime)
  705. fmt.Println(endtime)
  706. limit, _ := this.GetInt64("limit")
  707. fmt.Println("limit", limit)
  708. page, _ := this.GetInt64("page")
  709. fmt.Println("page", page)
  710. patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
  711. if err != nil {
  712. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  713. return
  714. }
  715. this.ServeSuccessJSON(map[string]interface{}{
  716. "patients": patients,
  717. "total": total,
  718. })
  719. }
  720. func (this *CommonApiController) GetPrescritionByName() {
  721. adminUser := this.GetAdminUserInfo()
  722. orgId := adminUser.CurrentOrgId
  723. patientid, _ := this.GetInt64("patientid")
  724. startime := this.GetString("startime")
  725. fmt.Println(startime)
  726. endtime := this.GetString("endtime")
  727. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  728. fmt.Println("parseDateErr", parseDateErr)
  729. statime := startDate.Unix()
  730. fmt.Println("开始时间", statime)
  731. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  732. entime := endDate.Unix()
  733. limit, _ := this.GetInt64("limit")
  734. page, _ := this.GetInt64("page")
  735. patient, total, err := service.GetPrescritionByName(orgId, patientid, statime, entime, limit, page)
  736. if err != nil {
  737. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  738. return
  739. }
  740. this.ServeSuccessJSON(map[string]interface{}{
  741. "patient": patient,
  742. "total": total,
  743. })
  744. }
  745. func (this *CommonApiController) GetStatistics() {
  746. adminUser := this.GetAdminUserInfo()
  747. orgId := adminUser.CurrentOrgId
  748. startime := this.GetString("start_time")
  749. endtime := this.GetString("end_time")
  750. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  751. fmt.Println("parseDateErr", parseDateErr)
  752. statime := startDate.Unix()
  753. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  754. entime := endDate.Unix()
  755. value, _ := this.GetInt64("value")
  756. limit, _ := this.GetInt64("limit")
  757. page, _ := this.GetInt64("page")
  758. modeId, _ := this.GetInt64("mode_id")
  759. treatinfo, total, err := service.GetTreateInfo(orgId, statime, entime, value, limit, page)
  760. statistics, ttd, _ := service.GetStatistics(orgId, statime, entime, modeId)
  761. if err != nil {
  762. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  763. return
  764. }
  765. this.ServeSuccessJSON(map[string]interface{}{
  766. "statistics": statistics,
  767. "ttd": ttd,
  768. "total": total,
  769. "treatinfo": treatinfo,
  770. })
  771. }
  772. func (this *CommonApiController) GetInspectionTatolCount() {
  773. adminUser := this.GetAdminUserInfo()
  774. orgid := adminUser.CurrentOrgId
  775. startime := this.GetString("startime")
  776. fmt.Println(startime)
  777. endtime := this.GetString("endtime")
  778. fmt.Print("endtime", endtime)
  779. patientid, _ := this.GetInt64("patientid")
  780. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  781. fmt.Println("parseDateErr", parseDateErr)
  782. statime := startDate.Unix()
  783. secondQuarterEndStr := endtime + " 23:59:59"
  784. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  785. entime := secondQuarterEnds.Unix()
  786. references, err := service.GetInspectionTotalCount(orgid)
  787. if err != nil {
  788. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  789. return
  790. }
  791. counts, err := service.GetInspectionProjectCount(orgid, statime, entime, patientid)
  792. this.ServeSuccessJSON(map[string]interface{}{
  793. "Inspection": references,
  794. "counts": counts,
  795. })
  796. }
  797. func (this *CommonApiController) GetInspectionDetailById() {
  798. adminUser := this.GetAdminUserInfo()
  799. orgId := adminUser.CurrentOrgId
  800. id, _ := this.GetInt64("id")
  801. fmt.Println("id", id)
  802. startime := this.GetString("startime")
  803. endtime := this.GetString("endtime")
  804. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  805. fmt.Println("parseDateErr", parseDateErr)
  806. statime := startDate.Unix()
  807. fmt.Println("开始时间", statime)
  808. secondQuarterEndStr := endtime + " 23:59:59"
  809. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  810. entime := secondQuarterEnds.Unix()
  811. patientdetail, err := service.GetInspectionDetailById(id, orgId, statime, entime)
  812. if err != nil {
  813. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  814. return
  815. }
  816. this.ServeSuccessJSON(map[string]interface{}{
  817. "patientdetail": patientdetail,
  818. })
  819. }
  820. func (this *CommonApiController) GetSearchPatientInfo() {
  821. adminUser := this.GetAdminUserInfo()
  822. orgId := adminUser.CurrentOrgId
  823. //keyword := this.GetString("keyword")
  824. //fmt.Println("keyword", keyword)
  825. patientid, _ := this.GetInt64("patientid")
  826. startime := this.GetString("startime")
  827. endtime := this.GetString("endtime")
  828. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  829. fmt.Println("parseDateErr", parseDateErr)
  830. statime := startDate.Unix()
  831. fmt.Println("开始时间", statime)
  832. //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  833. //entime := endDate.Unix()
  834. //fmt.Println("结束日期", entime)
  835. secondQuarterEndStr := endtime + " 23:59:59"
  836. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  837. entime := secondQuarterEnds.Unix()
  838. PatientsInfo, err := service.GetSearchPatientInfo(orgId, patientid, statime, entime)
  839. if err != nil {
  840. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  841. return
  842. }
  843. this.ServeSuccessJSON(map[string]interface{}{
  844. "PatientsInfo": PatientsInfo,
  845. })
  846. }
  847. func (this *CommonApiController) GetAllMajorInspection() {
  848. adminUser := this.GetAdminUserInfo()
  849. orgid := adminUser.CurrentOrgId
  850. inspection, err := service.GetMajorInspectionByOrgid(orgid)
  851. if len(inspection) == 0 {
  852. inspect, err := service.GetDefaultByOrgId(0)
  853. if err != nil {
  854. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  855. return
  856. }
  857. this.ServeSuccessJSON(map[string]interface{}{
  858. "inspection": inspect,
  859. })
  860. } else {
  861. if err != nil {
  862. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  863. return
  864. }
  865. this.ServeSuccessJSON(map[string]interface{}{
  866. "inspection": inspection,
  867. })
  868. }
  869. }
  870. func (this *CommonApiController) GetPatientList() {
  871. adminUser := this.GetAdminUserInfo()
  872. orgid := adminUser.CurrentOrgId
  873. startime := this.GetString("startime")
  874. endtime := this.GetString("endtime")
  875. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  876. fmt.Println("parseDateErr", parseDateErr)
  877. statime := startDate.Unix()
  878. fmt.Println("开始时间", statime)
  879. //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  880. // //entime := endDate.Unix()
  881. endTimeYMDHmsStr := endtime + " 23:59:59"
  882. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  883. entime := endDate.Unix()
  884. fmt.Println("结束日期", entime)
  885. limit, _ := this.GetInt64("limit")
  886. fmt.Println("limit", limit)
  887. page, _ := this.GetInt64("page")
  888. fmt.Println("page", page)
  889. patientInfo, total, err := service.GetPatientListData(orgid, statime, entime, limit, page)
  890. info, _ := service.GetPatientListInfo(orgid, statime, entime, limit, page)
  891. if err != nil {
  892. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  893. return
  894. }
  895. this.ServeSuccessJSON(map[string]interface{}{
  896. "patientInfo": patientInfo,
  897. "total": total,
  898. "list": info,
  899. })
  900. }
  901. func (this *CommonApiController) GetPatientDetailCheck() {
  902. adminUser := this.GetAdminUserInfo()
  903. orgid := adminUser.CurrentOrgId
  904. id, _ := this.GetInt64("id")
  905. startime := this.GetString("startime")
  906. endtime := this.GetString("endtime")
  907. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  908. fmt.Println("parseDateErr", parseDateErr)
  909. statime := startDate.Unix()
  910. fmt.Println("开始时间", statime)
  911. //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  912. //entime := endDate.Unix()
  913. //fmt.Println("结束日期", entime)
  914. endTimeYMDHmsStr := endtime + " 23:59:59"
  915. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  916. entime := endDate.Unix()
  917. checkDetail, err := service.GetPatientDetailCheck(id, orgid, statime, entime)
  918. if err != nil {
  919. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  920. return
  921. }
  922. this.ServeSuccessJSON(map[string]interface{}{
  923. "checkDetail": checkDetail,
  924. })
  925. }
  926. func (this *CommonApiController) GetSearchDetailCheck() {
  927. adminUser := this.GetAdminUserInfo()
  928. orgid := adminUser.CurrentOrgId
  929. keyword := this.GetString("keyword")
  930. startime := this.GetString("startime")
  931. endtime := this.GetString("endtime")
  932. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  933. fmt.Println("parseDateErr", parseDateErr)
  934. statime := startDate.Unix()
  935. fmt.Println("开始时间", statime)
  936. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  937. entime := endDate.Unix()
  938. fmt.Println("结束日期", entime)
  939. checkDetail, err := service.GetSearchDetailCheck(orgid, keyword, statime, entime)
  940. if err != nil {
  941. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  942. return
  943. }
  944. this.ServeSuccessJSON(map[string]interface{}{
  945. "checkDetail": checkDetail,
  946. })
  947. }
  948. func (this *CommonApiController) GetNormData() {
  949. orgid := this.GetAdminUserInfo().CurrentOrgId
  950. //获取系统数据
  951. normdata, err := service.GetNormDataByOrgId(orgid)
  952. //获取血压数据
  953. bloodPressure, err := service.GetDefaultBloodPressure(orgid)
  954. if err != nil {
  955. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  956. return
  957. }
  958. this.ServeSuccessJSON(map[string]interface{}{
  959. "normdata": normdata,
  960. "bloodPressure": bloodPressure,
  961. })
  962. //if len(normdata) == 0 {
  963. // normdata, err := service.GetNormData(0)
  964. // if err != nil {
  965. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  966. // return
  967. // }
  968. // this.ServeSuccessJSON(map[string]interface{}{
  969. // "normdata": normdata,
  970. // })
  971. //} else {
  972. // normdata, err := service.GetNormDataByOrgId(orgid)
  973. // if err != nil {
  974. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  975. // return
  976. // }
  977. // this.ServeSuccessJSON(map[string]interface{}{
  978. // "normdata": normdata,
  979. // })
  980. //}
  981. }
  982. func (this *CommonApiController) GetFirstQuarter() {
  983. orgid := this.GetAdminUserInfo().CurrentOrgId
  984. lapseto, _ := this.GetInt64("lapseto")
  985. fmt.Println("转归", lapseto)
  986. startime := this.GetString("startime")
  987. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  988. fmt.Println("parseDateErr", parseDateErr)
  989. statime := startDate.Unix()
  990. endtime := this.GetString("endtime")
  991. endTimeYMDHmsStr := endtime + " 23:59:59"
  992. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  993. entime := endDate.Unix()
  994. fmt.Println("结束日期", entime)
  995. //统计数值类型的数据
  996. count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
  997. //统计rang_type== 2
  998. countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
  999. //获取收缩压数据
  1000. _, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
  1001. //统计收缩压合格的数据
  1002. systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
  1003. //获取舒张压数据
  1004. _, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
  1005. //获取合格舒张压数据
  1006. diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
  1007. normData, _ := service.GetNormData(orgid)
  1008. if err != nil {
  1009. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1010. return
  1011. }
  1012. this.ServeSuccessJSON(map[string]interface{}{
  1013. "count": count,
  1014. "countwo": countwo,
  1015. "systolic": systolic,
  1016. "systolicTotal": systolicTotal,
  1017. "sysstandTotal": sysstandTotal,
  1018. "diastolic": diastolic,
  1019. "diastotal": diastotal,
  1020. "diasstandtotal": diasstandtotal,
  1021. "normData": normData,
  1022. })
  1023. }
  1024. func (this *CommonApiController) GetProjectList() {
  1025. startime := this.GetString("startime")
  1026. fmt.Println("startime", startime)
  1027. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  1028. fmt.Println("parseDateErr", parseDateErr)
  1029. statime := startDate.Unix()
  1030. fmt.Println("开始时间", statime)
  1031. endtime := this.GetString("endtime")
  1032. fmt.Println("endtime", endtime)
  1033. endTimeYMDHmsStr := endtime + " 23:59:59"
  1034. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  1035. entime := endDate.Unix()
  1036. adminInfo := this.GetAdminUserInfo()
  1037. orgid := adminInfo.CurrentOrgId
  1038. lapseto, _ := this.GetInt64("lapseto")
  1039. fmt.Println("lapseto", lapseto)
  1040. itemtype, _ := this.GetInt64("itemtype")
  1041. fmt.Println("type", itemtype)
  1042. modetype, _ := this.GetInt64("modetype")
  1043. fmt.Println("modetype", modetype)
  1044. firstQuarterStart := this.GetString("first_quarter_start")
  1045. firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
  1046. firstQuarterStartUnix := firstQuarterStartStr.Unix()
  1047. fisrtQuarterEnd := this.GetString("first_qurter_end")
  1048. fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
  1049. fisrtQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
  1050. fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
  1051. secondeQuarterStart := this.GetString("second_qurter_start")
  1052. secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
  1053. secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
  1054. secondQuarterEnd := this.GetString("second_qurter_end")
  1055. secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
  1056. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  1057. secondQuarterEndStrUnix := secondQuarterEnds.Unix()
  1058. fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
  1059. threeQuarterStart := this.GetString("three_qurter_start")
  1060. threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
  1061. threeQuarterStartUnix := threeQuarterStartStr.Unix()
  1062. threeQuarterEnd := this.GetString("three_qurter_end")
  1063. threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
  1064. threeQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
  1065. threeQuarterEndStrUnix := threeQuarterEnds.Unix()
  1066. fourQuarterStart := this.GetString("four_qurter_start")
  1067. fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
  1068. fourQuarterStartUnix := fourQuarterStartStr.Unix()
  1069. fourQuarterEnd := this.GetString("four_qurter_end")
  1070. fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
  1071. fourQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
  1072. fourQuarterEndStrUnix := fourQuarterEnds.Unix()
  1073. //fmt.Println("第四季度结束时间", fourQuarterEndStrUnix)
  1074. rangetype, parseDateErr := this.GetInt64("range_type")
  1075. //按季度统计
  1076. if rangetype == 1 {
  1077. //统计总共
  1078. list, err := service.GetProjectList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1079. //统计达标个数
  1080. standList, err := service.GetProjectStandList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1081. if err != nil {
  1082. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1083. return
  1084. }
  1085. this.ServeSuccessJSON(map[string]interface{}{
  1086. "list": list,
  1087. "standList": standList,
  1088. })
  1089. }
  1090. if rangetype == 2 {
  1091. list, err := service.GetProjectListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1092. //统计达标个数
  1093. standList, err := service.GetProjectStandListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1094. if err != nil {
  1095. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1096. return
  1097. }
  1098. this.ServeSuccessJSON(map[string]interface{}{
  1099. "list": list,
  1100. "standList": standList,
  1101. })
  1102. }
  1103. }
  1104. func (this *CommonApiController) GetMonthProjectList() {
  1105. adminUser := this.GetAdminUserInfo()
  1106. orgid := adminUser.CurrentOrgId
  1107. lapseto, _ := this.GetInt64("lapseto")
  1108. fmt.Println("lapseto", lapseto)
  1109. itemtype, _ := this.GetInt64("itemtype")
  1110. fmt.Println("itemtype", itemtype)
  1111. modetype, _ := this.GetInt64("modetype")
  1112. januaryStart := this.GetString("januaryStart")
  1113. januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
  1114. januaryStartStrUnix := januaryStartStr.Unix()
  1115. januaryEnd := this.GetString("januaryEnd")
  1116. januaryEndStr := januaryEnd + " 23:59:59"
  1117. januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
  1118. januaryEndStrUnix := januaryEndStrs.Unix()
  1119. febStart := this.GetString("febStart")
  1120. febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
  1121. febStartStrStrUnix := febStartStr.Unix()
  1122. febEnd := this.GetString("febEnd")
  1123. febEndStr := febEnd + " 23:59:59"
  1124. febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
  1125. febEndStrUnix := febEndStrs.Unix()
  1126. marchStart := this.GetString("marchStart")
  1127. marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
  1128. marchStartStrUnix := marchStartStr.Unix()
  1129. marchEnd := this.GetString("marchEnd")
  1130. marchEndStr := marchEnd + " 23:59:59"
  1131. marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
  1132. marchEndStrUnix := marchEndStrs.Unix()
  1133. aprStart := this.GetString("aprStart")
  1134. aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
  1135. aprStartStrUnix := aprStartStr.Unix()
  1136. aprEnd := this.GetString("aprEnd")
  1137. aprEndStr := aprEnd + " 23:59:59"
  1138. aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
  1139. aprEndStrsUnix := aprEndStrs.Unix()
  1140. mayStart := this.GetString("mayStart")
  1141. mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
  1142. mayStartStrUnix := mayStartStr.Unix()
  1143. mayEnd := this.GetString("mayEnd")
  1144. mayEndStr := mayEnd + " 23:59:59"
  1145. mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
  1146. mayEndStrsUnix := mayEndStrs.Unix()
  1147. junStart := this.GetString("junStart")
  1148. junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
  1149. junStartStrUnix := junStartStr.Unix()
  1150. junEnd := this.GetString("junEnd")
  1151. junEndStr := junEnd + " 23:59:59"
  1152. junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
  1153. junEndStrsUnix := junEndStrs.Unix()
  1154. julStart := this.GetString("julStart")
  1155. julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
  1156. julStartStrUnix := julStartStr.Unix()
  1157. julEnd := this.GetString("julEnd")
  1158. julEndStr := julEnd + " 23:59:59"
  1159. julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
  1160. julEndStrsUnix := julEndStrs.Unix()
  1161. augStart := this.GetString("augStart")
  1162. augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
  1163. augStartStrUnix := augStartStr.Unix()
  1164. augEnd := this.GetString("augEnd")
  1165. augEndStr := augEnd + " 23:59:59"
  1166. augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
  1167. augEndStrsUnix := augEndStrs.Unix()
  1168. sepStart := this.GetString("sepStart")
  1169. sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
  1170. sepStartStrUnix := sepStartStr.Unix()
  1171. sepEnd := this.GetString("sepEnd")
  1172. sepEndStr := sepEnd + " 23:59:59"
  1173. sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
  1174. sepEndStrsUnix := sepEndStrs.Unix()
  1175. octStart := this.GetString("octStart")
  1176. octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
  1177. octStartStrUnix := octStartStr.Unix()
  1178. octEnd := this.GetString("octEnd")
  1179. octEndStr := octEnd + " 23:59:59"
  1180. octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
  1181. octEndStrsUnix := octEndStrs.Unix()
  1182. novStart := this.GetString("novStart")
  1183. novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
  1184. novStartStrUnix := novStartStr.Unix()
  1185. novEnd := this.GetString("novEnd")
  1186. novEndStr := novEnd + " 23:59:59"
  1187. novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
  1188. novEndStrsUnix := novEndStrs.Unix()
  1189. decStart := this.GetString("decStart")
  1190. decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
  1191. decStartStrUnix := decStartStr.Unix()
  1192. fmt.Println("12月使", decStartStrUnix)
  1193. decEnd := this.GetString("decEnd")
  1194. decEndStr := decEnd + " 23:59:59"
  1195. decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
  1196. decEndStrsUnix := decEndStrs.Unix()
  1197. rangetype, _ := this.GetInt64("range_type")
  1198. if rangetype == 1 {
  1199. //统计总共
  1200. 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)
  1201. //统计不合格
  1202. 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)
  1203. fmt.Println("monthnolist", monthNolist)
  1204. if err != nil {
  1205. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1206. return
  1207. }
  1208. this.ServeSuccessJSON(map[string]interface{}{
  1209. "monthlist": monthlist,
  1210. "monthNolist": monthNolist,
  1211. })
  1212. }
  1213. if rangetype == 2 {
  1214. monthlist, err := service.GetMonthProjectListOne(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)
  1215. monthNolist, err := service.GetMonthProjectListThree(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)
  1216. if err != nil {
  1217. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1218. return
  1219. }
  1220. this.ServeSuccessJSON(map[string]interface{}{
  1221. "monthlist": monthlist,
  1222. "monthNolist": monthNolist,
  1223. })
  1224. }
  1225. }
  1226. func (this *CommonApiController) GetPatientscontrol() {
  1227. adminUser := this.GetAdminUserInfo()
  1228. orgid := adminUser.CurrentOrgId
  1229. lapstor, _ := this.GetInt64("lapstor")
  1230. startime := this.GetString("startime")
  1231. startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
  1232. startimeStrUnix := startimeStr.Unix()
  1233. endtime := this.GetString("endtime")
  1234. fmt.Println("结束时间", endtime)
  1235. endtimeStr := endtime + " 23:59:59"
  1236. endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
  1237. endtimeStrsUnix := endtimeStrs.Unix()
  1238. page, _ := this.GetInt64("page")
  1239. limit, _ := this.GetInt64("limit")
  1240. patients, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
  1241. control, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1242. infectiousControl, err := service.GetInfectiousControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1243. if err != nil {
  1244. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1245. return
  1246. }
  1247. this.ServeSuccessJSON(map[string]interface{}{
  1248. "patients": patients,
  1249. "total": total,
  1250. "control": control,
  1251. "infectiousControl": infectiousControl,
  1252. })
  1253. }
  1254. func (this *CommonApiController) GetCartogramList() {
  1255. adminUser := this.GetAdminUserInfo()
  1256. orgid := adminUser.CurrentOrgId
  1257. //fmt.Println("orgid", orgid)
  1258. lapstor, _ := this.GetInt64("lapstor")
  1259. fmt.Println("lapstor", lapstor)
  1260. startime := this.GetString("startime")
  1261. //fmt.Println("开始时间", startime)
  1262. startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
  1263. startimeStrUnix := startimeStr.Unix()
  1264. //fmt.Println("时间搓", startimeStrUnix)
  1265. endtime := this.GetString("endtime")
  1266. //fmt.Println("结束时间", endtime)
  1267. endtimeStr := endtime + " 23:59:59"
  1268. endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
  1269. endtimeStrsUnix := endtimeStrs.Unix()
  1270. //fmt.Println("结束时间搓", endtimeStrsUnix)
  1271. //limit, _ := this.GetInt64("limit")
  1272. //page, _ := this.GetInt64("page")
  1273. //统计总共
  1274. _, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
  1275. //fmt.Println("total=================", total)
  1276. //统计rangetype= 1
  1277. _, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
  1278. //fmt.Println(standtotal)
  1279. _, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
  1280. //fmt.Println(standtotalOne)
  1281. //cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1282. //infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1283. //_, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
  1284. if err != nil {
  1285. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1286. return
  1287. }
  1288. this.ServeSuccessJSON(map[string]interface{}{
  1289. "total": total,
  1290. "standtotal": standtotal,
  1291. "standtotalOne": standtotalOne,
  1292. })
  1293. }
  1294. func (this *CommonApiController) GetPatientContor() {
  1295. adminUser := this.GetAdminUserInfo()
  1296. orgid := adminUser.CurrentOrgId
  1297. fmt.Println(orgid)
  1298. lapstor, _ := this.GetInt64("lapstor")
  1299. fmt.Println("lapstor", lapstor)
  1300. patientid, _ := this.GetInt64("patientid")
  1301. startime := this.GetString("startime")
  1302. startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
  1303. startimeStrUnix := startimeStr.Unix()
  1304. endtime := this.GetString("endtime")
  1305. //fmt.Println("结束时间", endtime)
  1306. endtimeStr := endtime + " 23:59:59"
  1307. endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
  1308. endtimeStrsUnix := endtimeStrs.Unix()
  1309. patients, err := service.GetPatientNames(orgid, patientid)
  1310. patientcontorDetail, err := service.GetLastPatientsControlTwo(orgid, patientid, startimeStrUnix, endtimeStrsUnix)
  1311. if err != nil {
  1312. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1313. return
  1314. }
  1315. this.ServeSuccessJSON(map[string]interface{}{
  1316. "patientcontorDetail": patientcontorDetail,
  1317. "name": patients.Name,
  1318. })
  1319. }
  1320. func (this *CommonApiController) GetQualityControl() {
  1321. adminUser := this.GetAdminUserInfo()
  1322. orgid := adminUser.CurrentOrgId
  1323. fmt.Println(orgid)
  1324. patientid, _ := this.GetInt64("patientid")
  1325. startime, _ := this.GetInt64("startime")
  1326. //fmt.Println("startime", startime)
  1327. endtime, _ := this.GetInt64("endtime")
  1328. //fmt.Println("endtime", endtime)
  1329. itemid, _ := this.GetInt64("itemid")
  1330. //fmt.Println("itemid", itemid)
  1331. inspectdate, _ := this.GetInt64("inspectdate")
  1332. list, err := service.GetQualityControlById(orgid, patientid, startime, endtime, itemid, inspectdate)
  1333. if err != nil {
  1334. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1335. return
  1336. }
  1337. this.ServeSuccessJSON(map[string]interface{}{
  1338. "list": list,
  1339. })
  1340. }
  1341. func (this *CommonApiController) GetTreatlist() {
  1342. adminuser := this.GetAdminUserInfo()
  1343. orgId := adminuser.CurrentOrgId
  1344. startime := this.GetString("start_time")
  1345. endtime := this.GetString("end_time")
  1346. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  1347. fmt.Println("parseDateErr", parseDateErr)
  1348. statime := startDate.Unix()
  1349. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  1350. entime := endDate.Unix()
  1351. value, _ := this.GetInt64("value")
  1352. fmt.Println("value", value)
  1353. list, err := service.GetTreatList(orgId, statime, entime, value)
  1354. if err != nil {
  1355. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1356. return
  1357. }
  1358. this.ServeSuccessJSON(map[string]interface{}{
  1359. "list": list,
  1360. })
  1361. }
  1362. func (this *CommonApiController) GetPatientComplianceDetail() {
  1363. adminUser := this.GetAdminUserInfo()
  1364. orgid := adminUser.CurrentOrgId
  1365. fmt.Println(orgid)
  1366. patientid, _ := this.GetInt64("patientid")
  1367. startime, _ := this.GetInt64("startime")
  1368. fmt.Println("startime", startime)
  1369. endtime, _ := this.GetInt64("endtime")
  1370. fmt.Println("endtime", endtime)
  1371. itemid, _ := this.GetInt64("itemid")
  1372. fmt.Println("itemid", itemid)
  1373. list, err := service.GetPatientComplianceDetail(orgid, patientid, startime, endtime, itemid)
  1374. if err != nil {
  1375. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1376. return
  1377. }
  1378. this.ServeSuccessJSON(map[string]interface{}{
  1379. "list": list,
  1380. })
  1381. }
  1382. func (this *CommonApiController) GetBloodPressureDetail() {
  1383. id, _ := this.GetInt64("id")
  1384. blooddetail, err := service.GetBloodPressureDetail(id)
  1385. if err != nil {
  1386. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1387. return
  1388. }
  1389. this.ServeSuccessJSON(map[string]interface{}{
  1390. "blooddetail": blooddetail,
  1391. })
  1392. }
  1393. func (this *CommonApiController) UpdateBloodPrussre() {
  1394. id, _ := this.GetInt64("id")
  1395. fmt.Println("id", id)
  1396. dataBody := make(map[string]interface{}, 0)
  1397. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1398. fmt.Println("err", err)
  1399. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  1400. fmt.Println("inspectionmajor", inspectionmajor)
  1401. inspectionminor := int64(dataBody["inspectionMinor"].(float64))
  1402. fmt.Println("inspectionminor", inspectionminor)
  1403. largerange := dataBody["large_range"].(string)
  1404. fmt.Println(largerange)
  1405. minrange := dataBody["min_range"].(string)
  1406. fmt.Print(minrange)
  1407. sort := int64(dataBody["sort"].(float64))
  1408. fmt.Print("sort", sort)
  1409. standard := models.XtQualityControlStandard{
  1410. InspectionMajor: inspectionmajor,
  1411. InspectionMinor: inspectionminor,
  1412. MinRange: minrange,
  1413. Sort: sort,
  1414. LargeRange: largerange,
  1415. }
  1416. err = service.UpdateBloodPressure(&standard, id)
  1417. if err != nil {
  1418. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1419. return
  1420. }
  1421. this.ServeSuccessJSON(map[string]interface{}{
  1422. "standard": standard,
  1423. })
  1424. }
  1425. func (this *CommonApiController) GetBloodPressureList() {
  1426. adminUser := this.GetAdminUserInfo()
  1427. orgId := adminUser.CurrentOrgId
  1428. bloodType, _ := this.GetInt64("bloodType")
  1429. fmt.Println(bloodType)
  1430. firstQuarterStart := this.GetString("first_quarter_start")
  1431. firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
  1432. firstQuarterStartUnix := firstQuarterStartStr.Unix()
  1433. fmt.Println("第一季度", firstQuarterStartUnix)
  1434. fisrtQuarterEnd := this.GetString("first_qurter_end")
  1435. fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
  1436. fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
  1437. fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
  1438. fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
  1439. secondeQuarterStart := this.GetString("second_qurter_start")
  1440. secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
  1441. secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
  1442. fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
  1443. secondQuarterEnd := this.GetString("second_qurter_end")
  1444. secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
  1445. secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  1446. secondQuarterEndStrUnix := secondQuarterEnds.Unix()
  1447. fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
  1448. threeQuarterStart := this.GetString("three_qurter_start")
  1449. threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
  1450. threeQuarterStartUnix := threeQuarterStartStr.Unix()
  1451. fmt.Println("第三季度", threeQuarterStartUnix)
  1452. threeQuarterEnd := this.GetString("three_qurter_end")
  1453. threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
  1454. threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
  1455. threeQuarterEndStrUnix := threeQuarterEnds.Unix()
  1456. fmt.Println("第三季度", threeQuarterEndStrUnix)
  1457. fourQuarterStart := this.GetString("four_qurter_start")
  1458. fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
  1459. fourQuarterStartUnix := fourQuarterStartStr.Unix()
  1460. fmt.Println("第四季度", fourQuarterStartUnix)
  1461. fourQuarterEnd := this.GetString("four_qurter_end")
  1462. fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
  1463. fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
  1464. fourQuarterEndStrUnix := fourQuarterEnds.Unix()
  1465. fmt.Println("第四季度", fourQuarterEndStrUnix)
  1466. if bloodType == -1 {
  1467. //统计收缩压第一季度的总数
  1468. _, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1469. //统计收缩压第一季合格的总数
  1470. _, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1471. //统计第二季收缩压总数
  1472. _, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1473. //第二季度合格总数
  1474. _, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1475. //统计第三季收缩压总数
  1476. _, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1477. //第三季度合格数
  1478. _, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1479. //第四季度总数
  1480. _, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1481. //第四季度合格总数
  1482. _, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1483. if err != nil {
  1484. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1485. return
  1486. }
  1487. this.ServeSuccessJSON(map[string]interface{}{
  1488. "firstTotal": firstTotal,
  1489. "firstStandTotal": firstStandTotal,
  1490. "secondeTotal": secondeTotal,
  1491. "secondeStandTotal": secondeStandTotal,
  1492. "threeTotal": threeTotal,
  1493. "threeStandTotal": threeStandTotal,
  1494. "fourTotal": fourTotal,
  1495. "fourStandTotal": fourStandTotal,
  1496. })
  1497. }
  1498. if bloodType == -2 {
  1499. //统计舒张压第一季度的总数
  1500. _, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1501. _, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1502. _, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1503. _, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1504. _, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1505. _, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1506. _, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1507. _, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1508. if err != nil {
  1509. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1510. return
  1511. }
  1512. this.ServeSuccessJSON(map[string]interface{}{
  1513. "firstTotal": firstTotal,
  1514. "firstStandTotal": firstStandTotal,
  1515. "secondeTotal": secondeTotal,
  1516. "secondeStandTotal": secondeStandTotal,
  1517. "threeTotal": threeTotal,
  1518. "threeStandTotal": threeStandTotal,
  1519. "fourTotal": fourTotal,
  1520. "fourStandTotal": fourStandTotal,
  1521. })
  1522. }
  1523. }
  1524. func (this *CommonApiController) GetMonthBloodList() {
  1525. bloodtype, _ := this.GetInt64("bloodType")
  1526. fmt.Println(bloodtype)
  1527. januaryStart := this.GetString("januaryStart")
  1528. januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
  1529. januaryStartStrUnix := januaryStartStr.Unix()
  1530. fmt.Println(januaryStartStrUnix)
  1531. januaryEnd := this.GetString("januaryEnd")
  1532. januaryEndStr := januaryEnd + " 23:59:59"
  1533. januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
  1534. januaryEndStrUnix := januaryEndStrs.Unix()
  1535. fmt.Println(januaryEndStrUnix)
  1536. febStart := this.GetString("febStart")
  1537. febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
  1538. febStartStrStrUnix := febStartStr.Unix()
  1539. fmt.Println(febStartStrStrUnix)
  1540. febEnd := this.GetString("febEnd")
  1541. febEndStr := febEnd + " 23:59:59"
  1542. febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
  1543. febEndStrUnix := febEndStrs.Unix()
  1544. fmt.Println(febEndStrUnix)
  1545. marchStart := this.GetString("marchStart")
  1546. marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
  1547. marchStartStrUnix := marchStartStr.Unix()
  1548. fmt.Println(marchStartStrUnix)
  1549. marchEnd := this.GetString("marchEnd")
  1550. marchEndStr := marchEnd + " 23:59:59"
  1551. marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
  1552. marchEndStrUnix := marchEndStrs.Unix()
  1553. fmt.Println(marchEndStrUnix)
  1554. aprStart := this.GetString("aprStart")
  1555. aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
  1556. aprStartStrUnix := aprStartStr.Unix()
  1557. fmt.Println(aprStartStrUnix)
  1558. aprEnd := this.GetString("aprEnd")
  1559. aprEndStr := aprEnd + " 23:59:59"
  1560. aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
  1561. aprEndStrsUnix := aprEndStrs.Unix()
  1562. fmt.Println(aprEndStrsUnix)
  1563. mayStart := this.GetString("mayStart")
  1564. mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
  1565. mayStartStrUnix := mayStartStr.Unix()
  1566. fmt.Println(mayStartStrUnix)
  1567. mayEnd := this.GetString("mayEnd")
  1568. mayEndStr := mayEnd + " 23:59:59"
  1569. mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
  1570. mayEndStrsUnix := mayEndStrs.Unix()
  1571. fmt.Println(mayEndStrsUnix)
  1572. junStart := this.GetString("junStart")
  1573. junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
  1574. junStartStrUnix := junStartStr.Unix()
  1575. fmt.Println(junStartStrUnix)
  1576. junEnd := this.GetString("junEnd")
  1577. junEndStr := junEnd + " 23:59:59"
  1578. junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
  1579. junEndStrsUnix := junEndStrs.Unix()
  1580. fmt.Println(junEndStrsUnix)
  1581. julStart := this.GetString("julStart")
  1582. julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
  1583. julStartStrUnix := julStartStr.Unix()
  1584. fmt.Println(julStartStrUnix)
  1585. julEnd := this.GetString("julEnd")
  1586. julEndStr := julEnd + " 23:59:59"
  1587. julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
  1588. julEndStrsUnix := julEndStrs.Unix()
  1589. fmt.Println(julEndStrsUnix)
  1590. augStart := this.GetString("augStart")
  1591. augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
  1592. augStartStrUnix := augStartStr.Unix()
  1593. fmt.Print(augStartStrUnix)
  1594. augEnd := this.GetString("augEnd")
  1595. augEndStr := augEnd + " 23:59:59"
  1596. augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
  1597. augEndStrsUnix := augEndStrs.Unix()
  1598. fmt.Println(augEndStrsUnix)
  1599. sepStart := this.GetString("sepStart")
  1600. sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
  1601. sepStartStrUnix := sepStartStr.Unix()
  1602. fmt.Println(sepStartStrUnix)
  1603. sepEnd := this.GetString("sepEnd")
  1604. sepEndStr := sepEnd + " 23:59:59"
  1605. sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
  1606. sepEndStrsUnix := sepEndStrs.Unix()
  1607. fmt.Println(sepEndStrsUnix)
  1608. octStart := this.GetString("octStart")
  1609. octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
  1610. octStartStrUnix := octStartStr.Unix()
  1611. fmt.Println(octStartStrUnix)
  1612. octEnd := this.GetString("octEnd")
  1613. octEndStr := octEnd + " 23:59:59"
  1614. octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
  1615. octEndStrsUnix := octEndStrs.Unix()
  1616. fmt.Println(octEndStrsUnix)
  1617. novStart := this.GetString("novStart")
  1618. novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
  1619. novStartStrUnix := novStartStr.Unix()
  1620. fmt.Println(novStartStrUnix)
  1621. novEnd := this.GetString("novEnd")
  1622. novEndStr := novEnd + " 23:59:59"
  1623. novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
  1624. novEndStrsUnix := novEndStrs.Unix()
  1625. fmt.Println(novEndStrsUnix)
  1626. decStart := this.GetString("decStart")
  1627. decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
  1628. decStartStrUnix := decStartStr.Unix()
  1629. fmt.Println("12月使", decStartStrUnix)
  1630. decEnd := this.GetString("decEnd")
  1631. decEndStr := decEnd + " 23:59:59"
  1632. decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
  1633. decEndStrsUnix := decEndStrs.Unix()
  1634. fmt.Println(decEndStrsUnix)
  1635. adminUser := this.GetAdminUserInfo()
  1636. orgId := adminUser.CurrentOrgId
  1637. //统计收缩压
  1638. if bloodtype == -1 {
  1639. //统计收缩压一月总数
  1640. _, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1641. _, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1642. //二月
  1643. _, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1644. _, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1645. //三月
  1646. _, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1647. _, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1648. //四月
  1649. _, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1650. _, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1651. //五月
  1652. _, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1653. _, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1654. //六月
  1655. _, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1656. _, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1657. //7月
  1658. _, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1659. _, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1660. //8月
  1661. _, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1662. _, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1663. //9月
  1664. _, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1665. _, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1666. //10月
  1667. _, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1668. _, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1669. //11月
  1670. _, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1671. _, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1672. //12月
  1673. _, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1674. _, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1675. if err != nil {
  1676. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1677. return
  1678. }
  1679. this.ServeSuccessJSON(map[string]interface{}{
  1680. "januaryTotal": januaryTotal,
  1681. "januaryStandTotal": januaryStandTotal,
  1682. "febTotal": febTotal,
  1683. "febStandTotal": febStandTotal,
  1684. "marchTotal": marchTotal,
  1685. "marchStandTotal": marchStandTotal,
  1686. "aprTotal": aprTotal,
  1687. "aprStandTotal": aprStandTotal,
  1688. "mayTotal": mayTotal,
  1689. "mayStandTotal": mayStandTotal,
  1690. "junTotal": junTotal,
  1691. "junStandTotal": junStandTotal,
  1692. "julTotal": julTotal,
  1693. "julStandTotal": julStandTotal,
  1694. "augTotal": augTotal,
  1695. "augStandTotal": augStandTotal,
  1696. "sepTotal": sepTotal,
  1697. "sepStandTotal": sepStandTotal,
  1698. "octTotal": octTotal,
  1699. "octStandTotal": octStandTotal,
  1700. "novTotal": novTotal,
  1701. "novStandTotal": novStandTotal,
  1702. "decTotal": decTotal,
  1703. "decStandTotal": decStandTotal,
  1704. })
  1705. }
  1706. //统计舒张压
  1707. if bloodtype == -2 {
  1708. //统计收缩压一月总数
  1709. _, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1710. _, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1711. //二月
  1712. _, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1713. _, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1714. //三月
  1715. _, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1716. _, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1717. //四月
  1718. _, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1719. _, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1720. //五月
  1721. _, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1722. _, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1723. //六月
  1724. _, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1725. _, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1726. //7月
  1727. _, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1728. _, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1729. //8月
  1730. _, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1731. _, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1732. //9月
  1733. _, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1734. _, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1735. //10月
  1736. _, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1737. _, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1738. //11月
  1739. _, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1740. _, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1741. //12月
  1742. _, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1743. _, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1744. if err != nil {
  1745. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1746. return
  1747. }
  1748. this.ServeSuccessJSON(map[string]interface{}{
  1749. "januaryTotal": januaryTotal,
  1750. "januaryStandTotal": januaryStandTotal,
  1751. "febTotal": febTotal,
  1752. "febStandTotal": febStandTotal,
  1753. "marchTotal": marchTotal,
  1754. "marchStandTotal": marchStandTotal,
  1755. "aprTotal": aprTotal,
  1756. "aprStandTotal": aprStandTotal,
  1757. "mayTotal": mayTotal,
  1758. "mayStandTotal": mayStandTotal,
  1759. "junTotal": junTotal,
  1760. "junStandTotal": junStandTotal,
  1761. "julTotal": julTotal,
  1762. "julStandTotal": julStandTotal,
  1763. "augTotal": augTotal,
  1764. "augStandTotal": augStandTotal,
  1765. "sepTotal": sepTotal,
  1766. "sepStandTotal": sepStandTotal,
  1767. "octTotal": octTotal,
  1768. "octStandTotal": octStandTotal,
  1769. "novTotal": novTotal,
  1770. "novStandTotal": novStandTotal,
  1771. "decTotal": decTotal,
  1772. "decStandTotal": decStandTotal,
  1773. })
  1774. }
  1775. }