| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853 |
- package logs
- import (
- "encoding/json"
- "fmt"
- "reflect"
- "strings"
- "time"
- "dashoo.cn/backend/api/business/baseUser"
- "dashoo.cn/backend/api/business/logsinfo"
- "dashoo.cn/backend/api/business/operationlog"
- . "dashoo.cn/backend/api/controllers"
- "dashoo.cn/utils"
- "dashoo.cn/utils/db"
- )
- // 日志接口说明
- type LoginfosController struct {
- BaseController
- }
- type SamplesMain_Log struct {
- MId int `name:"-"`
- AccCode string `name:"-"`
- Name string `name:"名称"`
- SampleCode string `name:"样本编码"`
- SampleType int `name:"-"`
- SampleTypeName string `name:"样本类型"`
- SamplingOrgan string `name:"组织器官Code"`
- SamplingOrganName string `name:"组织器官"`
- SamplingSite string `name:"取材部位Code"`
- SamplingSiteName string `name:"取材部位"`
- SourceId int `name:"样本源Id"`
- SourceIdCard string `name:"样本源身份证号"`
- SourceName string `name:"样本源姓名"`
- ReceiveDate time.Time `name:"接收日期" stype:"T"`
- ZBack11 string `name:"ZBack11" note:"扩展"`
- ZBack12 string `name:"ZBack12" note:"扩展"`
- ZBack13 string `name:"ZBack13" note:"扩展"`
- ZBack14 string `name:"ZBack14" note:"扩展"`
- ZBack15 string `name:"ZBack15" note:"扩展"`
- ZBack16 string `name:"ZBack16" note:"扩展"`
- ZBack17 string `name:"ZBack17" note:"扩展"`
- ZBack18 string `name:"ZBack18" note:"扩展"`
- ZBack19 string `name:"ZBack19" note:"扩展"`
- ZBack20 string `name:"ZBack20" note:"扩展"`
- ZBack21 string `name:"ZBack21" note:"扩展"`
- ZBack22 string `name:"ZBack22" note:"扩展"`
- ZBack23 string `name:"ZBack23" note:"扩展"`
- ZBack24 string `name:"ZBack24" note:"扩展"`
- ZBack25 string `name:"ZBack25" note:"扩展"`
- ZBack26 string `name:"ZBack26" note:"扩展"`
- ZBack27 string `name:"ZBack27" note:"扩展"`
- ZBack28 string `name:"ZBack28" note:"扩展"`
- ZBack29 string `name:"ZBack29" note:"扩展"`
- ZBack30 string `name:"ZBack30" note:"扩展"`
- ZBack31 string `name:"ZBack31" note:"扩展"`
- ZBack32 string `name:"ZBack32" note:"扩展"`
- ZBack33 string `name:"ZBack33" note:"扩展"`
- ZBack34 string `name:"ZBack34" note:"扩展"`
- ZBack35 string `name:"ZBack35" note:"扩展"`
- ZBack36 string `name:"ZBack36" note:"扩展"`
- ZBack37 string `name:"ZBack37" note:"扩展"`
- ZBack38 string `name:"ZBack38" note:"扩展"`
- ZBack39 string `name:"ZBack39" note:"扩展"`
- ZBack40 string `name:"ZBack40" note:"扩展"`
- ZBack41 string `name:"ZBack41" note:"扩展"`
- ZBack42 string `name:"ZBack42" note:"扩展"`
- ZBack43 string `name:"ZBack43" note:"扩展"`
- ZBack44 string `name:"ZBack44" note:"扩展"`
- ZBack45 string `name:"ZBack45" note:"扩展"`
- ZBack46 string `name:"ZBack46" note:"扩展"`
- ZBack47 string `name:"ZBack47" note:"扩展"`
- ZBack48 string `name:"ZBack48" note:"扩展"`
- ZBack49 string `name:"ZBack49" note:"扩展"`
- ZBack50 string `name:"ZBack50" note:"扩展"`
- ZBack51 string `name:"ZBack51" note:"扩展"`
- ZBack52 string `name:"ZBack52" note:"扩展"`
- ZBack53 string `name:"ZBack53" note:"扩展"`
- ZBack54 string `name:"ZBack54" note:"扩展"`
- ZBack55 string `name:"ZBack55" note:"扩展"`
- ZBack56 string `name:"ZBack56" note:"扩展"`
- ZBack57 string `name:"ZBack57" note:"扩展"`
- ZBack58 string `name:"ZBack58" note:"扩展"`
- ZBack59 string `name:"ZBack59" note:"扩展"`
- ZBack60 string `name:"ZBack60" note:"扩展"`
- MCreateBy string `name:"创建人"`
- MCreateOn time.Time `name:"创建时间" stype:"T"`
- MCreateUserId int `name:"-"`
- MModifiedBy string `name:"修改人"`
- MModifiedOn time.Time `name:"修改时间" stype:"T"`
- MModifiedUserId int `name:"-"`
- }
- type SamplesInfoShow_Log struct {
- MId int `name:"-"`
- AccCode string `name:"-"`
- Name string `name:"名称"`
- SampleCode string `name:"样本编码"`
- Id int `name:"-"`
- BarCode string `name:"样本条码"`
- InnerCode string `name:"样本内码"`
- SampleType int `name:"-"`
- SampleTypeName string `name:"样本类型"`
- SamplingOrgan string `name:"组织器官Code"`
- SamplingOrganName string `name:"组织器官"`
- SamplingSite string `name:"取材部位Code"`
- SamplingSiteName string `name:"取材部位"`
- SourceId int `name:"样本源Id"`
- SourceIdCard string `name:"样本源身份证号"`
- SourceName string `name:"样本源姓名"`
- ReceiveDate time.Time `name:"接收日期" stype:"T"`
- IState int `name:"-"`
- EquipmentId int `name:"-"`
- ShelfId int `name:"-"`
- BoxId int `name:"-"`
- Position string `name:"-"`
- DeletionStateCode int `name:"-"`
- InitCapacity float32 `name:"初始容量"`
- Capacity float32 `name:"可用容量"`
- FreezingNum int `name:"冻融次数"`
- Unit string `name:"单位(容量)"`
- ValidityDate time.Time `name:"有效日期" stype:"T"`
- ParentBarCode string `name:"父样本条码"`
- IType int `name:"-"`
- Remark string `name:"备注"`
- CreateBy string `name:"创建人"`
- CreateOn time.Time `name:"创建时间" stype:"T"`
- CreateUserId int `name:"-"`
- ModifiedBy string `name:"修改人"`
- ModifiedOn time.Time `name:"修改时间" stype:"T"`
- ModifiedUserId int `name:"-"`
- ZBack11 string `name:"ZBack11" note:"扩展"`
- ZBack12 string `name:"ZBack12" note:"扩展"`
- ZBack13 string `name:"ZBack13" note:"扩展"`
- ZBack14 string `name:"ZBack14" note:"扩展"`
- ZBack15 string `name:"ZBack15" note:"扩展"`
- ZBack16 string `name:"ZBack16" note:"扩展"`
- ZBack17 string `name:"ZBack17" note:"扩展"`
- ZBack18 string `name:"ZBack18" note:"扩展"`
- ZBack19 string `name:"ZBack19" note:"扩展"`
- ZBack20 string `name:"ZBack20" note:"扩展"`
- ZBack21 string `name:"ZBack21" note:"扩展"`
- ZBack22 string `name:"ZBack22" note:"扩展"`
- ZBack23 string `name:"ZBack23" note:"扩展"`
- ZBack24 string `name:"ZBack24" note:"扩展"`
- ZBack25 string `name:"ZBack25" note:"扩展"`
- ZBack26 string `name:"ZBack26" note:"扩展"`
- ZBack27 string `name:"ZBack27" note:"扩展"`
- ZBack28 string `name:"ZBack28" note:"扩展"`
- ZBack29 string `name:"ZBack29" note:"扩展"`
- ZBack30 string `name:"ZBack30" note:"扩展"`
- ZBack31 string `name:"ZBack31" note:"扩展"`
- ZBack32 string `name:"ZBack32" note:"扩展"`
- ZBack33 string `name:"ZBack33" note:"扩展"`
- ZBack34 string `name:"ZBack34" note:"扩展"`
- ZBack35 string `name:"ZBack35" note:"扩展"`
- ZBack36 string `name:"ZBack36" note:"扩展"`
- ZBack37 string `name:"ZBack37" note:"扩展"`
- ZBack38 string `name:"ZBack38" note:"扩展"`
- ZBack39 string `name:"ZBack39" note:"扩展"`
- ZBack40 string `name:"ZBack40" note:"扩展"`
- ZBack41 string `name:"ZBack41" note:"扩展"`
- ZBack42 string `name:"ZBack42" note:"扩展"`
- ZBack43 string `name:"ZBack43" note:"扩展"`
- ZBack44 string `name:"ZBack44" note:"扩展"`
- ZBack45 string `name:"ZBack45" note:"扩展"`
- ZBack46 string `name:"ZBack46" note:"扩展"`
- ZBack47 string `name:"ZBack47" note:"扩展"`
- ZBack48 string `name:"ZBack48" note:"扩展"`
- ZBack49 string `name:"ZBack49" note:"扩展"`
- ZBack50 string `name:"ZBack50" note:"扩展"`
- ZBack51 string `name:"ZBack51" note:"扩展"`
- ZBack52 string `name:"ZBack52" note:"扩展"`
- ZBack53 string `name:"ZBack53" note:"扩展"`
- ZBack54 string `name:"ZBack54" note:"扩展"`
- ZBack55 string `name:"ZBack55" note:"扩展"`
- ZBack56 string `name:"ZBack56" note:"扩展"`
- ZBack57 string `name:"ZBack57" note:"扩展"`
- ZBack58 string `name:"ZBack58" note:"扩展"`
- ZBack59 string `name:"ZBack59" note:"扩展"`
- ZBack60 string `name:"ZBack60" note:"扩展"`
- }
- //捐献者日志详情
- type DonorsInfo_log struct {
- IdCard string `name:"身份证号"` //身份证号
- Name string `name:"姓名"` //姓名
- Mobile string `name:"电话"` //电话
- Telephone string `name:"手机号"` //手机 //扩展项目
- Sex int64 `name:"性别" des:"0,男;1,女"` //性别0,男;1,女
- InnerNo string `name:"内部编码"` //内部编码
- CompanyName string `name:"单位"` //公司
- Duty string `name:"职务"` //职务
- Birthday time.Time `name:"生日" form:"Birthday,2006-1-2 15:4:5"` //生日
- Age int64 `name:"年龄"` //年龄
- Email string `name:"邮箱"` //邮箱
- Nation string `name:"民族"` //民族
- ComeFrom string `name:"籍贯"` //籍贯
- HomeAddress string `name:"家庭住址"` //家庭住址
- XISNum string `name:"-"` //XIS编号
- AdmissionNumber string `name:"住院号"` //住院号
- IsInformed int64 `name:"-"` //是否签知情同意书
- MaritalStatus int64 `name:"婚姻" des:"0,未婚;1,已婚;2,未知"` //婚姻状态0,未婚;1,已婚;2,未知
- PathologicalNum string `name:"病理号"` //病理号
- ClinicalDiagnosis string `name:"临床诊断"` //临床诊断
- ClinicNum string `name:"门诊号"` //门诊号
- CheckNum int64 `name:"-"` //检查次数
- CheckPoint string `name:"检查部位"` //检查部位
- IllnessName string `name:"病名"` //病名
- XPublicState int64 `name:"-"` //是否公开 备用 1公开 0私有
- Department string `name:"科室"` //科室
- DiagnosticTime time.Time `name:"诊断时间" form:"DiagnosticTime,2006-1-2 15:4:5"` //诊断时间
- CreateOn time.Time `name:"添加时间" form:"CreateOn,2006-1-2 15:4:5"`
- CreateUserId int64 `name:"-"`
- CreateBy string `name:"添加人"`
- ModifiedOn time.Time `name:"-" form:"ModifiedOn,2006-1-2 15:4:5"`
- ModifiedUserId int64 `name:"-"`
- ModifiedBy string `name:"-"`
- Remark string `name:"-"`
- ZBack11 string `name:"ZBack11" note:"扩展"`
- ZBack12 string `name:"ZBack12" note:"扩展"`
- ZBack13 string `name:"ZBack13" note:"扩展"`
- ZBack14 string `name:"ZBack14" note:"扩展"`
- ZBack15 string `name:"ZBack15" note:"扩展"`
- ZBack16 string `name:"ZBack16" note:"扩展"`
- ZBack17 string `name:"ZBack17" note:"扩展"`
- ZBack18 string `name:"ZBack18" note:"扩展"`
- ZBack19 string `name:"ZBack19" note:"扩展"`
- ZBack20 string `name:"ZBack20" note:"扩展"`
- ZBack21 string `name:"ZBack21" note:"扩展"`
- ZBack22 string `name:"ZBack22" note:"扩展"`
- ZBack23 string `name:"ZBack23" note:"扩展"`
- ZBack24 string `name:"ZBack24" note:"扩展"`
- ZBack25 string `name:"ZBack25" note:"扩展"`
- ZBack26 string `name:"ZBack26" note:"扩展"`
- ZBack27 string `name:"ZBack27" note:"扩展"`
- ZBack28 string `name:"ZBack28" note:"扩展"`
- ZBack29 string `name:"ZBack29" note:"扩展"`
- ZBack30 string `name:"ZBack30" note:"扩展"`
- ZBack31 string `name:"ZBack31" note:"扩展"`
- ZBack32 string `name:"ZBack32" note:"扩展"`
- ZBack33 string `name:"ZBack33" note:"扩展"`
- ZBack34 string `name:"ZBack34" note:"扩展"`
- ZBack35 string `name:"ZBack35" note:"扩展"`
- ZBack36 string `name:"ZBack36" note:"扩展"`
- ZBack37 string `name:"ZBack37" note:"扩展"`
- ZBack38 string `name:"ZBack38" note:"扩展"`
- ZBack39 string `name:"ZBack39" note:"扩展"`
- ZBack40 string `name:"ZBack40" note:"扩展"`
- ZBack41 string `name:"ZBack41" note:"扩展"`
- ZBack42 string `name:"ZBack42" note:"扩展"`
- ZBack43 string `name:"ZBack43" note:"扩展"`
- ZBack44 string `name:"ZBack44" note:"扩展"`
- ZBack45 string `name:"ZBack45" note:"扩展"`
- ZBack46 string `name:"ZBack46" note:"扩展"`
- ZBack47 string `name:"ZBack47" note:"扩展"`
- ZBack48 string `name:"ZBack48" note:"扩展"`
- ZBack49 string `name:"ZBack49" note:"扩展"`
- ZBack50 string `name:"ZBack50" note:"扩展"`
- ZBack51 string `name:"ZBack51" note:"扩展"`
- ZBack52 string `name:"ZBack52" note:"扩展"`
- ZBack53 string `name:"ZBack53" note:"扩展"`
- ZBack54 string `name:"ZBack54" note:"扩展"`
- ZBack55 string `name:"ZBack55" note:"扩展"`
- ZBack56 string `name:"ZBack56" note:"扩展"`
- ZBack57 string `name:"ZBack57" note:"扩展"`
- ZBack58 string `name:"ZBack58" note:"扩展"`
- ZBack59 string `name:"ZBack59" note:"扩展"`
- ZBack60 string `name:"ZBack60" note:"扩展"`
- }
- // @Title 日志列表
- // @Description 日志列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /list [get]
- func (this *LoginfosController) List() {
- page := this.GetPageInfoForm()
- svc := logsinfo.GetLogsinfoService(utils.DBE)
- searchkey := this.GetString("keyword")
- //权限
- svcuser := baseUser.GetBaseUserService(utils.DBE)
- uidint, _ := utils.StrTo(this.User.Id).Int()
- uids := svcuser.GetIdbyAcccodeAndUid(this.GetAccode(), uidint)
- where := " where Createuserid in (" + strings.Join(uids, ",") + ")"
- if searchkey != "" {
- where = where + " and ( RecordData like '%" + searchkey + "%' or Createby like '%" + searchkey + "%') "
- }
- total, list := svc.GetPagingEntitiesWithOrderSearch(page.CurrentPage, page.Size, "Createon desc", where, "")
- var datainfo DataInfo
- datainfo.Items = list
- datainfo.CurrentItemCount = total
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 样本日志列表
- // @Description 样本日志列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /samplelist [get]
- //func (this *LoginfosController) ListSampleLog() {
- // var data []logsinfo.SamplesLog
- // page := this.GetPageInfoForm()
- // CreateBy := this.GetString("CreateBy")
- // search := this.GetString("search")
- // CreateOnstart, _ := this.GetInt64("CreateOnstart")
- // CreateOnend, _ := this.GetInt64("CreateOnend")
- // sbarcode := this.GetString("sbarcode")
- // id := this.GetString("id")
- // where := " 1=1 "
- // if id != "" {
- // where = where + " and Id= " + id
- // }
- // if search != "" {
- // where = where + " and SampleCode like '%" + search + "%' "
- // }
- // if sbarcode != "" {
- // where = where + " and BarCode like '%" + sbarcode + "%' "
- // }
- // if CreateBy != "" {
- // where = where + "and CreateBy ='" + CreateBy + "'"
- // }
- // if CreateOnstart != 0 {
- // where = where + " and CreateOn >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
- // }
- // if CreateOnend != 0 {
- // where = where + " and CreateOn <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
- // }
- // svc := samplesinfo.GetSamplesInfoService(utils.DBE)
- // total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id", false, &data, where)
- // var datainfo DataInfo
- // datainfo.Items = data
- // datainfo.CurrentItemCount = total
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
- // @Title 样本来源日志列表
- // @Description 样本来源日志列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /donorlist [get]
- //func (this *LoginfosController) ListDonorLog() {
- // var data []logsinfo.DonorsLog
- // page := this.GetPageInfoForm()
- // CreateBy := this.GetString("CreateBy")
- // sourcename := this.GetString("sourcename")
- // CreateOnstart, _ := this.GetInt64("CreateOnstart")
- // CreateOnend, _ := this.GetInt64("CreateOnend")
- // optype := this.GetString("optype")
- // id := this.GetString("id")
- // where := " 1=1 "
- // if id != "" {
- // where = where + " and Id= " + id
- // }
- // if sourcename != "" {
- // where = where + " and SourceName like '%" + sourcename + "%' "
- // }
- // if optype != "" {
- // where = where + " and OpType like '%" + optype + "%' "
- // }
- // if CreateBy != "" {
- // where = where + "and CreateBy ='" + CreateBy + "'"
- // }
- // if CreateOnstart != 0 {
- // where = where + " and CreateOn >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
- // }
- // if CreateOnend != 0 {
- // where = where + " and CreateOn <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
- // }
- // svc := donorsinfo.GetDonorsInfoService(utils.DBE)
- // total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id", false, &data, where)
- // var datainfo DataInfo
- // datainfo.Items = data
- // datainfo.CurrentItemCount = total
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
- // @Title 样本日志列表
- // @Description 样本日志列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /operationlist [get]
- func (this *LoginfosController) ListOperationLog() {
- page := this.GetPageInfoForm()
- svc := operationlog.GetOperationLogService(utils.DBE)
- var operationloglist []db.Base_OperationLog
- CreateOnstart, _ := this.GetInt64("CreateOnstart")
- CreateOnend, _ := this.GetInt64("CreateOnend")
- tabledesc := this.GetString("tabledesc")
- opdesc := this.GetString("opdesc")
- createby := this.GetString("createby")
- id := this.GetString("id")
- where := " AccCode='" + this.User.AccCode + "'"
- if id != "" {
- where = where + " and Id= " + id
- }
- if tabledesc != "" {
- where = where + " and TableDesc like '%" + tabledesc + "%'"
- }
- if opdesc != "" {
- where = where + " and OpDesc like '%" + opdesc + "%'"
- }
- if createby != "" {
- where = where + "and Createby ='" + createby + "'"
- }
- if CreateOnstart != 0 {
- where = where + " and Createon >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
- }
- if CreateOnend != 0 {
- where = where + " and Createon <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
- }
- fmt.Println("==================sssssssssssssssssssssssssssssssss")
- total := svc.GetPagingEntitiesWithSortCode(page.CurrentPage, page.Size, "Createon desc ", &operationloglist, where)
- var datainfo DataInfo
- datainfo.Items = operationloglist
- datainfo.CurrentItemCount = total
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 登录日志列表
- // @Description 登录日志列表
- // @Success 200 {object} business.device.DeviceChannels
- // @router /loginlist [get]
- func (this *LoginfosController) ListLoginLog() {
- page := this.GetPageInfoForm()
- svc := operationlog.GetOperationLogService(utils.DBE)
- var loginloglist []db.Base_LoginLog
- loginip := this.GetString("loginip")
- loginby := this.GetString("loginby")
- CreateOnstart, _ := this.GetInt64("CreateOnstart")
- CreateOnend, _ := this.GetInt64("CreateOnend")
- where := " AccCode='" + this.User.AccCode + "'"
- if loginby != "" {
- where = where + "and Loginby like '%" + loginby + "%'"
- }
- if loginip != "" {
- where = where + " and LoginIp like '%" + loginip + "%'"
- }
- if CreateOnstart != 0 {
- where = where + " and Loginon >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
- }
- if CreateOnend != 0 {
- where = where + " and Loginon <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
- }
- total := svc.GetPagingEntitiesWithSortCode(page.CurrentPage, page.Size, "Loginon desc ", &loginloglist, where)
- var datainfo DataInfo
- datainfo.Items = loginloglist
- datainfo.CurrentItemCount = total
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- // @Title 样本日志列表详情
- // @Description 样本日志列表详情
- // @Success 200 {object} business.device.DeviceChannels
- // @router /samplelistinfo [get]
- //func (this *LoginfosController) SamplesInfo() {
- // id := this.GetString("id")
- // svc := samplesinfo.GetSamplesInfoService(utils.DBE)
- // logmodel := svc.GetContantById(this.User.AccCode+SamplesLogtbName, id)
- // this.Data["logmodel"] = logmodel
- // switch logmodel.TableName {
- // case "SamplesMain":
- // this.GetLog_Info(logmodel.TableName, logmodel, svc, &SamplesMain_Log{}, &SamplesMain_Log{}, logmodel.SampleType)
- // case "SamplesInfoShow":
- // this.GetLog_Info(logmodel.TableName, logmodel, svc, &SamplesInfoShow_Log{}, &SamplesInfoShow_Log{}, logmodel.SampleType)
- // }
- //}
- //func (this *LoginfosController) GetLog_Info(tname string, logmodel *mydb.SamplesLog, svc *samplesinfo.SamplesInfoService, m1 interface{}, m2 interface{}, sampletype int) {
- // json.Unmarshal([]byte(logmodel.RecordData), m1)
- // var datatr2 string
- // if logmodel.TableName == "SamplesMain" {
- // datatr2 = svc.GetNextContantById(this.User.AccCode+SamplesLogtbName, utils.ToStr(logmodel.Id), this.User.AccCode+SamplesMaintbName, logmodel.MId, m2)
- // } else if logmodel.TableName == "SamplesInfoShow" {
- // datatr2 = svc.GetNextContantShowInfoById(this.User.AccCode+SamplesLogtbName, utils.ToStr(logmodel.Id), logmodel.RecordId, m2, this.User.AccCode)
- // }
- // json.Unmarshal([]byte(datatr2), m2)
- // maplistpublic, maplistprivate := GetSamplePublicNoteNameMap(this.User.AccCode)
- // data := LogcomparefuncByNoteSample(m1, m2, maplistpublic, maplistprivate, sampletype)
- // var datainfo DataInfo
- // datainfo.Items = data
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
- func LogcomparefuncByNoteSample(m1, m2 interface{}, map_listpublic, map_listprivate map[string]string, sampletype int) []Logcompare {
- objT1 := reflect.TypeOf(m1).Elem()
- objT2 := reflect.TypeOf(m2).Elem()
- list := make([]Logcompare, 0)
- if objT1 == objT2 {
- objV1 := reflect.ValueOf(m1).Elem()
- objV2 := reflect.ValueOf(m2).Elem()
- for i := 0; i < objT1.NumField(); i++ {
- fieldT := objT1.Field(i)
- field := fieldT.Name
- name := fieldT.Tag.Get("name")
- if name == "-" {
- continue
- }
- switch fieldT.Type.Kind() {
- case reflect.Int, reflect.Int32, reflect.Int64:
- des := fieldT.Tag.Get("des")
- if des != "" {
- v1str, v2str := "", ""
- v1 := objV1.FieldByName(field).Int()
- v2 := objV2.FieldByName(field).Int()
- desarr := strings.Split(des, ";")
- for _, v := range desarr {
- if strings.Split(v, ",")[0] == utils.ToStr(v1) {
- v1str = strings.Split(v, ",")[1]
- }
- if strings.Split(v, ",")[0] == utils.ToStr(v2) {
- v2str = strings.Split(v, ",")[1]
- }
- }
- list = append(list, Logcompare{name, field, v1str, v2str})
- } else {
- v1 := objV1.FieldByName(field).Int()
- v2 := objV2.FieldByName(field).Int()
- list = append(list, Logcompare{name, field, v1, v2})
- }
- case reflect.Float32, reflect.Float64:
- v1 := objV1.FieldByName(field).Float()
- v2 := objV2.FieldByName(field).Float()
- list = append(list, Logcompare{name, field, v1, v2})
- case reflect.String:
- des := fieldT.Tag.Get("des")
- if des != "" {
- v1str, v2str := "", ""
- v1 := objV1.FieldByName(field).String()
- v2 := objV2.FieldByName(field).String()
- desarr := strings.Split(des, ";")
- for _, v := range desarr {
- if strings.Split(v, ",")[0] == utils.ToStr(v1) {
- v1str = strings.Split(v, ",")[1]
- }
- if strings.Split(v, ",")[0] == utils.ToStr(v2) {
- v2str = strings.Split(v, ",")[1]
- }
- }
- list = append(list, Logcompare{name, field, v1str, v2str})
- } else {
- v1 := objV1.FieldByName(field).String()
- v2 := objV2.FieldByName(field).String()
- note := fieldT.Tag.Get("note")
- if note == "扩展" {
- notename := map_listpublic[name]
- if notename != "" {
- list = append(list, Logcompare{notename, field, v1, v2})
- } else {
- privatenotename := map_listprivate[name+"-"+utils.ToStr(sampletype)]
- if privatenotename != "" {
- list = append(list, Logcompare{privatenotename, field, v1, v2})
- }
- }
- } else {
- list = append(list, Logcompare{name, field, v1, v2})
- }
- }
- case reflect.Struct:
- switch fieldT.Type.String() {
- case "time.Time":
- stype := fieldT.Tag.Get("stype")
- if stype == "" {
- stype = "D"
- }
- v1 := objV1.FieldByName(field).Interface().(time.Time)
- v2 := objV2.FieldByName(field).Interface().(time.Time)
- list = append(list, Logcompare{name, field, v1, v2})
- }
- }
- }
- }
- return list
- }
- // @Title 样本日志列表详情
- // @Description 样本日志列表详情
- // @Success 200 {object} business.device.DeviceChannels
- // @router /donorlistinfo [get]
- //func (this *LoginfosController) DonorsInfo() {
- // id := this.GetString("id")
- // svc := donorsinfo.GetDonorsInfoService(utils.DBE)
- // logmodel := svc.GetContantById(this.User.AccCode+DonorslogtbName, id)
- // this.Data["logmodel"] = logmodel
- // switch logmodel.TableName {
- // case "DonorsInfo":
- // this.GetLog_DonorsInfo(logmodel.TableName, logmodel, svc, &DonorsInfo_log{}, &DonorsInfo_log{})
- // }
- //}
- //func (this *LoginfosController) GetLog_DonorsInfo(tname string, logmodel *mydb.DonorsLog, svc *donorsinfo.DonorsInfoService, m1 interface{}, m2 interface{}) {
- // json.Unmarshal([]byte(logmodel.RecordData), m1)
- // datatr2 := svc.GetNextContantById(this.User.AccCode+DonorslogtbName, utils.ToStr(logmodel.Id), this.User.AccCode+DonorstbName, logmodel.RecordId, m2)
- // json.Unmarshal([]byte(datatr2), m2)
- // maplist := GetDonorNoteNameMap(this.User.AccCode)
- // data := LogcomparefuncByNote(m1, m2, maplist)
- // var datainfo DataInfo
- // datainfo.Items = data
- // this.Data["json"] = &datainfo
- // this.ServeJSON()
- //}
- //func GetDonorNoteNameMap(acccode string) map[string]string {
- // svcdnote := extend.GetExtendService(utils.DBE)
- // where1 := " AccCode='" + acccode + "' "
- // var DnoteitemList []extend.DonorsNoteItem
- // DnoteitemList = svcdnote.GetDNoteItemList(where1)
- // map_list := make(map[string]string)
- // for i := 0; i < len(DnoteitemList); i++ {
- // map_list[utils.ToStr(DnoteitemList[i].FieldName)] = DnoteitemList[i].Name
- // }
- // return map_list
- //}
- func LogcomparefuncByNote(m1, m2 interface{}, map_list map[string]string) []Logcompare {
- objT1 := reflect.TypeOf(m1).Elem()
- objT2 := reflect.TypeOf(m2).Elem()
- list := make([]Logcompare, 0)
- if objT1 == objT2 {
- objV1 := reflect.ValueOf(m1).Elem()
- objV2 := reflect.ValueOf(m2).Elem()
- for i := 0; i < objT1.NumField(); i++ {
- fieldT := objT1.Field(i)
- field := fieldT.Name
- name := fieldT.Tag.Get("name")
- if name == "-" {
- continue
- }
- switch fieldT.Type.Kind() {
- case reflect.Int, reflect.Int32, reflect.Int64:
- des := fieldT.Tag.Get("des")
- if des != "" {
- v1str, v2str := "", ""
- v1 := objV1.FieldByName(field).Int()
- v2 := objV2.FieldByName(field).Int()
- desarr := strings.Split(des, ";")
- for _, v := range desarr {
- if strings.Split(v, ",")[0] == utils.ToStr(v1) {
- v1str = strings.Split(v, ",")[1]
- }
- if strings.Split(v, ",")[0] == utils.ToStr(v2) {
- v2str = strings.Split(v, ",")[1]
- }
- }
- list = append(list, Logcompare{name, field, v1str, v2str})
- } else {
- v1 := objV1.FieldByName(field).Int()
- v2 := objV2.FieldByName(field).Int()
- list = append(list, Logcompare{name, field, v1, v2})
- }
- case reflect.Float32, reflect.Float64:
- v1 := objV1.FieldByName(field).Float()
- v2 := objV2.FieldByName(field).Float()
- list = append(list, Logcompare{name, field, v1, v2})
- case reflect.String:
- des := fieldT.Tag.Get("des")
- if des != "" {
- v1str, v2str := "", ""
- v1 := objV1.FieldByName(field).String()
- v2 := objV2.FieldByName(field).String()
- desarr := strings.Split(des, ";")
- for _, v := range desarr {
- if strings.Split(v, ",")[0] == utils.ToStr(v1) {
- v1str = strings.Split(v, ",")[1]
- }
- if strings.Split(v, ",")[0] == utils.ToStr(v2) {
- v2str = strings.Split(v, ",")[1]
- }
- }
- list = append(list, Logcompare{name, field, v1str, v2str})
- } else {
- v1 := objV1.FieldByName(field).String()
- v2 := objV2.FieldByName(field).String()
- note := fieldT.Tag.Get("note")
- if note == "扩展" {
- notename := map_list[name]
- if notename != "" {
- list = append(list, Logcompare{notename, field, v1, v2})
- }
- } else {
- list = append(list, Logcompare{name, field, v1, v2})
- }
- }
- case reflect.Struct:
- switch fieldT.Type.String() {
- case "time.Time":
- stype := fieldT.Tag.Get("stype")
- if stype == "" {
- stype = "D"
- }
- v1 := objV1.FieldByName(field).Interface().(time.Time)
- v2 := objV2.FieldByName(field).Interface().(time.Time)
- list = append(list, Logcompare{name, field, v1, v2})
- }
- }
- }
- }
- return list
- }
- // @Title 操作日志列表详情
- // @Description 操作日志列表详情
- // @Success 200 {object} business.device.DeviceChannels
- // @router /operationslistinfo [get]
- func (this *LoginfosController) OperationsInfo() {
- id := this.GetString("id")
- svc := operationlog.GetOperationLogService(utils.DBE)
- logmodel := svc.GetContantById(id)
- this.Data["logmodel"] = logmodel
- switch logmodel.TName {
- case "Equipment":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Equipment_Log{}, &logsinfo.Equipment_Log{})
- case "Shelf":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Shelf_Log{}, &logsinfo.Shelf_Log{})
- case "Box":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Box_Log{}, &logsinfo.Box_Log{})
- case "SampleType":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.SampleType_Log{}, &logsinfo.SampleType_Log{})
- case "STypeNoteItem":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.STypeNoteItem_Log{}, &logsinfo.STypeNoteItem_Log{})
- case "SamplesNoteItem":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.SamplesNoteItem_Log{}, &logsinfo.SamplesNoteItem_Log{})
- case "DonorsNoteItem":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.DonorsNoteItem_Log{}, &logsinfo.DonorsNoteItem_Log{})
- case "SampleOrgan":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.SampleOrgan_Log{}, &logsinfo.SampleOrgan_Log{})
- case "CodeRule":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.CodeRule_Log{}, &logsinfo.CodeRule_Log{})
- case "CodeRuleDetail":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.CodeRuleDetail_Log{}, &logsinfo.CodeRuleDetail_Log{})
- case "PrintScheme":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.PrintScheme_Log{}, &logsinfo.PrintScheme_Log{})
- case "FamilyMan":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FamilyMan_Log{}, &logsinfo.FamilyMan_Log{})
- case "FamilyManDetail":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FamilyManDetail_Log{}, &logsinfo.FamilyManDetail_Log{})
- case "FlupPlan":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FlupPlan_Log{}, &logsinfo.FlupPlan_Log{})
- case "FlupRecord":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FlupRecord_Log{}, &logsinfo.FlupRecord_Log{})
- case "TriggerAction":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.TriggerAction_Log{}, &logsinfo.TriggerAction_Log{})
- case "Actions":
- this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Actions_Log{}, &logsinfo.Actions_Log{})
- }
- }
- func (this *LoginfosController) GetLog_OperationsInfo(tname string, logmodel *operationlog.Logsinfo, svc *operationlog.OperationLogService, m1 interface{}, m2 interface{}) {
- json.Unmarshal([]byte(logmodel.RecordData), m1)
- datatr2 := svc.GetNextContantById(utils.ToStr(logmodel.Id), logmodel.TName, tname, logmodel.RecordId, m2)
- json.Unmarshal([]byte(datatr2), m2)
- data := Logcomparefunc2(m1, m2)
- var datainfo DataInfo
- datainfo.Items = data
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
- func Logcomparefunc2(m1, m2 interface{}) []Logcompare {
- objT1 := reflect.TypeOf(m1).Elem()
- objT2 := reflect.TypeOf(m2).Elem()
- list := make([]Logcompare, 0)
- if objT1 == objT2 {
- objV1 := reflect.ValueOf(m1).Elem()
- objV2 := reflect.ValueOf(m2).Elem()
- for i := 0; i < objT1.NumField(); i++ {
- fieldT := objT1.Field(i)
- field := fieldT.Name
- name := fieldT.Tag.Get("name")
- if name == "-" {
- continue
- }
- switch fieldT.Type.Kind() {
- case reflect.Int, reflect.Int32, reflect.Int64:
- des := fieldT.Tag.Get("des")
- if des != "" {
- v1str, v2str := "", ""
- v1 := objV1.FieldByName(field).Int()
- v2 := objV2.FieldByName(field).Int()
- desarr := strings.Split(des, ";")
- for _, v := range desarr {
- if strings.Split(v, ",")[0] == utils.ToStr(v1) {
- v1str = strings.Split(v, ",")[1]
- }
- if strings.Split(v, ",")[0] == utils.ToStr(v2) {
- v2str = strings.Split(v, ",")[1]
- }
- }
- list = append(list, Logcompare{name, field, v1str, v2str})
- } else {
- v1 := objV1.FieldByName(field).Int()
- v2 := objV2.FieldByName(field).Int()
- list = append(list, Logcompare{name, field, v1, v2})
- }
- case reflect.Float32, reflect.Float64:
- v1 := objV1.FieldByName(field).Float()
- v2 := objV2.FieldByName(field).Float()
- list = append(list, Logcompare{name, field, v1, v2})
- case reflect.String:
- des := fieldT.Tag.Get("des")
- if des != "" {
- v1str, v2str := "", ""
- v1 := objV1.FieldByName(field).String()
- v2 := objV2.FieldByName(field).String()
- desarr := strings.Split(des, ";")
- for _, v := range desarr {
- if strings.Split(v, ",")[0] == utils.ToStr(v1) {
- v1str = strings.Split(v, ",")[1]
- }
- if strings.Split(v, ",")[0] == utils.ToStr(v2) {
- v2str = strings.Split(v, ",")[1]
- }
- }
- list = append(list, Logcompare{name, field, v1str, v2str})
- } else {
- v1 := objV1.FieldByName(field).String()
- v2 := objV2.FieldByName(field).String()
- list = append(list, Logcompare{name, field, v1, v2})
- }
- case reflect.Struct:
- switch fieldT.Type.String() {
- case "time.Time":
- stype := fieldT.Tag.Get("stype")
- if stype == "" {
- stype = "D"
- }
- v1 := objV1.FieldByName(field).Interface().(time.Time)
- v2 := objV2.FieldByName(field).Interface().(time.Time)
- list = append(list, Logcompare{name, field, v1, v2})
- }
- }
- }
- }
- return list
- }
|