common_api_controller.go 71KB

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