123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220 |
- package controllers
-
- import (
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "encoding/json"
- "fmt"
- "github.com/jinzhu/gorm"
- "strconv"
- "time"
- )
-
- type CommonApiController struct {
- BaseAuthAPIController
- }
-
- func (this *CommonApiController) GetInspectionMajor() {
- adminInfo := this.GetAdminUserInfo()
- orgid := adminInfo.CurrentOrgId
- major, err := service.GetInspectionMajor(orgid)
- if len(major) == 0 {
- major, _ := service.GetInspectionMajor(0)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": major,
- })
- }
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": major,
- })
- }
-
- func (this *CommonApiController) GetInspectionMinor() {
- id, _ := this.GetInt64("id")
- adminInfo := this.GetAdminUserInfo()
- orgId := adminInfo.CurrentOrgId
- //查询该机构是否存在小项
- major, _ := service.GetInspectionMajor(orgId)
- if len(major) == 0 {
- minor, err := service.GetInspectionMinor(id, 0)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": minor,
- })
- } else {
- minor, err := service.GetInspectionMinor(id, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": minor,
- })
- }
-
- }
-
- func (this *CommonApiController) GetInspectionRange() {
- id, _ := this.GetInt64("id")
- fmt.Println("id", id)
- inspectionRange, err := service.GetInspectionRange(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspectionRange": inspectionRange,
- })
- }
-
- func (this *CommonApiController) SaveConfiguration() {
- adminInfo := this.GetAdminUserInfo()
- orgid := adminInfo.CurrentOrgId
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("err", err)
- inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
-
- inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
-
- minrange := dataBody["min_range"].(string)
-
- largerange := dataBody["large_range"].(string)
- fmt.Println("largerange", largerange)
- sort := dataBody["sort"].(string)
- sorts, err := strconv.ParseInt(sort, 10, 64)
-
- checktype := int64(dataBody["check_type"].(float64))
-
- rangvalue := dataBody["range_value"].(string)
-
- if rangvalue == "0" {
- rangvalue = ""
- }
- // 参与集成的机构根据小项id获取item_id
- itemid, err := service.GetItemid(inspectionMinor)
- //查询小项是否有值
- fmt.Println("小项id", itemid.ItemId)
- major, err := service.GetInspectionMajor(orgid)
- if len(major) == 0 {
- _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
- if errcode == gorm.ErrRecordNotFound {
- standard := models.XtQualityControlStandard{
- InspectionMajor: inspectionmajor,
- InspectionMinor: inspectionMinor,
- MinRange: minrange,
- LargeRange: largerange,
- Sort: sorts,
- UserOrgId: orgid,
- Status: 1,
- RangeType: checktype,
- RangeValue: rangvalue,
- CreatedTime: time.Now().Unix(),
- IsStatus: 1,
- }
- fmt.Println(standard)
- err = service.SaveInspection(&standard)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "standard": standard,
- })
- } else if errcode == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- } else {
- _, errcode := service.GetConfigurationById(inspectionmajor, inspectionMinor, orgid)
- if errcode == gorm.ErrRecordNotFound {
- standard := models.XtQualityControlStandard{
- InspectionMajor: inspectionmajor,
- InspectionMinor: itemid.ItemId,
- MinRange: minrange,
- LargeRange: largerange,
- Sort: sorts,
- UserOrgId: orgid,
- Status: 1,
- RangeType: checktype,
- RangeValue: rangvalue,
- CreatedTime: time.Now().Unix(),
- IsStatus: 1,
- }
- fmt.Println(standard)
- err = service.SaveInspection(&standard)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "standard": standard,
- })
- } else if errcode == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- }
-
- func (this *CommonApiController) GetConfigurationlist() {
- limit, _ := this.GetInt64("limit")
- page, _ := this.GetInt64("page")
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- major, _ := service.GetInspectionMajor(orgid)
- fmt.Println("major22222222222222222222222222222222222222", major)
- if len(major) == 0 {
- configurationlist, total, err := service.GetConfigurationlist(orgid, limit, page)
- pressure, err := service.GetDefaultBloodPressure(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "configurationlist": configurationlist,
- "total": total,
- "pressure": pressure,
- })
- } else {
- configurationlist, total, err := service.GetConfigurationListTwo(orgid, limit, page)
- pressure, err := service.GetDefaultBloodPressure(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "configurationlist": configurationlist,
- "total": total,
- "pressure": pressure,
- })
- }
-
- }
-
- func (this *CommonApiController) GetConfigurationDetail() {
- id, _ := this.GetInt64("id")
- fmt.Println("id是", id)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- detail, err := service.GetConfigurationDetail(id)
- major, err := service.GetInspectionMajor(orgId)
- var vid = 0
- if len(major) == 0 {
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "configurationdetail": detail,
- "vid": vid,
- })
- } else {
- itemId, err := service.GetIdByItemId(detail.InspectionMinor, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "configurationdetail": detail,
- "vid": itemId.ID,
- })
- }
-
- }
-
- func (this *CommonApiController) GetAllInspectionminor() {
-
- info := this.GetAdminUserInfo()
- orgid := info.CurrentOrgId
- major, _ := service.GetInspectionMajor(orgid)
-
- if len(major) == 0 {
- minor, err := service.GetAllInspectionMinor(0)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "minor": minor,
- })
- } else {
- minor, err := service.GetAllInspectionMinor(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "minor": minor,
- })
- }
-
- }
-
- func (this *CommonApiController) UpdateConfiguration() {
- id, _ := this.GetInt64("id")
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
- inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
- minrange := dataBody["min_range"].(string)
- largerange := dataBody["large_range"].(string)
- sort := int64(dataBody["sort"].(float64))
- rangvalue := dataBody["range_value"].(string)
- if rangvalue == "0" {
- rangvalue = ""
- }
- rangtype := int64(dataBody["check_type"].(float64))
- adminInfo := this.GetAdminUserInfo()
- orgId := adminInfo.CurrentOrgId
- configuration, err := service.GetConfigurationByIdTwo(inspectionmajor, inspectionMinor, orgId)
- fmt.Println("err", err)
- if configuration.ID > 0 && configuration.ID != id {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- major, err := service.GetInspectionMajor(orgId)
- if len(major) == 0 {
- standard := models.XtQualityControlStandard{
- InspectionMajor: inspectionmajor,
- InspectionMinor: inspectionMinor,
- MinRange: minrange,
- LargeRange: largerange,
- Sort: sort,
- RangeValue: rangvalue,
- RangeType: rangtype,
- Status: 1,
- UserOrgId: orgId,
- CreatedTime: time.Now().Unix(),
- UpdatedTime: time.Now().Unix(),
- }
- err = service.UpdarteConfiguration(&standard, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "standard": standard,
- })
- } else {
- itemid, _ := service.GetItemid(inspectionMinor)
- standard := models.XtQualityControlStandard{
- InspectionMajor: inspectionmajor,
- InspectionMinor: itemid.ItemId,
- MinRange: minrange,
- LargeRange: largerange,
- Sort: sort,
- RangeValue: rangvalue,
- RangeType: rangtype,
- Status: 1,
- UserOrgId: orgId,
- CreatedTime: time.Now().Unix(),
- UpdatedTime: time.Now().Unix(),
- }
- err = service.UpdarteConfiguration(&standard, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "standard": standard,
- })
- }
-
- }
-
- func (this *CommonApiController) DeleteConfiguration() {
- id, _ := this.GetInt64("id")
- err := service.DeleteConfiguration(id)
- if err != nil {
- this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *CommonApiController) GetAllInspectiondata() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
-
- //查询该机构是否有数据
- _, errcode := service.GetAllInspectionData(orgid)
- if errcode == gorm.ErrRecordNotFound {
- inspection, err := service.GetAllInspectiondatatwo(0)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": inspection,
- })
- } else if errcode == nil {
- inspection, err := service.GetAllInspectiondatatwo(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": inspection,
- })
- }
-
- }
-
- func (this *CommonApiController) SaveCheckConfiguration() {
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("err", err)
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
- //fmt.Println("大项", inspectionmajor)
- frequency := dataBody["frequency"].(string)
- //fmt.Println("凭次", frequency)
- sort := dataBody["sort"].(string)
- sorts, err := strconv.ParseInt(sort, 10, 64)
- //fmt.Println("sort", sort)
- _, errcode := service.GetInspectionMajorById(inspectionmajor, orgid)
- if errcode == gorm.ErrRecordNotFound {
- configuration := models.XtCheckConfiguration{
- InspectionMajor: inspectionmajor,
- InspectionFrequency: frequency,
- Sort: sorts,
- UserOrgId: orgid,
- Status: 1,
- CreatedTime: time.Now().Unix(),
- }
- err := service.CreateCheckConfiguration(&configuration)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "configuration": configuration,
- })
- } else if errcode == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- }
- }
-
- func (this *CommonApiController) GetAllCheckList() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- //fmt.Println("org", orgid)
- page, _ := this.GetInt64("page")
- limit, _ := this.GetInt64("limit")
- major, _ := service.GetInspectionMajor(orgid)
- if len(major) == 0 {
- checklist, total, err := service.GetAllChekcListTwo(orgid, page, limit)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "checklist": checklist,
- "total": total,
- })
- } else {
- checkList, total, err := service.GetAllCheckList(orgid, page, limit)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "checklist": checkList,
- "total": total,
- })
- }
-
- }
-
- func (this *CommonApiController) GetCheckdetail() {
-
- id, _ := this.GetInt64("id")
- detail, err := service.GetCheckDetail(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "checkdetail": detail,
- })
- }
-
- func (this *CommonApiController) UpdateCheck() {
- id, _ := this.GetInt64("id")
- fmt.Println(id)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println(err)
- inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
- //fmt.Println("大项", inspectionmajor)
- frequency := dataBody["frequency"].(string)
- //fmt.Println("凭次", frequency)
- sort := int64(dataBody["sort"].(float64))
- //fmt.Println("sort", sort)
- adminInfo := this.GetAdminUserInfo()
- orgId := adminInfo.CurrentOrgId
- Inspection, err := service.GetInspectionMajorByIdTwo(inspectionmajor, orgId)
- if Inspection.ID > 0 && Inspection.ID != id {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- configuration := models.XtCheckConfiguration{
- InspectionMajor: inspectionmajor,
- InspectionFrequency: frequency,
- Sort: sort,
- }
-
- err = service.UpdateCheck(&configuration, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "configuration": configuration,
- })
- }
-
- func (this *CommonApiController) DeleteCheck() {
- id, _ := this.GetInt64("id")
- err := service.DeleteCheck(id)
- if err != nil {
- this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
- return
- }
- returnData := make(map[string]interface{}, 0)
- returnData["msg"] = "ok"
- this.ServeSuccessJSON(returnData)
- return
- }
-
- func (this *CommonApiController) GetDialysisModeType() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startime := this.GetString("startime")
- endtime := this.GetString("endtime")
-
- startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
- startimes := startTimes.Unix()
-
- endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 00:00:00", loc)
- endtimeData := endtimes.Unix()
-
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
-
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- //统计透析总量
- total, _ := service.GetDialysiTotal(startimes, endtimeData, orgid, lapsetotype, sourcetype)
- //var mode models.PatientPrescriptionCountStruct
- //mode.Count = total
- modeType, err := service.GetDialysisCountMode(startimes, endtimeData, orgid, lapsetotype, sourcetype)
-
- //var total models.PatientPrescriptionCountStruct
- //for _, item := range modeType {
- // total.Count = total.Count + item.Count
- //}
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "total": total,
- "modetype": modeType,
- })
- }
-
- func (this *CommonApiController) GetTotalLapseCount() {
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- startime := this.GetString("startime")
- startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
- startnunix := startTimes.Unix()
- endtime := this.GetString("endtime")
- endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
- endunix := endtimes.Unix()
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
- //统计该机构的转出人数
- patients, err := service.GetTotalRollOutPatients(orgid, startnunix, endunix, lapsetotype, sourcetype)
-
- //统计该机构转出病人
- patienttwo, err := service.GetTotalRollOutPatientsTwo(orgid, startnunix, endunix, lapsetotype, sourcetype)
- count := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- //统计当前机构转出的人数
- rollout, err := service.GetCountRollout(orgid, startnunix, endunix, lapsetotype, sourcetype)
- this.ServeSuccessJSON(map[string]interface{}{
- "patients": patients,
- "count": count,
- "patienttwo": patienttwo,
- "rollout": rollout,
- })
- }
-
- func (this *CommonApiController) GetTotalSexCount() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println("orgid", orgid)
- startime, _ := this.GetInt64("startime")
- fmt.Println("开始时间", startime)
- endtime, _ := this.GetInt64("endtime")
- fmt.Println("结束时间", endtime)
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
- total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
-
- _, totalSex, err := service.GetManPatientTotal(orgid, lapsetotype, sourcetype)
-
- _, totalWoman, err := service.GetWoManPatientTotal(orgid, lapsetotype, sourcetype)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "total": total,
- "totalSex": totalSex,
- "totalWoman": totalWoman,
- })
- }
-
- func (this *CommonApiController) GetTotalInfectiouscount() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println("orgid", orgid)
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- startime := this.GetString("startime")
- startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
- startnunix := startTimes.Unix()
- endtime := this.GetString("endtime")
- endtimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", endtime+" 23:59:59", loc)
- endunix := endtimes.Unix()
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
-
- //统计透析总人数
- total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
- //统计透析人数传染病所占比例
- count, err := service.GetPatientInfectiousCount(orgid, startnunix, endunix, lapsetotype, sourcetype)
- //统计其他
- _, otherTotal, err := service.GetPatientOtherInfectious(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "total": total,
- "count": count,
- "otherTotal": otherTotal,
- })
- }
-
- func (this *CommonApiController) GetTotalAgeCount() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println("orgid", orgid)
- startime, _ := this.GetInt64("startime")
- fmt.Println("开始时间", startime)
- endtime, _ := this.GetInt64("endtime")
- fmt.Println("结束时间", endtime)
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
- //统计透析总人数
- total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
-
- agecount, err := service.GetTotalAgeCount(orgid, lapsetotype, sourcetype)
- //two, err := service.GetTotalAgeCountTwo(orgid, startime, endtime)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "total": total,
- "ageCount": agecount,
- })
- }
-
- func (this *CommonApiController) GetTotalDialysisCount() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println("org", orgid)
- startime, _ := this.GetInt64("startime")
- fmt.Println(startime)
- endtime, _ := this.GetInt64("endtime")
- fmt.Println(endtime)
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- fmt.Println("parseDateErr", parseDateErr)
- nowtime := recordDate.Unix()
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
- //统计透析总人数
- total := service.GetPatientTotalCount(orgid, lapsetotype, sourcetype)
- fmt.Println("total", total)
- //获取该机构下的所有病人数据
- patients, err := service.GetTotalDialysisAgeCount(orgid)
- fmt.Println("patients", patients)
-
- //统计透年龄
- dataage, _ := service.GetDialysisAgeData(orgid, lapsetotype, sourcetype)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "total": total,
- "patients": patients,
- "nowtime": nowtime,
- "dataage": dataage,
- })
- }
-
- func (this *CommonApiController) GetCurentOrgPatients() {
-
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- patients, err := service.GetCurentOrgPatients(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patients": patients,
- })
- }
-
- func (this *CommonApiController) GetDialysislist() {
- startime := this.GetString("startime")
-
- endtime := this.GetString("endtime")
-
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
-
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- entime := endDate.Unix()
-
- page, _ := this.GetInt64("page")
-
- limit, _ := this.GetInt64("limit")
- fmt.Println(limit)
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
- count, _ := service.TotalDialysisCount(statime, entime, orgId)
- dialysislist, total, err := service.GetDialysisList(statime, entime, page, limit, orgId)
- prescriptionList, _ := service.GetAllDialysisList(statime, entime, orgId)
- list, totallist, _ := service.GetDialysisPatientList(statime, entime, page, limit, orgId)
- //获取每个病人每个透析模式的数据(按透析记录)
- modeIdCount, parseDateErr := service.GetModeIdCount(statime, entime, orgId, page, 1000)
-
- //按排班
- scheduleCount, _ := service.GetScheduleModeIdCount(statime, entime, orgId, page, 1000)
-
- scheduleList, _ := service.GetDialysisScheduleList(statime, entime, page, limit, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "dialysislist": dialysislist,
- "total": total,
- "list": list,
- "totallist": totallist,
- "prescriptionList": prescriptionList,
- "count": count,
- "modeIdCount": modeIdCount,
- "scheduleCount": scheduleCount,
- "scheduleList": scheduleList,
- })
- }
-
- func (this *CommonApiController) GetLastSort() {
-
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- standard, err := service.GetLastSort(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "standard": standard,
- })
- }
-
- func (this *CommonApiController) GetLastCheckList() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- checkList, err := service.GetLastCheckList(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "checkList": checkList,
- })
- }
-
- func (this *CommonApiController) GetDialysisDetailById() {
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
- id, _ := this.GetInt64("id")
- fmt.Println("id", id)
- startime := this.GetString("startime")
- fmt.Println(startime)
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
-
- entime := endDate.Unix()
- fmt.Println("开始时间", statime)
- fmt.Println(endtime)
- limit, _ := this.GetInt64("limit")
- fmt.Println("limit", limit)
- page, _ := this.GetInt64("page")
- fmt.Println("page", page)
- patients, total, err := service.GetDialysisDetailById(id, orgId, statime, entime, limit, page)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patients": patients,
- "total": total,
- })
- }
-
- func (this *CommonApiController) GetPrescritionByName() {
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
-
- patientid, _ := this.GetInt64("patientid")
- startime := this.GetString("startime")
- fmt.Println(startime)
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
-
- entime := endDate.Unix()
-
- limit, _ := this.GetInt64("limit")
-
- page, _ := this.GetInt64("page")
-
- patient, total, err := service.GetPrescritionByName(orgId, patientid, statime, entime, limit, page)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patient": patient,
- "total": total,
- })
- }
-
- func (this *CommonApiController) GetStatistics() {
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
-
- startime := this.GetString("start_time")
-
- endtime := this.GetString("end_time")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
-
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- entime := endDate.Unix()
-
- value, _ := this.GetInt64("value")
-
- limit, _ := this.GetInt64("limit")
-
- page, _ := this.GetInt64("page")
-
- modeId, _ := this.GetInt64("mode_id")
- treatinfo, total, err := service.GetTreateInfo(orgId, statime, entime, value, limit, page)
- statistics, ttd, _ := service.GetStatistics(orgId, statime, entime, modeId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "statistics": statistics,
- "ttd": ttd,
- "total": total,
- "treatinfo": treatinfo,
- })
- }
-
- func (this *CommonApiController) GetInspectionTatolCount() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- startime := this.GetString("startime")
- fmt.Println(startime)
- endtime := this.GetString("endtime")
- fmt.Print("endtime", endtime)
- patientid, _ := this.GetInt64("patientid")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- secondQuarterEndStr := endtime + " 23:59:59"
- secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
- entime := secondQuarterEnds.Unix()
-
- references, err := service.GetInspectionTotalCount(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- counts, err := service.GetInspectionProjectCount(orgid, statime, entime, patientid)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "Inspection": references,
- "counts": counts,
- })
- }
-
- func (this *CommonApiController) GetInspectionDetailById() {
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
- id, _ := this.GetInt64("id")
- fmt.Println("id", id)
- startime := this.GetString("startime")
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- secondQuarterEndStr := endtime + " 23:59:59"
- secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
- entime := secondQuarterEnds.Unix()
- patientdetail, err := service.GetInspectionDetailById(id, orgId, statime, entime)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patientdetail": patientdetail,
- })
- }
-
- func (this *CommonApiController) GetSearchPatientInfo() {
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
- //keyword := this.GetString("keyword")
- //fmt.Println("keyword", keyword)
- patientid, _ := this.GetInt64("patientid")
- startime := this.GetString("startime")
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- //entime := endDate.Unix()
- //fmt.Println("结束日期", entime)
- secondQuarterEndStr := endtime + " 23:59:59"
- secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
- entime := secondQuarterEnds.Unix()
- PatientsInfo, err := service.GetSearchPatientInfo(orgId, patientid, statime, entime)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "PatientsInfo": PatientsInfo,
- })
- }
-
- func (this *CommonApiController) GetAllMajorInspection() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- inspection, err := service.GetMajorInspectionByOrgid(orgid)
- if len(inspection) == 0 {
- inspect, err := service.GetDefaultByOrgId(0)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": inspect,
- })
- } else {
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "inspection": inspection,
- })
- }
- }
-
- func (this *CommonApiController) GetPatientList() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- startime := this.GetString("startime")
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- // //entime := endDate.Unix()
- endTimeYMDHmsStr := endtime + " 23:59:59"
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
- entime := endDate.Unix()
- fmt.Println("结束日期", entime)
- limit, _ := this.GetInt64("limit")
- fmt.Println("limit", limit)
- page, _ := this.GetInt64("page")
- fmt.Println("page", page)
- patientInfo, total, err := service.GetPatientListData(orgid, statime, entime, limit, page)
-
- info, _ := service.GetPatientListInfo(orgid, statime, entime, limit, page)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "patientInfo": patientInfo,
- "total": total,
- "list": info,
- })
- }
-
- func (this *CommonApiController) GetPatientDetailCheck() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- id, _ := this.GetInt64("id")
- startime := this.GetString("startime")
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- //endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- //entime := endDate.Unix()
- //fmt.Println("结束日期", entime)
- endTimeYMDHmsStr := endtime + " 23:59:59"
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
- entime := endDate.Unix()
- checkDetail, err := service.GetPatientDetailCheck(id, orgid, statime, entime)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "checkDetail": checkDetail,
- })
- }
-
- func (this *CommonApiController) GetSearchDetailCheck() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- keyword := this.GetString("keyword")
- startime := this.GetString("startime")
- endtime := this.GetString("endtime")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- entime := endDate.Unix()
- fmt.Println("结束日期", entime)
- checkDetail, err := service.GetSearchDetailCheck(orgid, keyword, statime, entime)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "checkDetail": checkDetail,
- })
- }
-
- func (this *CommonApiController) GetNormData() {
- orgid := this.GetAdminUserInfo().CurrentOrgId
- //获取系统数据
- normdata, err := service.GetNormDataByOrgId(orgid)
-
- //获取血压数据
- bloodPressure, err := service.GetDefaultBloodPressure(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "normdata": normdata,
- "bloodPressure": bloodPressure,
- })
- //if len(normdata) == 0 {
- // normdata, err := service.GetNormData(0)
- // if err != nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- // }
- // this.ServeSuccessJSON(map[string]interface{}{
- // "normdata": normdata,
- // })
- //} else {
- // normdata, err := service.GetNormDataByOrgId(orgid)
- // if err != nil {
- // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- // return
- // }
- // this.ServeSuccessJSON(map[string]interface{}{
- // "normdata": normdata,
- // })
- //}
-
- }
-
- func (this *CommonApiController) GetFirstQuarter() {
- orgid := this.GetAdminUserInfo().CurrentOrgId
- lapseto, _ := this.GetInt64("lapseto")
- origin, _ := this.GetInt64("origin")
-
- startime := this.GetString("startime")
-
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
-
- endtime := this.GetString("endtime")
-
- endTimeYMDHmsStr := endtime + " 23:59:59"
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
- entime := endDate.Unix()
-
- //统计数值类型的数据
- count, err := service.GetQuarterTotalCount(orgid, statime, entime, lapseto, origin)
-
- //统计rang_type== 2
- countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto, origin)
-
- //获取收缩压数据
- systolic, systolicTotal, parseDateErr := service.GetSystolicBloodPressureTwo(orgid, statime, entime, lapseto, origin)
- //统计收缩压合格的数据
- //systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
-
- //获取舒张压数据
- diastolic, diastotal, parseDateErr := service.GetDiastolicBloodPressureTwo(orgid, statime, entime, lapseto, origin)
- //获取合格舒张压数据
- //diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
- normData, _ := service.GetNormData(orgid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "count": count,
- "countwo": countwo,
- "systolic": systolic,
- "systolicTotal": systolicTotal,
- "diastolic": diastolic,
- "diastotal": diastotal,
- "normData": normData,
- })
- }
-
- func (this *CommonApiController) GetProjectList() {
- startime := this.GetString("startime")
- fmt.Println("startime", startime)
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
- fmt.Println("开始时间", statime)
- endtime := this.GetString("endtime")
- fmt.Println("endtime", endtime)
- endTimeYMDHmsStr := endtime + " 23:59:59"
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
- entime := endDate.Unix()
-
- adminInfo := this.GetAdminUserInfo()
- orgid := adminInfo.CurrentOrgId
-
- lapseto, _ := this.GetInt64("lapseto")
- fmt.Println("lapseto", lapseto)
- itemtype, _ := this.GetInt64("itemtype")
- fmt.Println("type", itemtype)
- modetype, _ := this.GetInt64("modetype")
- fmt.Println("modetype", modetype)
-
- firstQuarterStart := this.GetString("first_quarter_start")
- firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
- firstQuarterStartUnix := firstQuarterStartStr.Unix()
-
- fisrtQuarterEnd := this.GetString("first_qurter_end")
- fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
- fisrtQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
- fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
-
- secondeQuarterStart := this.GetString("second_qurter_start")
- secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
- secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
-
- secondQuarterEnd := this.GetString("second_qurter_end")
- secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
- secondQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
- secondQuarterEndStrUnix := secondQuarterEnds.Unix()
- fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
-
- threeQuarterStart := this.GetString("three_qurter_start")
- threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
- threeQuarterStartUnix := threeQuarterStartStr.Unix()
-
- threeQuarterEnd := this.GetString("three_qurter_end")
- threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
- threeQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
- threeQuarterEndStrUnix := threeQuarterEnds.Unix()
-
- fourQuarterStart := this.GetString("four_qurter_start")
- fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
- fourQuarterStartUnix := fourQuarterStartStr.Unix()
-
- fourQuarterEnd := this.GetString("four_qurter_end")
- fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
- fourQuarterEnds, parseDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
- fourQuarterEndStrUnix := fourQuarterEnds.Unix()
- //fmt.Println("第四季度结束时间", fourQuarterEndStrUnix)
- rangetype, parseDateErr := this.GetInt64("range_type")
- //按季度统计
- if rangetype == 1 {
- //统计总共
- list, err := service.GetProjectList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
- //统计达标个数
- standList, err := service.GetProjectStandList(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "standList": standList,
- })
- }
-
- if rangetype == 2 {
- list, err := service.GetProjectListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
- //统计达标个数
- standList, err := service.GetProjectStandListOne(orgid, lapseto, modetype, statime, entime, firstQuarterStartUnix, fisrtQuarterEndStrUnix, secondeQuarterStartUnix, secondQuarterEndStrUnix, threeQuarterStartUnix, threeQuarterEndStrUnix, fourQuarterStartUnix, fourQuarterEndStrUnix)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "standList": standList,
- })
- }
- }
-
- func (this *CommonApiController) GetMonthProjectList() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
-
- lapseto, _ := this.GetInt64("lapseto")
- fmt.Println("lapseto", lapseto)
- itemtype, _ := this.GetInt64("itemtype")
- fmt.Println("itemtype", itemtype)
- modetype, _ := this.GetInt64("modetype")
-
- januaryStart := this.GetString("januaryStart")
-
- januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
- januaryStartStrUnix := januaryStartStr.Unix()
-
- januaryEnd := this.GetString("januaryEnd")
-
- januaryEndStr := januaryEnd + " 23:59:59"
- januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
- januaryEndStrUnix := januaryEndStrs.Unix()
-
- febStart := this.GetString("febStart")
-
- febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
- febStartStrStrUnix := febStartStr.Unix()
-
- febEnd := this.GetString("febEnd")
-
- febEndStr := febEnd + " 23:59:59"
- febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
- febEndStrUnix := febEndStrs.Unix()
-
- marchStart := this.GetString("marchStart")
-
- marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
- marchStartStrUnix := marchStartStr.Unix()
-
- marchEnd := this.GetString("marchEnd")
-
- marchEndStr := marchEnd + " 23:59:59"
- marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
- marchEndStrUnix := marchEndStrs.Unix()
-
- aprStart := this.GetString("aprStart")
-
- aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
- aprStartStrUnix := aprStartStr.Unix()
-
- aprEnd := this.GetString("aprEnd")
-
- aprEndStr := aprEnd + " 23:59:59"
- aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
- aprEndStrsUnix := aprEndStrs.Unix()
-
- mayStart := this.GetString("mayStart")
-
- mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
- mayStartStrUnix := mayStartStr.Unix()
-
- mayEnd := this.GetString("mayEnd")
-
- mayEndStr := mayEnd + " 23:59:59"
- mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
- mayEndStrsUnix := mayEndStrs.Unix()
-
- junStart := this.GetString("junStart")
-
- junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
- junStartStrUnix := junStartStr.Unix()
-
- junEnd := this.GetString("junEnd")
-
- junEndStr := junEnd + " 23:59:59"
- junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
- junEndStrsUnix := junEndStrs.Unix()
-
- julStart := this.GetString("julStart")
-
- julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
- julStartStrUnix := julStartStr.Unix()
-
- julEnd := this.GetString("julEnd")
-
- julEndStr := julEnd + " 23:59:59"
- julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
- julEndStrsUnix := julEndStrs.Unix()
-
- augStart := this.GetString("augStart")
-
- augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
- augStartStrUnix := augStartStr.Unix()
-
- augEnd := this.GetString("augEnd")
-
- augEndStr := augEnd + " 23:59:59"
- augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
- augEndStrsUnix := augEndStrs.Unix()
-
- sepStart := this.GetString("sepStart")
-
- sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
- sepStartStrUnix := sepStartStr.Unix()
-
- sepEnd := this.GetString("sepEnd")
-
- sepEndStr := sepEnd + " 23:59:59"
- sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
- sepEndStrsUnix := sepEndStrs.Unix()
-
- octStart := this.GetString("octStart")
-
- octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
- octStartStrUnix := octStartStr.Unix()
-
- octEnd := this.GetString("octEnd")
-
- octEndStr := octEnd + " 23:59:59"
- octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
- octEndStrsUnix := octEndStrs.Unix()
-
- novStart := this.GetString("novStart")
-
- novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
- novStartStrUnix := novStartStr.Unix()
-
- novEnd := this.GetString("novEnd")
-
- novEndStr := novEnd + " 23:59:59"
- novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
- novEndStrsUnix := novEndStrs.Unix()
-
- decStart := this.GetString("decStart")
-
- decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
- decStartStrUnix := decStartStr.Unix()
- fmt.Println("12月使", decStartStrUnix)
- decEnd := this.GetString("decEnd")
-
- decEndStr := decEnd + " 23:59:59"
- decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
- decEndStrsUnix := decEndStrs.Unix()
-
- rangetype, _ := this.GetInt64("range_type")
-
- if rangetype == 1 {
- //统计总共
- 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)
- //统计不合格
- 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)
- fmt.Println("monthnolist", monthNolist)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "monthlist": monthlist,
- "monthNolist": monthNolist,
- })
- }
-
- if rangetype == 2 {
- 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)
- 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)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "monthlist": monthlist,
- "monthNolist": monthNolist,
- })
- }
-
- }
-
- func (this *CommonApiController) GetPatientscontrol() {
-
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
-
- lapstor, _ := this.GetInt64("lapstor")
-
- startime := this.GetString("startime")
-
- startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
- startimeStrUnix := startimeStr.Unix()
-
- endtime := this.GetString("endtime")
- fmt.Println("结束时间", endtime)
- endtimeStr := endtime + " 23:59:59"
- endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
- endtimeStrsUnix := endtimeStrs.Unix()
-
- page, _ := this.GetInt64("page")
-
- limit, _ := this.GetInt64("limit")
-
- patients, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
- control, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
-
- infectiousControl, err := service.GetInfectiousControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "patients": patients,
- "total": total,
- "control": control,
- "infectiousControl": infectiousControl,
- })
- }
-
- func (this *CommonApiController) GetCartogramList() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- //fmt.Println("orgid", orgid)
- lapstor, _ := this.GetInt64("lapstor")
- fmt.Println("lapstor", lapstor)
- startime := this.GetString("startime")
- //fmt.Println("开始时间", startime)
- startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
- startimeStrUnix := startimeStr.Unix()
- //fmt.Println("时间搓", startimeStrUnix)
- endtime := this.GetString("endtime")
- //fmt.Println("结束时间", endtime)
- endtimeStr := endtime + " 23:59:59"
- endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
- endtimeStrsUnix := endtimeStrs.Unix()
- //fmt.Println("结束时间搓", endtimeStrsUnix)
- //limit, _ := this.GetInt64("limit")
- //page, _ := this.GetInt64("page")
-
- //统计总共
- _, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
- //fmt.Println("total=================", total)
- //统计rangetype= 1
- _, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
- //fmt.Println(standtotal)
- _, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
- //fmt.Println(standtotalOne)
- //cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
- //infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
- //_, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "total": total,
- "standtotal": standtotal,
- "standtotalOne": standtotalOne,
- })
- }
-
- func (this *CommonApiController) GetPatientContor() {
-
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println(orgid)
- lapstor, _ := this.GetInt64("lapstor")
- fmt.Println("lapstor", lapstor)
- patientid, _ := this.GetInt64("patientid")
- startime := this.GetString("startime")
-
- startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
- startimeStrUnix := startimeStr.Unix()
-
- endtime := this.GetString("endtime")
- //fmt.Println("结束时间", endtime)
- endtimeStr := endtime + " 23:59:59"
- endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
- endtimeStrsUnix := endtimeStrs.Unix()
-
- patients, err := service.GetPatientNames(orgid, patientid)
- patientcontorDetail, err := service.GetLastPatientsControlTwo(orgid, patientid, startimeStrUnix, endtimeStrsUnix)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "patientcontorDetail": patientcontorDetail,
- "name": patients.Name,
- })
- }
-
- func (this *CommonApiController) GetQualityControl() {
-
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println(orgid)
- patientid, _ := this.GetInt64("patientid")
- startime, _ := this.GetInt64("startime")
- //fmt.Println("startime", startime)
- endtime, _ := this.GetInt64("endtime")
- //fmt.Println("endtime", endtime)
- itemid, _ := this.GetInt64("itemid")
- //fmt.Println("itemid", itemid)
- inspectdate, _ := this.GetInt64("inspectdate")
-
- list, err := service.GetQualityControlById(orgid, patientid, startime, endtime, itemid, inspectdate)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "list": list,
- })
- }
-
- func (this *CommonApiController) GetTreatlist() {
- adminuser := this.GetAdminUserInfo()
- orgId := adminuser.CurrentOrgId
- startime := this.GetString("start_time")
-
- endtime := this.GetString("end_time")
- startDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", startime)
- fmt.Println("parseDateErr", parseDateErr)
- statime := startDate.Unix()
-
- endDate, _ := utils.ParseTimeStringToTime("2006-01-02", endtime)
- entime := endDate.Unix()
-
- value, _ := this.GetInt64("value")
- fmt.Println("value", value)
-
- list, err := service.GetTreatList(orgId, statime, entime, value)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "list": list,
- })
- }
-
- func (this *CommonApiController) GetPatientComplianceDetail() {
- adminUser := this.GetAdminUserInfo()
- orgid := adminUser.CurrentOrgId
- fmt.Println(orgid)
- patientid, _ := this.GetInt64("patientid")
- startime, _ := this.GetInt64("startime")
- fmt.Println("startime", startime)
- endtime, _ := this.GetInt64("endtime")
- fmt.Println("endtime", endtime)
- itemid, _ := this.GetInt64("itemid")
- fmt.Println("itemid", itemid)
-
- list, err := service.GetPatientComplianceDetail(orgid, patientid, startime, endtime, itemid)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "list": list,
- })
- }
-
- func (this *CommonApiController) GetBloodPressureDetail() {
- id, _ := this.GetInt64("id")
- blooddetail, err := service.GetBloodPressureDetail(id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "blooddetail": blooddetail,
- })
- }
-
- func (this *CommonApiController) UpdateBloodPrussre() {
- id, _ := this.GetInt64("id")
- fmt.Println("id", id)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("err", err)
- inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
- fmt.Println("inspectionmajor", inspectionmajor)
- inspectionminor := int64(dataBody["inspectionMinor"].(float64))
- fmt.Println("inspectionminor", inspectionminor)
- largerange := dataBody["large_range"].(string)
- fmt.Println(largerange)
- minrange := dataBody["min_range"].(string)
- fmt.Print(minrange)
- sort := int64(dataBody["sort"].(float64))
- fmt.Print("sort", sort)
- standard := models.XtQualityControlStandard{
- InspectionMajor: inspectionmajor,
- InspectionMinor: inspectionminor,
- MinRange: minrange,
- Sort: sort,
- LargeRange: largerange,
- }
- err = service.UpdateBloodPressure(&standard, id)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "standard": standard,
- })
- }
-
- func (this *CommonApiController) GetBloodPressureList() {
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
- bloodType, _ := this.GetInt64("bloodType")
- fmt.Println(bloodType)
- firstQuarterStart := this.GetString("first_quarter_start")
- firstQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", firstQuarterStart)
- firstQuarterStartUnix := firstQuarterStartStr.Unix()
- fmt.Println("第一季度", firstQuarterStartUnix)
- fisrtQuarterEnd := this.GetString("first_qurter_end")
- fisrtQuarterEndStr := fisrtQuarterEnd + " 23:59:59"
- fisrtQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fisrtQuarterEndStr)
- fisrtQuarterEndStrUnix := fisrtQuarterEnds.Unix()
- fmt.Println("fisrtQuarterEndStrUnix", fisrtQuarterEndStrUnix)
- secondeQuarterStart := this.GetString("second_qurter_start")
- secondeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", secondeQuarterStart)
- secondeQuarterStartUnix := secondeQuarterStartStr.Unix()
- fmt.Println("secondeQuarterStartUnix", secondeQuarterStartUnix)
- secondQuarterEnd := this.GetString("second_qurter_end")
- secondQuarterEndStr := secondQuarterEnd + " 23:59:59"
- secondQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", secondQuarterEndStr)
- secondQuarterEndStrUnix := secondQuarterEnds.Unix()
- fmt.Println("第二季度结束时间", secondQuarterEndStrUnix)
-
- threeQuarterStart := this.GetString("three_qurter_start")
- threeQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", threeQuarterStart)
- threeQuarterStartUnix := threeQuarterStartStr.Unix()
- fmt.Println("第三季度", threeQuarterStartUnix)
- threeQuarterEnd := this.GetString("three_qurter_end")
- threeQuarterEndStr := threeQuarterEnd + " 23:59:59"
- threeQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", threeQuarterEndStr)
- threeQuarterEndStrUnix := threeQuarterEnds.Unix()
- fmt.Println("第三季度", threeQuarterEndStrUnix)
- fourQuarterStart := this.GetString("four_qurter_start")
- fourQuarterStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", fourQuarterStart)
- fourQuarterStartUnix := fourQuarterStartStr.Unix()
- fmt.Println("第四季度", fourQuarterStartUnix)
- fourQuarterEnd := this.GetString("four_qurter_end")
- fourQuarterEndStr := fourQuarterEnd + " 23:59:59"
- fourQuarterEnds, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", fourQuarterEndStr)
- fourQuarterEndStrUnix := fourQuarterEnds.Unix()
- fmt.Println("第四季度", fourQuarterEndStrUnix)
- if bloodType == -1 {
- //统计收缩压第一季度的总数
- firstList, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
- //统计收缩压第一季合格的总数
- //_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
- //统计第二季收缩压总数
- secondelist, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
- //第二季度合格总数
- //_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
- //统计第三季收缩压总数
- threelist, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
- //第三季度合格数
- //_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
- //第四季度总数
- fourlist, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
- //第四季度合格总数
- //_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "firstTotal": firstTotal,
- "firstList": firstList,
- "secondelist": secondelist,
- "secondeTotal": secondeTotal,
- "threelist": threelist,
- "threeTotal": threeTotal,
- "fourTotal": fourTotal,
- "fourlist": fourlist,
- })
- }
-
- if bloodType == -2 {
- //统计舒张压第一季度的总数
- firstList, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
- //_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
- secondelist, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
- //_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
- threelist, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
- //_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
- fourlist, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
- //_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "firstTotal": firstTotal,
- "firstList": firstList,
- "secondelist": secondelist,
- "secondeTotal": secondeTotal,
- "threelist": threelist,
- "threeTotal": threeTotal,
- "fourTotal": fourTotal,
- "fourlist": fourlist,
- })
- }
- }
-
- func (this *CommonApiController) GetMonthBloodList() {
-
- bloodtype, _ := this.GetInt64("bloodType")
- fmt.Println(bloodtype)
- januaryStart := this.GetString("januaryStart")
-
- januaryStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", januaryStart)
- januaryStartStrUnix := januaryStartStr.Unix()
- fmt.Println(januaryStartStrUnix)
- januaryEnd := this.GetString("januaryEnd")
-
- januaryEndStr := januaryEnd + " 23:59:59"
- januaryEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", januaryEndStr)
- januaryEndStrUnix := januaryEndStrs.Unix()
- fmt.Println(januaryEndStrUnix)
- febStart := this.GetString("febStart")
-
- febStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", febStart)
- febStartStrStrUnix := febStartStr.Unix()
- fmt.Println(febStartStrStrUnix)
- febEnd := this.GetString("febEnd")
-
- febEndStr := febEnd + " 23:59:59"
- febEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", febEndStr)
- febEndStrUnix := febEndStrs.Unix()
- fmt.Println(febEndStrUnix)
- marchStart := this.GetString("marchStart")
-
- marchStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", marchStart)
- marchStartStrUnix := marchStartStr.Unix()
- fmt.Println(marchStartStrUnix)
- marchEnd := this.GetString("marchEnd")
-
- marchEndStr := marchEnd + " 23:59:59"
- marchEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", marchEndStr)
- marchEndStrUnix := marchEndStrs.Unix()
- fmt.Println(marchEndStrUnix)
- aprStart := this.GetString("aprStart")
-
- aprStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", aprStart)
- aprStartStrUnix := aprStartStr.Unix()
- fmt.Println(aprStartStrUnix)
- aprEnd := this.GetString("aprEnd")
-
- aprEndStr := aprEnd + " 23:59:59"
- aprEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", aprEndStr)
- aprEndStrsUnix := aprEndStrs.Unix()
- fmt.Println(aprEndStrsUnix)
- mayStart := this.GetString("mayStart")
-
- mayStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", mayStart)
- mayStartStrUnix := mayStartStr.Unix()
- fmt.Println(mayStartStrUnix)
- mayEnd := this.GetString("mayEnd")
-
- mayEndStr := mayEnd + " 23:59:59"
- mayEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", mayEndStr)
- mayEndStrsUnix := mayEndStrs.Unix()
- fmt.Println(mayEndStrsUnix)
- junStart := this.GetString("junStart")
-
- junStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", junStart)
- junStartStrUnix := junStartStr.Unix()
- fmt.Println(junStartStrUnix)
- junEnd := this.GetString("junEnd")
-
- junEndStr := junEnd + " 23:59:59"
- junEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", junEndStr)
- junEndStrsUnix := junEndStrs.Unix()
- fmt.Println(junEndStrsUnix)
- julStart := this.GetString("julStart")
-
- julStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", julStart)
- julStartStrUnix := julStartStr.Unix()
- fmt.Println(julStartStrUnix)
- julEnd := this.GetString("julEnd")
-
- julEndStr := julEnd + " 23:59:59"
- julEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", julEndStr)
- julEndStrsUnix := julEndStrs.Unix()
- fmt.Println(julEndStrsUnix)
- augStart := this.GetString("augStart")
-
- augStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", augStart)
- augStartStrUnix := augStartStr.Unix()
- fmt.Print(augStartStrUnix)
- augEnd := this.GetString("augEnd")
-
- augEndStr := augEnd + " 23:59:59"
- augEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", augEndStr)
- augEndStrsUnix := augEndStrs.Unix()
- fmt.Println(augEndStrsUnix)
- sepStart := this.GetString("sepStart")
-
- sepStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", sepStart)
- sepStartStrUnix := sepStartStr.Unix()
- fmt.Println(sepStartStrUnix)
- sepEnd := this.GetString("sepEnd")
-
- sepEndStr := sepEnd + " 23:59:59"
- sepEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", sepEndStr)
- sepEndStrsUnix := sepEndStrs.Unix()
- fmt.Println(sepEndStrsUnix)
- octStart := this.GetString("octStart")
-
- octStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", octStart)
- octStartStrUnix := octStartStr.Unix()
- fmt.Println(octStartStrUnix)
- octEnd := this.GetString("octEnd")
-
- octEndStr := octEnd + " 23:59:59"
- octEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", octEndStr)
- octEndStrsUnix := octEndStrs.Unix()
- fmt.Println(octEndStrsUnix)
- novStart := this.GetString("novStart")
-
- novStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", novStart)
- novStartStrUnix := novStartStr.Unix()
- fmt.Println(novStartStrUnix)
- novEnd := this.GetString("novEnd")
-
- novEndStr := novEnd + " 23:59:59"
- novEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", novEndStr)
- novEndStrsUnix := novEndStrs.Unix()
- fmt.Println(novEndStrsUnix)
- decStart := this.GetString("decStart")
-
- decStartStr, _ := utils.ParseTimeStringToTime("2006-01-02", decStart)
- decStartStrUnix := decStartStr.Unix()
- fmt.Println("12月使", decStartStrUnix)
- decEnd := this.GetString("decEnd")
-
- decEndStr := decEnd + " 23:59:59"
- decEndStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", decEndStr)
- decEndStrsUnix := decEndStrs.Unix()
- fmt.Println(decEndStrsUnix)
-
- adminUser := this.GetAdminUserInfo()
- orgId := adminUser.CurrentOrgId
- //统计收缩压
- if bloodtype == -1 {
- //统计收缩压一月总数
- januarylist, januaryTotal, err := service.GetSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
- //_, januaryStandTotal, err := service.GetStandSystolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
-
- //二月
- feblist, febTotal, err := service.GetSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
- //_, febStandTotal, err := service.GetStandSystolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
-
- //三月
- marchlist, marchTotal, err := service.GetSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
- //_, marchStandTotal, err := service.GetStandSystolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
-
- //四月
- aprlist, aprTotal, err := service.GetSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
- //_, aprStandTotal, err := service.GetStandSystolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
-
- //五月
- maylist, mayTotal, err := service.GetSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
- //_, mayStandTotal, err := service.GetStandSystolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
-
- //六月
- junlist, junTotal, err := service.GetSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
- //_, junStandTotal, err := service.GetStandSystolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
- //7月
- jullist, julTotal, err := service.GetSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
- //_, julStandTotal, err := service.GetStandSystolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
-
- //8月
- auglist, augTotal, err := service.GetSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
- //_, augStandTotal, err := service.GetStandSystolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
-
- //9月
- seplist, sepTotal, err := service.GetSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
- //_, sepStandTotal, err := service.GetStandSystolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
- //10月
- octlist, octTotal, err := service.GetSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
- //_, octStandTotal, err := service.GetStandSystolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
- //11月
- novlist, novTotal, err := service.GetSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
- //_, novStandTotal, err := service.GetStandSystolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
- //12月
- declist, decTotal, err := service.GetSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
- //_, decStandTotal, err := service.GetStandSystolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "januaryTotal": januaryTotal,
- "januarylist": januarylist,
- "febTotal": febTotal,
- "feblist": feblist,
- "marchTotal": marchTotal,
- "marchlist": marchlist,
- "aprTotal": aprTotal,
- "aprlist": aprlist,
- "mayTotal": mayTotal,
- "maylist": maylist,
- "junTotal": junTotal,
- "junlist": junlist,
- "julTotal": julTotal,
- "jullist": jullist,
- "augTotal": augTotal,
- "auglist": auglist,
- "sepTotal": sepTotal,
- "seplist": seplist,
- "octTotal": octTotal,
- "octlist": octlist,
- "novTotal": novTotal,
- "novlist": novlist,
- "decTotal": decTotal,
- "declist": declist,
- })
- }
-
- //统计舒张压
- if bloodtype == -2 {
- //统计收缩压一月总数
- januarylist, januaryTotal, err := service.GetDiastolicBloodPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
- //_, januaryStandTotal, err := service.GetDiastolicStandPressure(orgId, januaryStartStrUnix, januaryEndStrUnix)
-
- //二月
- feblist, febTotal, err := service.GetDiastolicBloodPressure(orgId, febStartStrStrUnix, febEndStrUnix)
- //_, febStandTotal, err := service.GetDiastolicStandPressure(orgId, febStartStrStrUnix, febEndStrUnix)
-
- //三月
- marchlist, marchTotal, err := service.GetDiastolicBloodPressure(orgId, marchStartStrUnix, marchEndStrUnix)
- //_, marchStandTotal, err := service.GetDiastolicStandPressure(orgId, marchStartStrUnix, marchEndStrUnix)
-
- //四月
- aprlist, aprTotal, err := service.GetDiastolicBloodPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
- //_, aprStandTotal, err := service.GetDiastolicStandPressure(orgId, aprStartStrUnix, aprEndStrsUnix)
-
- //五月
- maylist, mayTotal, err := service.GetDiastolicBloodPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
- //_, mayStandTotal, err := service.GetDiastolicStandPressure(orgId, mayStartStrUnix, mayEndStrsUnix)
-
- //六月
- junlist, junTotal, err := service.GetDiastolicBloodPressure(orgId, junStartStrUnix, junEndStrsUnix)
- //_, junStandTotal, err := service.GetDiastolicStandPressure(orgId, junStartStrUnix, junEndStrsUnix)
- //7月
- jullist, julTotal, err := service.GetDiastolicBloodPressure(orgId, julStartStrUnix, julEndStrsUnix)
- //_, julStandTotal, err := service.GetDiastolicStandPressure(orgId, julStartStrUnix, julEndStrsUnix)
-
- //8月
- auglist, augTotal, err := service.GetDiastolicBloodPressure(orgId, augStartStrUnix, augEndStrsUnix)
- //_, augStandTotal, err := service.GetDiastolicStandPressure(orgId, augStartStrUnix, augEndStrsUnix)
-
- //9月
- seplist, sepTotal, err := service.GetDiastolicBloodPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
- //_, sepStandTotal, err := service.GetDiastolicStandPressure(orgId, sepStartStrUnix, sepEndStrsUnix)
- //10月
- octlist, octTotal, err := service.GetDiastolicBloodPressure(orgId, octStartStrUnix, octEndStrsUnix)
- //_, octStandTotal, err := service.GetDiastolicStandPressure(orgId, octStartStrUnix, octEndStrsUnix)
- //11月
- novlist, novTotal, err := service.GetDiastolicBloodPressure(orgId, novStartStrUnix, novEndStrsUnix)
- //_, novStandTotal, err := service.GetDiastolicStandPressure(orgId, novStartStrUnix, novEndStrsUnix)
- //12月
- declist, decTotal, err := service.GetDiastolicBloodPressure(orgId, decStartStrUnix, decEndStrsUnix)
- //_, decStandTotal, err := service.GetDiastolicStandPressure(orgId, decStartStrUnix, decEndStrsUnix)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "januaryTotal": januaryTotal,
- "januarylist": januarylist,
- "febTotal": febTotal,
- "feblist": feblist,
- "marchTotal": marchTotal,
- "marchlist": marchlist,
- "aprTotal": aprTotal,
- "aprlist": aprlist,
- "mayTotal": mayTotal,
- "maylist": maylist,
- "junTotal": junTotal,
- "junlist": junlist,
- "julTotal": julTotal,
- "jullist": jullist,
- "augTotal": augTotal,
- "auglist": auglist,
- "sepTotal": sepTotal,
- "seplist": seplist,
- "octTotal": octTotal,
- "octlist": octlist,
- "novTotal": novTotal,
- "novlist": novlist,
- "decTotal": decTotal,
- "declist": declist,
- })
- }
- }
-
- func (this *CommonApiController) GetIdsListTwo() {
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println(err)
- adminInfo := this.GetAdminUserInfo()
- orgId := adminInfo.CurrentOrgId
- patientid, _ := this.GetInt64("patientid")
- idlist := dataBody["ids"].([]interface{})
-
- var vlist []interface{}
- for _, contagion := range idlist {
- id := int64(contagion.(float64))
- list, _ := service.GetInspectionMoninList(id, orgId, patientid)
- vlist = append(vlist, list)
- }
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "vlist": vlist,
- })
-
- }
-
- func (this *CommonApiController) GetTreatModeList() {
-
- start_time, _ := this.GetInt64("start_time")
- end_time, _ := this.GetInt64("end_time")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
- list, err := service.GetTreatModeList(start_time, end_time, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
-
- func (this *CommonApiController) GetCountModeId() {
-
- start_time, _ := this.GetInt64("start_time")
- end_time, _ := this.GetInt64("end_time")
- mode_id, _ := this.GetInt64("mode_id")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
-
- modeCount, err := service.GetCountModeId(start_time, end_time, mode_id, orgId)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "modeCount": modeCount,
- })
- }
-
- func (this *CommonApiController) GetRolloutCount() {
-
- start_time, _ := this.GetInt64("start_time")
- end_time, _ := this.GetInt64("end_time")
- lapsetotype, _ := this.GetInt64("lapsetotype")
- sourcetype, _ := this.GetInt64("sourcetype")
- adminUserInfo := this.GetAdminUserInfo()
- orgId := adminUserInfo.CurrentOrgId
-
- //统计当前机构转出的人数
- rollout, err := service.GetCountRollout(orgId, start_time, end_time, lapsetotype, sourcetype)
-
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- return
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "rollout": rollout,
- })
- }
-
- func (this *CommonApiController) GetCheckExamine() {
- //check_type, _ := this.GetInt64("check_type")
- //start_time, _ := this.GetInt64("start_time")
- //end_time, _ := this.GetInt64("end_time")
- //total, _ := service.GetAllPatientCount(this.GetAdminUserInfo().CurrentOrgId)
- //xcg_total := service.GetCheckExaminePercent(start_time, end_time, this.GetAdminUserInfo().CurrentOrgId, 1) //血常规
- //xysh_total := service.GetCheckExaminePercent(start_time, end_time, this.GetAdminUserInfo().CurrentOrgId, 2) //血液生化
- //ipth_total := service.GetCheckExaminePercent(start_time, end_time, this.GetAdminUserInfo().CurrentOrgId, 3) //全段甲状旁腺激素
- //xqtdb_total := service.GetCheckExaminePercent(start_time, end_time, this.GetAdminUserInfo().CurrentOrgId, 4) //血清铁蛋白和转铁蛋白饱和度
- //xqqbdb_total := service.GetCheckExaminePercent(start_time, end_time, this.GetAdminUserInfo().CurrentOrgId, 5) //血清前白蛋白
- //cfydb_total := service.GetCheckExaminePercent(start_time, end_time, this.GetAdminUserInfo().CurrentOrgId, 6) //c反应蛋白
- //
- }
-
- func (this *CommonApiController) GetPatientInspectionList() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- list, _ := service.GetAllPatientListMap(orgId)
- if len(list) > 0 {
- for _, item := range list {
- befor, _ := service.GetLastBefor(item.ID)
- item.BeforSystolicBloodPressure = befor.SystolicBloodPressure
- item.BeforDiastolicBloodPressure = befor.DiastolicBloodPressure
-
- after, _ := service.GetLastRecordAfter(item.ID)
- item.AfterSystolicBloodPressure = after.SystolicBloodPressure
- item.AfterDiastolicBloodPressure = after.DiastolicBloodPressure
- item.KTV = after.Ktv
- item.URR = after.Urr
-
- list, _ := service.GetInspectionByPatientId(item.ID, 169)
- item.XueLin = list.InspectValue
- listOne, _ := service.GetInspectionByPatientId(item.ID, 17)
- item.XueHongDanBai = listOne.InspectValue
- listTwo, _ := service.GetInspectionByPatientId(item.ID, 54)
- item.XueHongDanBai = listTwo.InspectValue
-
- listThree, _ := service.GetInspectionByPatientId(item.ID, 111215)
- item.JiaoZhengGai = listThree.InspectValue
-
- listFour, _ := service.GetInspectionByPatientId(item.ID, 170)
- item.JiaPanSu = listFour.InspectValue
-
- listFive, _ := service.GetInspectionByPatientId(item.ID, 176)
- item.YiTieDanBai = listFive.InspectValue
-
- listSix, _ := service.GetInspectionByPatientId(item.ID, 1506)
- item.TieDanBai = listSix.InspectValue
-
- listSeven, _ := service.GetInspectionByPatientId(item.ID, 183)
- item.TieDanBai = listSeven.InspectValue
-
- listEight, _ := service.GetInspectionByPatientId(item.ID, 182)
- item.Crp = listEight.InspectValue
-
- listNight, _ := service.GetInspectionByPatientId(item.ID, 42)
- item.Mg = listNight.InspectValue
-
- }
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- })
- }
|