common_api_controller.go 71KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062
  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. //获取每个病人每个透析模式的数据
  655. modeIdCount, parseDateErr := service.GetModeIdCount(statime, entime, orgId, page, limit)
  656. if err != nil {
  657. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  658. return
  659. }
  660. this.ServeSuccessJSON(map[string]interface{}{
  661. "dialysislist": dialysislist,
  662. "total": total,
  663. "list": list,
  664. "totallist": totallist,
  665. "prescriptionList": prescriptionList,
  666. "count": count,
  667. "modeIdCount": modeIdCount,
  668. })
  669. }
  670. func (this *CommonApiController) GetLastSort() {
  671. adminUser := this.GetAdminUserInfo()
  672. orgid := adminUser.CurrentOrgId
  673. standard, err := service.GetLastSort(orgid)
  674. if err != nil {
  675. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  676. return
  677. }
  678. this.ServeSuccessJSON(map[string]interface{}{
  679. "standard": standard,
  680. })
  681. }
  682. func (this *CommonApiController) GetLastCheckList() {
  683. adminUser := this.GetAdminUserInfo()
  684. orgid := adminUser.CurrentOrgId
  685. checkList, err := service.GetLastCheckList(orgid)
  686. if err != nil {
  687. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  688. return
  689. }
  690. this.ServeSuccessJSON(map[string]interface{}{
  691. "checkList": checkList,
  692. })
  693. }
  694. func (this *CommonApiController) GetDialysisDetailById() {
  695. adminUser := this.GetAdminUserInfo()
  696. orgId := adminUser.CurrentOrgId
  697. id, _ := this.GetInt64("id")
  698. fmt.Println("id", id)
  699. startime := this.GetString("startime")
  700. fmt.Println(startime)
  701. endtime := this.GetString("endtime")
  702. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  703. fmt.Println("parseDateErr", parseDateErr)
  704. statime := startDate.Unix()
  705. fmt.Println("开始时间", statime)
  706. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  707. entime := endDate.Unix()
  708. fmt.Println("开始时间", statime)
  709. fmt.Println(endtime)
  710. limit, _ := this.GetInt64("limit")
  711. fmt.Println("limit", limit)
  712. page, _ := this.GetInt64("page")
  713. fmt.Println("page", page)
  714. patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
  715. if err != nil {
  716. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  717. return
  718. }
  719. this.ServeSuccessJSON(map[string]interface{}{
  720. "patients": patients,
  721. "total": total,
  722. })
  723. }
  724. func (this *CommonApiController) GetPrescritionByName() {
  725. adminUser := this.GetAdminUserInfo()
  726. orgId := adminUser.CurrentOrgId
  727. patientid, _ := this.GetInt64("patientid")
  728. startime := this.GetString("startime")
  729. fmt.Println(startime)
  730. endtime := this.GetString("endtime")
  731. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  732. fmt.Println("parseDateErr", parseDateErr)
  733. statime := startDate.Unix()
  734. fmt.Println("开始时间", statime)
  735. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  736. entime := endDate.Unix()
  737. limit, _ := this.GetInt64("limit")
  738. page, _ := this.GetInt64("page")
  739. patient, total, err := service.GetPrescritionByName(orgId, patientid, statime, entime, limit, page)
  740. if err != nil {
  741. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  742. return
  743. }
  744. this.ServeSuccessJSON(map[string]interface{}{
  745. "patient": patient,
  746. "total": total,
  747. })
  748. }
  749. func (this *CommonApiController) GetStatistics() {
  750. adminUser := this.GetAdminUserInfo()
  751. orgId := adminUser.CurrentOrgId
  752. startime := this.GetString("start_time")
  753. endtime := this.GetString("end_time")
  754. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  755. fmt.Println("parseDateErr", parseDateErr)
  756. statime := startDate.Unix()
  757. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  758. entime := endDate.Unix()
  759. value, _ := this.GetInt64("value")
  760. limit, _ := this.GetInt64("limit")
  761. page, _ := this.GetInt64("page")
  762. modeId, _ := this.GetInt64("mode_id")
  763. treatinfo, total, err := service.GetTreateInfo(orgId, statime, entime, value, limit, page)
  764. statistics, ttd, _ := service.GetStatistics(orgId, statime, entime, modeId)
  765. if err != nil {
  766. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  767. return
  768. }
  769. this.ServeSuccessJSON(map[string]interface{}{
  770. "statistics": statistics,
  771. "ttd": ttd,
  772. "total": total,
  773. "treatinfo": treatinfo,
  774. })
  775. }
  776. func (this *CommonApiController) GetInspectionTatolCount() {
  777. adminUser := this.GetAdminUserInfo()
  778. orgid := adminUser.CurrentOrgId
  779. startime := this.GetString("startime")
  780. fmt.Println(startime)
  781. endtime := this.GetString("endtime")
  782. fmt.Print("endtime", endtime)
  783. patientid, _ := this.GetInt64("patientid")
  784. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  785. fmt.Println("parseDateErr", parseDateErr)
  786. statime := startDate.Unix()
  787. secondQuarterEndStr := endtime + " 23:59:59"
  788. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  789. entime := secondQuarterEnds.Unix()
  790. references, err := service.GetInspectionTotalCount(orgid)
  791. if err != nil {
  792. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  793. return
  794. }
  795. counts, err := service.GetInspectionProjectCount(orgid, statime, entime, patientid)
  796. this.ServeSuccessJSON(map[string]interface{}{
  797. "Inspection": references,
  798. "counts": counts,
  799. })
  800. }
  801. func (this *CommonApiController) GetInspectionDetailById() {
  802. adminUser := this.GetAdminUserInfo()
  803. orgId := adminUser.CurrentOrgId
  804. id, _ := this.GetInt64("id")
  805. fmt.Println("id", id)
  806. startime := this.GetString("startime")
  807. endtime := this.GetString("endtime")
  808. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  809. fmt.Println("parseDateErr", parseDateErr)
  810. statime := startDate.Unix()
  811. fmt.Println("开始时间", statime)
  812. secondQuarterEndStr := endtime + " 23:59:59"
  813. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  814. entime := secondQuarterEnds.Unix()
  815. patientdetail, err := service.GetInspectionDetailById(id, orgId, statime, entime)
  816. if err != nil {
  817. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  818. return
  819. }
  820. this.ServeSuccessJSON(map[string]interface{}{
  821. "patientdetail": patientdetail,
  822. })
  823. }
  824. func (this *CommonApiController) GetSearchPatientInfo() {
  825. adminUser := this.GetAdminUserInfo()
  826. orgId := adminUser.CurrentOrgId
  827. //keyword := this.GetString("keyword")
  828. //fmt.Println("keyword", keyword)
  829. patientid, _ := this.GetInt64("patientid")
  830. startime := this.GetString("startime")
  831. endtime := this.GetString("endtime")
  832. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  833. fmt.Println("parseDateErr", parseDateErr)
  834. statime := startDate.Unix()
  835. fmt.Println("开始时间", statime)
  836. //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  837. //entime := endDate.Unix()
  838. //fmt.Println("结束日期", entime)
  839. secondQuarterEndStr := endtime + " 23:59:59"
  840. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  841. entime := secondQuarterEnds.Unix()
  842. PatientsInfo, err := service.GetSearchPatientInfo(orgId, patientid, statime, entime)
  843. if err != nil {
  844. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  845. return
  846. }
  847. this.ServeSuccessJSON(map[string]interface{}{
  848. "PatientsInfo": PatientsInfo,
  849. })
  850. }
  851. func (this *CommonApiController) GetAllMajorInspection() {
  852. adminUser := this.GetAdminUserInfo()
  853. orgid := adminUser.CurrentOrgId
  854. inspection, err := service.GetMajorInspectionByOrgid(orgid)
  855. if len(inspection) == 0 {
  856. inspect, err := service.GetDefaultByOrgId(0)
  857. if err != nil {
  858. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  859. return
  860. }
  861. this.ServeSuccessJSON(map[string]interface{}{
  862. "inspection": inspect,
  863. })
  864. } else {
  865. if err != nil {
  866. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  867. return
  868. }
  869. this.ServeSuccessJSON(map[string]interface{}{
  870. "inspection": inspection,
  871. })
  872. }
  873. }
  874. func (this *CommonApiController) GetPatientList() {
  875. adminUser := this.GetAdminUserInfo()
  876. orgid := adminUser.CurrentOrgId
  877. startime := this.GetString("startime")
  878. endtime := this.GetString("endtime")
  879. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  880. fmt.Println("parseDateErr", parseDateErr)
  881. statime := startDate.Unix()
  882. fmt.Println("开始时间", statime)
  883. //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  884. // //entime := endDate.Unix()
  885. endTimeYMDHmsStr := endtime + " 23:59:59"
  886. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  887. entime := endDate.Unix()
  888. fmt.Println("结束日期", entime)
  889. limit, _ := this.GetInt64("limit")
  890. fmt.Println("limit", limit)
  891. page, _ := this.GetInt64("page")
  892. fmt.Println("page", page)
  893. patientInfo, total, err := service.GetPatientListData(orgid, statime, entime, limit, page)
  894. info, _ := service.GetPatientListInfo(orgid, statime, entime, limit, page)
  895. if err != nil {
  896. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  897. return
  898. }
  899. this.ServeSuccessJSON(map[string]interface{}{
  900. "patientInfo": patientInfo,
  901. "total": total,
  902. "list": info,
  903. })
  904. }
  905. func (this *CommonApiController) GetPatientDetailCheck() {
  906. adminUser := this.GetAdminUserInfo()
  907. orgid := adminUser.CurrentOrgId
  908. id, _ := this.GetInt64("id")
  909. startime := this.GetString("startime")
  910. endtime := this.GetString("endtime")
  911. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  912. fmt.Println("parseDateErr", parseDateErr)
  913. statime := startDate.Unix()
  914. fmt.Println("开始时间", statime)
  915. //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  916. //entime := endDate.Unix()
  917. //fmt.Println("结束日期", entime)
  918. endTimeYMDHmsStr := endtime + " 23:59:59"
  919. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  920. entime := endDate.Unix()
  921. checkDetail, err := service.GetPatientDetailCheck(id, orgid, statime, entime)
  922. if err != nil {
  923. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  924. return
  925. }
  926. this.ServeSuccessJSON(map[string]interface{}{
  927. "checkDetail": checkDetail,
  928. })
  929. }
  930. func (this *CommonApiController) GetSearchDetailCheck() {
  931. adminUser := this.GetAdminUserInfo()
  932. orgid := adminUser.CurrentOrgId
  933. keyword := this.GetString("keyword")
  934. startime := this.GetString("startime")
  935. endtime := this.GetString("endtime")
  936. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  937. fmt.Println("parseDateErr", parseDateErr)
  938. statime := startDate.Unix()
  939. fmt.Println("开始时间", statime)
  940. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  941. entime := endDate.Unix()
  942. fmt.Println("结束日期", entime)
  943. checkDetail, err := service.GetSearchDetailCheck(orgid, keyword, statime, entime)
  944. if err != nil {
  945. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  946. return
  947. }
  948. this.ServeSuccessJSON(map[string]interface{}{
  949. "checkDetail": checkDetail,
  950. })
  951. }
  952. func (this *CommonApiController) GetNormData() {
  953. orgid := this.GetAdminUserInfo().CurrentOrgId
  954. //获取系统数据
  955. normdata, err := service.GetNormDataByOrgId(orgid)
  956. //获取血压数据
  957. bloodPressure, err := service.GetDefaultBloodPressure(orgid)
  958. if err != nil {
  959. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  960. return
  961. }
  962. this.ServeSuccessJSON(map[string]interface{}{
  963. "normdata": normdata,
  964. "bloodPressure": bloodPressure,
  965. })
  966. //if len(normdata) == 0 {
  967. // normdata, err := service.GetNormData(0)
  968. // if err != nil {
  969. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  970. // return
  971. // }
  972. // this.ServeSuccessJSON(map[string]interface{}{
  973. // "normdata": normdata,
  974. // })
  975. //} else {
  976. // normdata, err := service.GetNormDataByOrgId(orgid)
  977. // if err != nil {
  978. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  979. // return
  980. // }
  981. // this.ServeSuccessJSON(map[string]interface{}{
  982. // "normdata": normdata,
  983. // })
  984. //}
  985. }
  986. func (this *CommonApiController) GetFirstQuarter() {
  987. orgid := this.GetAdminUserInfo().CurrentOrgId
  988. lapseto, _ := this.GetInt64("lapseto")
  989. fmt.Println("转归", lapseto)
  990. startime := this.GetString("startime")
  991. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  992. fmt.Println("parseDateErr", parseDateErr)
  993. statime := startDate.Unix()
  994. endtime := this.GetString("endtime")
  995. endTimeYMDHmsStr := endtime + " 23:59:59"
  996. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  997. entime := endDate.Unix()
  998. fmt.Println("结束日期", entime)
  999. //统计数值类型的数据
  1000. count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto)
  1001. //统计rang_type== 2
  1002. countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
  1003. //获取收缩压数据
  1004. systolic, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
  1005. //统计收缩压合格的数据
  1006. //systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
  1007. //获取舒张压数据
  1008. diastolic, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
  1009. //获取合格舒张压数据
  1010. //diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
  1011. normData, _ := service.GetNormData(orgid)
  1012. if err != nil {
  1013. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1014. return
  1015. }
  1016. this.ServeSuccessJSON(map[string]interface{}{
  1017. "count": count,
  1018. "countwo": countwo,
  1019. "systolic": systolic,
  1020. "systolicTotal": systolicTotal,
  1021. "diastolic": diastolic,
  1022. "diastotal": diastotal,
  1023. "normData": normData,
  1024. })
  1025. }
  1026. func (this *CommonApiController) GetProjectList() {
  1027. startime := this.GetString("startime")
  1028. fmt.Println("startime", startime)
  1029. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  1030. fmt.Println("parseDateErr", parseDateErr)
  1031. statime := startDate.Unix()
  1032. fmt.Println("开始时间", statime)
  1033. endtime := this.GetString("endtime")
  1034. fmt.Println("endtime", endtime)
  1035. endTimeYMDHmsStr := endtime + " 23:59:59"
  1036. endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  1037. entime := endDate.Unix()
  1038. adminInfo := this.GetAdminUserInfo()
  1039. orgid := adminInfo.CurrentOrgId
  1040. lapseto, _ := this.GetInt64("lapseto")
  1041. fmt.Println("lapseto", lapseto)
  1042. itemtype, _ := this.GetInt64("itemtype")
  1043. fmt.Println("type", itemtype)
  1044. modetype, _ := this.GetInt64("modetype")
  1045. fmt.Println("modetype", modetype)
  1046. firstQuarterStart := this.GetString("first_quarter_start")
  1047. firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
  1048. firstQuarterStartUnix := firstQuarterStartStr.Unix()
  1049. fisrtQuarterEnd := this.GetString("first_qurter_end")
  1050. fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
  1051. fisrtQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
  1052. fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
  1053. secondeQuarterStart := this.GetString("second_qurter_start")
  1054. secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
  1055. secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
  1056. secondQuarterEnd := this.GetString("second_qurter_end")
  1057. secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
  1058. secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  1059. secondQuarterEndStrUnix := secondQuarterEnds.Unix()
  1060. fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
  1061. threeQuarterStart := this.GetString("three_qurter_start")
  1062. threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
  1063. threeQuarterStartUnix := threeQuarterStartStr.Unix()
  1064. threeQuarterEnd := this.GetString("three_qurter_end")
  1065. threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
  1066. threeQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
  1067. threeQuarterEndStrUnix := threeQuarterEnds.Unix()
  1068. fourQuarterStart := this.GetString("four_qurter_start")
  1069. fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
  1070. fourQuarterStartUnix := fourQuarterStartStr.Unix()
  1071. fourQuarterEnd := this.GetString("four_qurter_end")
  1072. fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
  1073. fourQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
  1074. fourQuarterEndStrUnix := fourQuarterEnds.Unix()
  1075. //fmt.Println("第四季度结束时间", fourQuarterEndStrUnix)
  1076. rangetype, parseDateErr := this.GetInt64("range_type")
  1077. //按季度统计
  1078. if rangetype == 1 {
  1079. //统计总共
  1080. list, err := service.GetProjectList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1081. //统计达标个数
  1082. standList, err := service.GetProjectStandList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1083. if err != nil {
  1084. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1085. return
  1086. }
  1087. this.ServeSuccessJSON(map[string]interface{}{
  1088. "list": list,
  1089. "standList": standList,
  1090. })
  1091. }
  1092. if rangetype == 2 {
  1093. list, err := service.GetProjectListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1094. //统计达标个数
  1095. standList, err := service.GetProjectStandListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1096. if err != nil {
  1097. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1098. return
  1099. }
  1100. this.ServeSuccessJSON(map[string]interface{}{
  1101. "list": list,
  1102. "standList": standList,
  1103. })
  1104. }
  1105. }
  1106. func (this *CommonApiController) GetMonthProjectList() {
  1107. adminUser := this.GetAdminUserInfo()
  1108. orgid := adminUser.CurrentOrgId
  1109. lapseto, _ := this.GetInt64("lapseto")
  1110. fmt.Println("lapseto", lapseto)
  1111. itemtype, _ := this.GetInt64("itemtype")
  1112. fmt.Println("itemtype", itemtype)
  1113. modetype, _ := this.GetInt64("modetype")
  1114. januaryStart := this.GetString("januaryStart")
  1115. januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
  1116. januaryStartStrUnix := januaryStartStr.Unix()
  1117. januaryEnd := this.GetString("januaryEnd")
  1118. januaryEndStr := januaryEnd + " 23:59:59"
  1119. januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
  1120. januaryEndStrUnix := januaryEndStrs.Unix()
  1121. febStart := this.GetString("febStart")
  1122. febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
  1123. febStartStrStrUnix := febStartStr.Unix()
  1124. febEnd := this.GetString("febEnd")
  1125. febEndStr := febEnd + " 23:59:59"
  1126. febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
  1127. febEndStrUnix := febEndStrs.Unix()
  1128. marchStart := this.GetString("marchStart")
  1129. marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
  1130. marchStartStrUnix := marchStartStr.Unix()
  1131. marchEnd := this.GetString("marchEnd")
  1132. marchEndStr := marchEnd + " 23:59:59"
  1133. marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
  1134. marchEndStrUnix := marchEndStrs.Unix()
  1135. aprStart := this.GetString("aprStart")
  1136. aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
  1137. aprStartStrUnix := aprStartStr.Unix()
  1138. aprEnd := this.GetString("aprEnd")
  1139. aprEndStr := aprEnd + " 23:59:59"
  1140. aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
  1141. aprEndStrsUnix := aprEndStrs.Unix()
  1142. mayStart := this.GetString("mayStart")
  1143. mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
  1144. mayStartStrUnix := mayStartStr.Unix()
  1145. mayEnd := this.GetString("mayEnd")
  1146. mayEndStr := mayEnd + " 23:59:59"
  1147. mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
  1148. mayEndStrsUnix := mayEndStrs.Unix()
  1149. junStart := this.GetString("junStart")
  1150. junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
  1151. junStartStrUnix := junStartStr.Unix()
  1152. junEnd := this.GetString("junEnd")
  1153. junEndStr := junEnd + " 23:59:59"
  1154. junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
  1155. junEndStrsUnix := junEndStrs.Unix()
  1156. julStart := this.GetString("julStart")
  1157. julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
  1158. julStartStrUnix := julStartStr.Unix()
  1159. julEnd := this.GetString("julEnd")
  1160. julEndStr := julEnd + " 23:59:59"
  1161. julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
  1162. julEndStrsUnix := julEndStrs.Unix()
  1163. augStart := this.GetString("augStart")
  1164. augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
  1165. augStartStrUnix := augStartStr.Unix()
  1166. augEnd := this.GetString("augEnd")
  1167. augEndStr := augEnd + " 23:59:59"
  1168. augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
  1169. augEndStrsUnix := augEndStrs.Unix()
  1170. sepStart := this.GetString("sepStart")
  1171. sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
  1172. sepStartStrUnix := sepStartStr.Unix()
  1173. sepEnd := this.GetString("sepEnd")
  1174. sepEndStr := sepEnd + " 23:59:59"
  1175. sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
  1176. sepEndStrsUnix := sepEndStrs.Unix()
  1177. octStart := this.GetString("octStart")
  1178. octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
  1179. octStartStrUnix := octStartStr.Unix()
  1180. octEnd := this.GetString("octEnd")
  1181. octEndStr := octEnd + " 23:59:59"
  1182. octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
  1183. octEndStrsUnix := octEndStrs.Unix()
  1184. novStart := this.GetString("novStart")
  1185. novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
  1186. novStartStrUnix := novStartStr.Unix()
  1187. novEnd := this.GetString("novEnd")
  1188. novEndStr := novEnd + " 23:59:59"
  1189. novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
  1190. novEndStrsUnix := novEndStrs.Unix()
  1191. decStart := this.GetString("decStart")
  1192. decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
  1193. decStartStrUnix := decStartStr.Unix()
  1194. fmt.Println("12月使", decStartStrUnix)
  1195. decEnd := this.GetString("decEnd")
  1196. decEndStr := decEnd + " 23:59:59"
  1197. decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
  1198. decEndStrsUnix := decEndStrs.Unix()
  1199. rangetype, _ := this.GetInt64("range_type")
  1200. if rangetype == 1 {
  1201. //统计总共
  1202. 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)
  1203. //统计不合格
  1204. 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)
  1205. fmt.Println("monthnolist", monthNolist)
  1206. if err != nil {
  1207. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1208. return
  1209. }
  1210. this.ServeSuccessJSON(map[string]interface{}{
  1211. "monthlist": monthlist,
  1212. "monthNolist": monthNolist,
  1213. })
  1214. }
  1215. if rangetype == 2 {
  1216. 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)
  1217. 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)
  1218. if err != nil {
  1219. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1220. return
  1221. }
  1222. this.ServeSuccessJSON(map[string]interface{}{
  1223. "monthlist": monthlist,
  1224. "monthNolist": monthNolist,
  1225. })
  1226. }
  1227. }
  1228. func (this *CommonApiController) GetPatientscontrol() {
  1229. adminUser := this.GetAdminUserInfo()
  1230. orgid := adminUser.CurrentOrgId
  1231. lapstor, _ := this.GetInt64("lapstor")
  1232. startime := this.GetString("startime")
  1233. startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
  1234. startimeStrUnix := startimeStr.Unix()
  1235. endtime := this.GetString("endtime")
  1236. fmt.Println("结束时间", endtime)
  1237. endtimeStr := endtime + " 23:59:59"
  1238. endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
  1239. endtimeStrsUnix := endtimeStrs.Unix()
  1240. page, _ := this.GetInt64("page")
  1241. limit, _ := this.GetInt64("limit")
  1242. patients, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
  1243. control, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1244. infectiousControl, err := service.GetInfectiousControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1245. if err != nil {
  1246. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1247. return
  1248. }
  1249. this.ServeSuccessJSON(map[string]interface{}{
  1250. "patients": patients,
  1251. "total": total,
  1252. "control": control,
  1253. "infectiousControl": infectiousControl,
  1254. })
  1255. }
  1256. func (this *CommonApiController) GetCartogramList() {
  1257. adminUser := this.GetAdminUserInfo()
  1258. orgid := adminUser.CurrentOrgId
  1259. //fmt.Println("orgid", orgid)
  1260. lapstor, _ := this.GetInt64("lapstor")
  1261. fmt.Println("lapstor", lapstor)
  1262. startime := this.GetString("startime")
  1263. //fmt.Println("开始时间", startime)
  1264. startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
  1265. startimeStrUnix := startimeStr.Unix()
  1266. //fmt.Println("时间搓", startimeStrUnix)
  1267. endtime := this.GetString("endtime")
  1268. //fmt.Println("结束时间", endtime)
  1269. endtimeStr := endtime + " 23:59:59"
  1270. endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
  1271. endtimeStrsUnix := endtimeStrs.Unix()
  1272. //fmt.Println("结束时间搓", endtimeStrsUnix)
  1273. //limit, _ := this.GetInt64("limit")
  1274. //page, _ := this.GetInt64("page")
  1275. //统计总共
  1276. _, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
  1277. //fmt.Println("total=================", total)
  1278. //统计rangetype= 1
  1279. _, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
  1280. //fmt.Println(standtotal)
  1281. _, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
  1282. //fmt.Println(standtotalOne)
  1283. //cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1284. //infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
  1285. //_, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
  1286. if err != nil {
  1287. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1288. return
  1289. }
  1290. this.ServeSuccessJSON(map[string]interface{}{
  1291. "total": total,
  1292. "standtotal": standtotal,
  1293. "standtotalOne": standtotalOne,
  1294. })
  1295. }
  1296. func (this *CommonApiController) GetPatientContor() {
  1297. adminUser := this.GetAdminUserInfo()
  1298. orgid := adminUser.CurrentOrgId
  1299. fmt.Println(orgid)
  1300. lapstor, _ := this.GetInt64("lapstor")
  1301. fmt.Println("lapstor", lapstor)
  1302. patientid, _ := this.GetInt64("patientid")
  1303. startime := this.GetString("startime")
  1304. startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
  1305. startimeStrUnix := startimeStr.Unix()
  1306. endtime := this.GetString("endtime")
  1307. //fmt.Println("结束时间", endtime)
  1308. endtimeStr := endtime + " 23:59:59"
  1309. endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
  1310. endtimeStrsUnix := endtimeStrs.Unix()
  1311. patients, err := service.GetPatientNames(orgid, patientid)
  1312. patientcontorDetail, err := service.GetLastPatientsControlTwo(orgid, patientid, startimeStrUnix, endtimeStrsUnix)
  1313. if err != nil {
  1314. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1315. return
  1316. }
  1317. this.ServeSuccessJSON(map[string]interface{}{
  1318. "patientcontorDetail": patientcontorDetail,
  1319. "name": patients.Name,
  1320. })
  1321. }
  1322. func (this *CommonApiController) GetQualityControl() {
  1323. adminUser := this.GetAdminUserInfo()
  1324. orgid := adminUser.CurrentOrgId
  1325. fmt.Println(orgid)
  1326. patientid, _ := this.GetInt64("patientid")
  1327. startime, _ := this.GetInt64("startime")
  1328. //fmt.Println("startime", startime)
  1329. endtime, _ := this.GetInt64("endtime")
  1330. //fmt.Println("endtime", endtime)
  1331. itemid, _ := this.GetInt64("itemid")
  1332. //fmt.Println("itemid", itemid)
  1333. inspectdate, _ := this.GetInt64("inspectdate")
  1334. list, err := service.GetQualityControlById(orgid, patientid, startime, endtime, itemid, inspectdate)
  1335. if err != nil {
  1336. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1337. return
  1338. }
  1339. this.ServeSuccessJSON(map[string]interface{}{
  1340. "list": list,
  1341. })
  1342. }
  1343. func (this *CommonApiController) GetTreatlist() {
  1344. adminuser := this.GetAdminUserInfo()
  1345. orgId := adminuser.CurrentOrgId
  1346. startime := this.GetString("start_time")
  1347. endtime := this.GetString("end_time")
  1348. startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
  1349. fmt.Println("parseDateErr", parseDateErr)
  1350. statime := startDate.Unix()
  1351. endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
  1352. entime := endDate.Unix()
  1353. value, _ := this.GetInt64("value")
  1354. fmt.Println("value", value)
  1355. list, err := service.GetTreatList(orgId, statime, entime, value)
  1356. if err != nil {
  1357. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1358. return
  1359. }
  1360. this.ServeSuccessJSON(map[string]interface{}{
  1361. "list": list,
  1362. })
  1363. }
  1364. func (this *CommonApiController) GetPatientComplianceDetail() {
  1365. adminUser := this.GetAdminUserInfo()
  1366. orgid := adminUser.CurrentOrgId
  1367. fmt.Println(orgid)
  1368. patientid, _ := this.GetInt64("patientid")
  1369. startime, _ := this.GetInt64("startime")
  1370. fmt.Println("startime", startime)
  1371. endtime, _ := this.GetInt64("endtime")
  1372. fmt.Println("endtime", endtime)
  1373. itemid, _ := this.GetInt64("itemid")
  1374. fmt.Println("itemid", itemid)
  1375. list, err := service.GetPatientComplianceDetail(orgid, patientid, startime, endtime, itemid)
  1376. if err != nil {
  1377. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1378. return
  1379. }
  1380. this.ServeSuccessJSON(map[string]interface{}{
  1381. "list": list,
  1382. })
  1383. }
  1384. func (this *CommonApiController) GetBloodPressureDetail() {
  1385. id, _ := this.GetInt64("id")
  1386. blooddetail, err := service.GetBloodPressureDetail(id)
  1387. if err != nil {
  1388. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1389. return
  1390. }
  1391. this.ServeSuccessJSON(map[string]interface{}{
  1392. "blooddetail": blooddetail,
  1393. })
  1394. }
  1395. func (this *CommonApiController) UpdateBloodPrussre() {
  1396. id, _ := this.GetInt64("id")
  1397. fmt.Println("id", id)
  1398. dataBody := make(map[string]interface{}, 0)
  1399. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1400. fmt.Println("err", err)
  1401. inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  1402. fmt.Println("inspectionmajor", inspectionmajor)
  1403. inspectionminor := int64(dataBody["inspectionMinor"].(float64))
  1404. fmt.Println("inspectionminor", inspectionminor)
  1405. largerange := dataBody["large_range"].(string)
  1406. fmt.Println(largerange)
  1407. minrange := dataBody["min_range"].(string)
  1408. fmt.Print(minrange)
  1409. sort := int64(dataBody["sort"].(float64))
  1410. fmt.Print("sort", sort)
  1411. standard := models.XtQualityControlStandard{
  1412. InspectionMajor: inspectionmajor,
  1413. InspectionMinor: inspectionminor,
  1414. MinRange: minrange,
  1415. Sort: sort,
  1416. LargeRange: largerange,
  1417. }
  1418. err = service.UpdateBloodPressure(&standard, id)
  1419. if err != nil {
  1420. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1421. return
  1422. }
  1423. this.ServeSuccessJSON(map[string]interface{}{
  1424. "standard": standard,
  1425. })
  1426. }
  1427. func (this *CommonApiController) GetBloodPressureList() {
  1428. adminUser := this.GetAdminUserInfo()
  1429. orgId := adminUser.CurrentOrgId
  1430. bloodType, _ := this.GetInt64("bloodType")
  1431. fmt.Println(bloodType)
  1432. firstQuarterStart := this.GetString("first_quarter_start")
  1433. firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
  1434. firstQuarterStartUnix := firstQuarterStartStr.Unix()
  1435. fmt.Println("第一季度", firstQuarterStartUnix)
  1436. fisrtQuarterEnd := this.GetString("first_qurter_end")
  1437. fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
  1438. fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
  1439. fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
  1440. fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
  1441. secondeQuarterStart := this.GetString("second_qurter_start")
  1442. secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
  1443. secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
  1444. fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
  1445. secondQuarterEnd := this.GetString("second_qurter_end")
  1446. secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
  1447. secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
  1448. secondQuarterEndStrUnix := secondQuarterEnds.Unix()
  1449. fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
  1450. threeQuarterStart := this.GetString("three_qurter_start")
  1451. threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
  1452. threeQuarterStartUnix := threeQuarterStartStr.Unix()
  1453. fmt.Println("第三季度", threeQuarterStartUnix)
  1454. threeQuarterEnd := this.GetString("three_qurter_end")
  1455. threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
  1456. threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
  1457. threeQuarterEndStrUnix := threeQuarterEnds.Unix()
  1458. fmt.Println("第三季度", threeQuarterEndStrUnix)
  1459. fourQuarterStart := this.GetString("four_qurter_start")
  1460. fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
  1461. fourQuarterStartUnix := fourQuarterStartStr.Unix()
  1462. fmt.Println("第四季度", fourQuarterStartUnix)
  1463. fourQuarterEnd := this.GetString("four_qurter_end")
  1464. fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
  1465. fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
  1466. fourQuarterEndStrUnix := fourQuarterEnds.Unix()
  1467. fmt.Println("第四季度", fourQuarterEndStrUnix)
  1468. if bloodType == -1 {
  1469. //统计收缩压第一季度的总数
  1470. firstList, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1471. //统计收缩压第一季合格的总数
  1472. //_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1473. //统计第二季收缩压总数
  1474. secondelist, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1475. //第二季度合格总数
  1476. //_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1477. //统计第三季收缩压总数
  1478. threelist, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1479. //第三季度合格数
  1480. //_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1481. //第四季度总数
  1482. fourlist, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1483. //第四季度合格总数
  1484. //_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1485. if err != nil {
  1486. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1487. return
  1488. }
  1489. this.ServeSuccessJSON(map[string]interface{}{
  1490. "firstTotal": firstTotal,
  1491. "firstList": firstList,
  1492. "secondelist": secondelist,
  1493. "secondeTotal": secondeTotal,
  1494. "threelist": threelist,
  1495. "threeTotal": threeTotal,
  1496. "fourTotal": fourTotal,
  1497. "fourlist": fourlist,
  1498. })
  1499. }
  1500. if bloodType == -2 {
  1501. //统计舒张压第一季度的总数
  1502. firstList, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1503. //_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
  1504. secondelist, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1505. //_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
  1506. threelist, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1507. //_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
  1508. fourlist, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1509. //_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
  1510. if err != nil {
  1511. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1512. return
  1513. }
  1514. this.ServeSuccessJSON(map[string]interface{}{
  1515. "firstTotal": firstTotal,
  1516. "firstList": firstList,
  1517. "secondelist": secondelist,
  1518. "secondeTotal": secondeTotal,
  1519. "threelist": threelist,
  1520. "threeTotal": threeTotal,
  1521. "fourTotal": fourTotal,
  1522. "fourlist": fourlist,
  1523. })
  1524. }
  1525. }
  1526. func (this *CommonApiController) GetMonthBloodList() {
  1527. bloodtype, _ := this.GetInt64("bloodType")
  1528. fmt.Println(bloodtype)
  1529. januaryStart := this.GetString("januaryStart")
  1530. januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
  1531. januaryStartStrUnix := januaryStartStr.Unix()
  1532. fmt.Println(januaryStartStrUnix)
  1533. januaryEnd := this.GetString("januaryEnd")
  1534. januaryEndStr := januaryEnd + " 23:59:59"
  1535. januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
  1536. januaryEndStrUnix := januaryEndStrs.Unix()
  1537. fmt.Println(januaryEndStrUnix)
  1538. febStart := this.GetString("febStart")
  1539. febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
  1540. febStartStrStrUnix := febStartStr.Unix()
  1541. fmt.Println(febStartStrStrUnix)
  1542. febEnd := this.GetString("febEnd")
  1543. febEndStr := febEnd + " 23:59:59"
  1544. febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
  1545. febEndStrUnix := febEndStrs.Unix()
  1546. fmt.Println(febEndStrUnix)
  1547. marchStart := this.GetString("marchStart")
  1548. marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
  1549. marchStartStrUnix := marchStartStr.Unix()
  1550. fmt.Println(marchStartStrUnix)
  1551. marchEnd := this.GetString("marchEnd")
  1552. marchEndStr := marchEnd + " 23:59:59"
  1553. marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
  1554. marchEndStrUnix := marchEndStrs.Unix()
  1555. fmt.Println(marchEndStrUnix)
  1556. aprStart := this.GetString("aprStart")
  1557. aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
  1558. aprStartStrUnix := aprStartStr.Unix()
  1559. fmt.Println(aprStartStrUnix)
  1560. aprEnd := this.GetString("aprEnd")
  1561. aprEndStr := aprEnd + " 23:59:59"
  1562. aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
  1563. aprEndStrsUnix := aprEndStrs.Unix()
  1564. fmt.Println(aprEndStrsUnix)
  1565. mayStart := this.GetString("mayStart")
  1566. mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
  1567. mayStartStrUnix := mayStartStr.Unix()
  1568. fmt.Println(mayStartStrUnix)
  1569. mayEnd := this.GetString("mayEnd")
  1570. mayEndStr := mayEnd + " 23:59:59"
  1571. mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
  1572. mayEndStrsUnix := mayEndStrs.Unix()
  1573. fmt.Println(mayEndStrsUnix)
  1574. junStart := this.GetString("junStart")
  1575. junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
  1576. junStartStrUnix := junStartStr.Unix()
  1577. fmt.Println(junStartStrUnix)
  1578. junEnd := this.GetString("junEnd")
  1579. junEndStr := junEnd + " 23:59:59"
  1580. junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
  1581. junEndStrsUnix := junEndStrs.Unix()
  1582. fmt.Println(junEndStrsUnix)
  1583. julStart := this.GetString("julStart")
  1584. julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
  1585. julStartStrUnix := julStartStr.Unix()
  1586. fmt.Println(julStartStrUnix)
  1587. julEnd := this.GetString("julEnd")
  1588. julEndStr := julEnd + " 23:59:59"
  1589. julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
  1590. julEndStrsUnix := julEndStrs.Unix()
  1591. fmt.Println(julEndStrsUnix)
  1592. augStart := this.GetString("augStart")
  1593. augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
  1594. augStartStrUnix := augStartStr.Unix()
  1595. fmt.Print(augStartStrUnix)
  1596. augEnd := this.GetString("augEnd")
  1597. augEndStr := augEnd + " 23:59:59"
  1598. augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
  1599. augEndStrsUnix := augEndStrs.Unix()
  1600. fmt.Println(augEndStrsUnix)
  1601. sepStart := this.GetString("sepStart")
  1602. sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
  1603. sepStartStrUnix := sepStartStr.Unix()
  1604. fmt.Println(sepStartStrUnix)
  1605. sepEnd := this.GetString("sepEnd")
  1606. sepEndStr := sepEnd + " 23:59:59"
  1607. sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
  1608. sepEndStrsUnix := sepEndStrs.Unix()
  1609. fmt.Println(sepEndStrsUnix)
  1610. octStart := this.GetString("octStart")
  1611. octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
  1612. octStartStrUnix := octStartStr.Unix()
  1613. fmt.Println(octStartStrUnix)
  1614. octEnd := this.GetString("octEnd")
  1615. octEndStr := octEnd + " 23:59:59"
  1616. octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
  1617. octEndStrsUnix := octEndStrs.Unix()
  1618. fmt.Println(octEndStrsUnix)
  1619. novStart := this.GetString("novStart")
  1620. novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
  1621. novStartStrUnix := novStartStr.Unix()
  1622. fmt.Println(novStartStrUnix)
  1623. novEnd := this.GetString("novEnd")
  1624. novEndStr := novEnd + " 23:59:59"
  1625. novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
  1626. novEndStrsUnix := novEndStrs.Unix()
  1627. fmt.Println(novEndStrsUnix)
  1628. decStart := this.GetString("decStart")
  1629. decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
  1630. decStartStrUnix := decStartStr.Unix()
  1631. fmt.Println("12月使", decStartStrUnix)
  1632. decEnd := this.GetString("decEnd")
  1633. decEndStr := decEnd + " 23:59:59"
  1634. decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
  1635. decEndStrsUnix := decEndStrs.Unix()
  1636. fmt.Println(decEndStrsUnix)
  1637. adminUser := this.GetAdminUserInfo()
  1638. orgId := adminUser.CurrentOrgId
  1639. //统计收缩压
  1640. if bloodtype == -1 {
  1641. //统计收缩压一月总数
  1642. januarylist, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1643. //_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1644. //二月
  1645. feblist, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1646. //_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1647. //三月
  1648. marchlist, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1649. //_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1650. //四月
  1651. aprlist, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1652. //_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1653. //五月
  1654. maylist, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1655. //_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1656. //六月
  1657. junlist, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1658. //_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1659. //7月
  1660. jullist, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1661. //_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1662. //8月
  1663. auglist, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1664. //_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1665. //9月
  1666. seplist, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1667. //_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1668. //10月
  1669. octlist, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1670. //_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1671. //11月
  1672. novlist, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1673. //_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1674. //12月
  1675. declist, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1676. //_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1677. if err != nil {
  1678. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1679. return
  1680. }
  1681. this.ServeSuccessJSON(map[string]interface{}{
  1682. "januaryTotal": januaryTotal,
  1683. "januarylist": januarylist,
  1684. "febTotal": febTotal,
  1685. "feblist": feblist,
  1686. "marchTotal": marchTotal,
  1687. "marchlist": marchlist,
  1688. "aprTotal": aprTotal,
  1689. "aprlist": aprlist,
  1690. "mayTotal": mayTotal,
  1691. "maylist": maylist,
  1692. "junTotal": junTotal,
  1693. "junlist": junlist,
  1694. "julTotal": julTotal,
  1695. "jullist": jullist,
  1696. "augTotal": augTotal,
  1697. "auglist": auglist,
  1698. "sepTotal": sepTotal,
  1699. "seplist": seplist,
  1700. "octTotal": octTotal,
  1701. "octlist": octlist,
  1702. "novTotal": novTotal,
  1703. "novlist": novlist,
  1704. "decTotal": decTotal,
  1705. "declist": declist,
  1706. })
  1707. }
  1708. //统计舒张压
  1709. if bloodtype == -2 {
  1710. //统计收缩压一月总数
  1711. januarylist, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1712. //_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
  1713. //二月
  1714. feblist, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1715. //_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
  1716. //三月
  1717. marchlist, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1718. //_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
  1719. //四月
  1720. aprlist, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1721. //_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
  1722. //五月
  1723. maylist, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1724. //_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
  1725. //六月
  1726. junlist, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1727. //_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
  1728. //7月
  1729. jullist, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1730. //_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
  1731. //8月
  1732. auglist, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1733. //_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
  1734. //9月
  1735. seplist, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1736. //_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
  1737. //10月
  1738. octlist, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1739. //_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
  1740. //11月
  1741. novlist, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1742. //_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
  1743. //12月
  1744. declist, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1745. //_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
  1746. if err != nil {
  1747. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1748. return
  1749. }
  1750. this.ServeSuccessJSON(map[string]interface{}{
  1751. "januaryTotal": januaryTotal,
  1752. "januarylist": januarylist,
  1753. "febTotal": febTotal,
  1754. "feblist": feblist,
  1755. "marchTotal": marchTotal,
  1756. "marchlist": marchlist,
  1757. "aprTotal": aprTotal,
  1758. "aprlist": aprlist,
  1759. "mayTotal": mayTotal,
  1760. "maylist": maylist,
  1761. "junTotal": junTotal,
  1762. "junlist": junlist,
  1763. "julTotal": julTotal,
  1764. "jullist": jullist,
  1765. "augTotal": augTotal,
  1766. "auglist": auglist,
  1767. "sepTotal": sepTotal,
  1768. "seplist": seplist,
  1769. "octTotal": octTotal,
  1770. "octlist": octlist,
  1771. "novTotal": novTotal,
  1772. "novlist": novlist,
  1773. "decTotal": decTotal,
  1774. "declist": declist,
  1775. })
  1776. }
  1777. }
  1778. func (this *CommonApiController) GetIdsListTwo() {
  1779. dataBody := make(map[string]interface{}, 0)
  1780. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1781. fmt.Println(err)
  1782. adminInfo := this.GetAdminUserInfo()
  1783. orgId := adminInfo.CurrentOrgId
  1784. patientid, _ := this.GetInt64("patientid")
  1785. idlist := dataBody["ids"].([]interface{})
  1786. var vlist []interface{}
  1787. for _, contagion := range idlist {
  1788. id := int64(contagion.(float64))
  1789. list, _ := service.GetInspectionMoninList(id, orgId, patientid)
  1790. vlist = append(vlist, list)
  1791. }
  1792. if err != nil {
  1793. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  1794. return
  1795. }
  1796. this.ServeSuccessJSON(map[string]interface{}{
  1797. "vlist": vlist,
  1798. })
  1799. }