loginfos.go 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. package logs
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "reflect"
  6. "strings"
  7. "time"
  8. "dashoo.cn/backend/api/business/baseUser"
  9. "dashoo.cn/backend/api/business/logsinfo"
  10. "dashoo.cn/backend/api/business/operationlog"
  11. . "dashoo.cn/backend/api/controllers"
  12. "dashoo.cn/utils"
  13. "dashoo.cn/utils/db"
  14. )
  15. // 日志接口说明
  16. type LoginfosController struct {
  17. BaseController
  18. }
  19. type SamplesMain_Log struct {
  20. MId int `name:"-"`
  21. AccCode string `name:"-"`
  22. Name string `name:"名称"`
  23. SampleCode string `name:"样本编码"`
  24. SampleType int `name:"-"`
  25. SampleTypeName string `name:"样本类型"`
  26. SamplingOrgan string `name:"组织器官Code"`
  27. SamplingOrganName string `name:"组织器官"`
  28. SamplingSite string `name:"取材部位Code"`
  29. SamplingSiteName string `name:"取材部位"`
  30. SourceId int `name:"样本源Id"`
  31. SourceIdCard string `name:"样本源身份证号"`
  32. SourceName string `name:"样本源姓名"`
  33. ReceiveDate time.Time `name:"接收日期" stype:"T"`
  34. ZBack11 string `name:"ZBack11" note:"扩展"`
  35. ZBack12 string `name:"ZBack12" note:"扩展"`
  36. ZBack13 string `name:"ZBack13" note:"扩展"`
  37. ZBack14 string `name:"ZBack14" note:"扩展"`
  38. ZBack15 string `name:"ZBack15" note:"扩展"`
  39. ZBack16 string `name:"ZBack16" note:"扩展"`
  40. ZBack17 string `name:"ZBack17" note:"扩展"`
  41. ZBack18 string `name:"ZBack18" note:"扩展"`
  42. ZBack19 string `name:"ZBack19" note:"扩展"`
  43. ZBack20 string `name:"ZBack20" note:"扩展"`
  44. ZBack21 string `name:"ZBack21" note:"扩展"`
  45. ZBack22 string `name:"ZBack22" note:"扩展"`
  46. ZBack23 string `name:"ZBack23" note:"扩展"`
  47. ZBack24 string `name:"ZBack24" note:"扩展"`
  48. ZBack25 string `name:"ZBack25" note:"扩展"`
  49. ZBack26 string `name:"ZBack26" note:"扩展"`
  50. ZBack27 string `name:"ZBack27" note:"扩展"`
  51. ZBack28 string `name:"ZBack28" note:"扩展"`
  52. ZBack29 string `name:"ZBack29" note:"扩展"`
  53. ZBack30 string `name:"ZBack30" note:"扩展"`
  54. ZBack31 string `name:"ZBack31" note:"扩展"`
  55. ZBack32 string `name:"ZBack32" note:"扩展"`
  56. ZBack33 string `name:"ZBack33" note:"扩展"`
  57. ZBack34 string `name:"ZBack34" note:"扩展"`
  58. ZBack35 string `name:"ZBack35" note:"扩展"`
  59. ZBack36 string `name:"ZBack36" note:"扩展"`
  60. ZBack37 string `name:"ZBack37" note:"扩展"`
  61. ZBack38 string `name:"ZBack38" note:"扩展"`
  62. ZBack39 string `name:"ZBack39" note:"扩展"`
  63. ZBack40 string `name:"ZBack40" note:"扩展"`
  64. ZBack41 string `name:"ZBack41" note:"扩展"`
  65. ZBack42 string `name:"ZBack42" note:"扩展"`
  66. ZBack43 string `name:"ZBack43" note:"扩展"`
  67. ZBack44 string `name:"ZBack44" note:"扩展"`
  68. ZBack45 string `name:"ZBack45" note:"扩展"`
  69. ZBack46 string `name:"ZBack46" note:"扩展"`
  70. ZBack47 string `name:"ZBack47" note:"扩展"`
  71. ZBack48 string `name:"ZBack48" note:"扩展"`
  72. ZBack49 string `name:"ZBack49" note:"扩展"`
  73. ZBack50 string `name:"ZBack50" note:"扩展"`
  74. ZBack51 string `name:"ZBack51" note:"扩展"`
  75. ZBack52 string `name:"ZBack52" note:"扩展"`
  76. ZBack53 string `name:"ZBack53" note:"扩展"`
  77. ZBack54 string `name:"ZBack54" note:"扩展"`
  78. ZBack55 string `name:"ZBack55" note:"扩展"`
  79. ZBack56 string `name:"ZBack56" note:"扩展"`
  80. ZBack57 string `name:"ZBack57" note:"扩展"`
  81. ZBack58 string `name:"ZBack58" note:"扩展"`
  82. ZBack59 string `name:"ZBack59" note:"扩展"`
  83. ZBack60 string `name:"ZBack60" note:"扩展"`
  84. MCreateBy string `name:"创建人"`
  85. MCreateOn time.Time `name:"创建时间" stype:"T"`
  86. MCreateUserId int `name:"-"`
  87. MModifiedBy string `name:"修改人"`
  88. MModifiedOn time.Time `name:"修改时间" stype:"T"`
  89. MModifiedUserId int `name:"-"`
  90. }
  91. type SamplesInfoShow_Log struct {
  92. MId int `name:"-"`
  93. AccCode string `name:"-"`
  94. Name string `name:"名称"`
  95. SampleCode string `name:"样本编码"`
  96. Id int `name:"-"`
  97. BarCode string `name:"样本条码"`
  98. InnerCode string `name:"样本内码"`
  99. SampleType int `name:"-"`
  100. SampleTypeName string `name:"样本类型"`
  101. SamplingOrgan string `name:"组织器官Code"`
  102. SamplingOrganName string `name:"组织器官"`
  103. SamplingSite string `name:"取材部位Code"`
  104. SamplingSiteName string `name:"取材部位"`
  105. SourceId int `name:"样本源Id"`
  106. SourceIdCard string `name:"样本源身份证号"`
  107. SourceName string `name:"样本源姓名"`
  108. ReceiveDate time.Time `name:"接收日期" stype:"T"`
  109. IState int `name:"-"`
  110. EquipmentId int `name:"-"`
  111. ShelfId int `name:"-"`
  112. BoxId int `name:"-"`
  113. Position string `name:"-"`
  114. DeletionStateCode int `name:"-"`
  115. InitCapacity float32 `name:"初始容量"`
  116. Capacity float32 `name:"可用容量"`
  117. FreezingNum int `name:"冻融次数"`
  118. Unit string `name:"单位(容量)"`
  119. ValidityDate time.Time `name:"有效日期" stype:"T"`
  120. ParentBarCode string `name:"父样本条码"`
  121. IType int `name:"-"`
  122. Remark string `name:"备注"`
  123. CreateBy string `name:"创建人"`
  124. CreateOn time.Time `name:"创建时间" stype:"T"`
  125. CreateUserId int `name:"-"`
  126. ModifiedBy string `name:"修改人"`
  127. ModifiedOn time.Time `name:"修改时间" stype:"T"`
  128. ModifiedUserId int `name:"-"`
  129. ZBack11 string `name:"ZBack11" note:"扩展"`
  130. ZBack12 string `name:"ZBack12" note:"扩展"`
  131. ZBack13 string `name:"ZBack13" note:"扩展"`
  132. ZBack14 string `name:"ZBack14" note:"扩展"`
  133. ZBack15 string `name:"ZBack15" note:"扩展"`
  134. ZBack16 string `name:"ZBack16" note:"扩展"`
  135. ZBack17 string `name:"ZBack17" note:"扩展"`
  136. ZBack18 string `name:"ZBack18" note:"扩展"`
  137. ZBack19 string `name:"ZBack19" note:"扩展"`
  138. ZBack20 string `name:"ZBack20" note:"扩展"`
  139. ZBack21 string `name:"ZBack21" note:"扩展"`
  140. ZBack22 string `name:"ZBack22" note:"扩展"`
  141. ZBack23 string `name:"ZBack23" note:"扩展"`
  142. ZBack24 string `name:"ZBack24" note:"扩展"`
  143. ZBack25 string `name:"ZBack25" note:"扩展"`
  144. ZBack26 string `name:"ZBack26" note:"扩展"`
  145. ZBack27 string `name:"ZBack27" note:"扩展"`
  146. ZBack28 string `name:"ZBack28" note:"扩展"`
  147. ZBack29 string `name:"ZBack29" note:"扩展"`
  148. ZBack30 string `name:"ZBack30" note:"扩展"`
  149. ZBack31 string `name:"ZBack31" note:"扩展"`
  150. ZBack32 string `name:"ZBack32" note:"扩展"`
  151. ZBack33 string `name:"ZBack33" note:"扩展"`
  152. ZBack34 string `name:"ZBack34" note:"扩展"`
  153. ZBack35 string `name:"ZBack35" note:"扩展"`
  154. ZBack36 string `name:"ZBack36" note:"扩展"`
  155. ZBack37 string `name:"ZBack37" note:"扩展"`
  156. ZBack38 string `name:"ZBack38" note:"扩展"`
  157. ZBack39 string `name:"ZBack39" note:"扩展"`
  158. ZBack40 string `name:"ZBack40" note:"扩展"`
  159. ZBack41 string `name:"ZBack41" note:"扩展"`
  160. ZBack42 string `name:"ZBack42" note:"扩展"`
  161. ZBack43 string `name:"ZBack43" note:"扩展"`
  162. ZBack44 string `name:"ZBack44" note:"扩展"`
  163. ZBack45 string `name:"ZBack45" note:"扩展"`
  164. ZBack46 string `name:"ZBack46" note:"扩展"`
  165. ZBack47 string `name:"ZBack47" note:"扩展"`
  166. ZBack48 string `name:"ZBack48" note:"扩展"`
  167. ZBack49 string `name:"ZBack49" note:"扩展"`
  168. ZBack50 string `name:"ZBack50" note:"扩展"`
  169. ZBack51 string `name:"ZBack51" note:"扩展"`
  170. ZBack52 string `name:"ZBack52" note:"扩展"`
  171. ZBack53 string `name:"ZBack53" note:"扩展"`
  172. ZBack54 string `name:"ZBack54" note:"扩展"`
  173. ZBack55 string `name:"ZBack55" note:"扩展"`
  174. ZBack56 string `name:"ZBack56" note:"扩展"`
  175. ZBack57 string `name:"ZBack57" note:"扩展"`
  176. ZBack58 string `name:"ZBack58" note:"扩展"`
  177. ZBack59 string `name:"ZBack59" note:"扩展"`
  178. ZBack60 string `name:"ZBack60" note:"扩展"`
  179. }
  180. //捐献者日志详情
  181. type DonorsInfo_log struct {
  182. IdCard string `name:"身份证号"` //身份证号
  183. Name string `name:"姓名"` //姓名
  184. Mobile string `name:"电话"` //电话
  185. Telephone string `name:"手机号"` //手机 //扩展项目
  186. Sex int64 `name:"性别" des:"0,男;1,女"` //性别0,男;1,女
  187. InnerNo string `name:"内部编码"` //内部编码
  188. CompanyName string `name:"单位"` //公司
  189. Duty string `name:"职务"` //职务
  190. Birthday time.Time `name:"生日" form:"Birthday,2006-1-2 15:4:5"` //生日
  191. Age int64 `name:"年龄"` //年龄
  192. Email string `name:"邮箱"` //邮箱
  193. Nation string `name:"民族"` //民族
  194. ComeFrom string `name:"籍贯"` //籍贯
  195. HomeAddress string `name:"家庭住址"` //家庭住址
  196. XISNum string `name:"-"` //XIS编号
  197. AdmissionNumber string `name:"住院号"` //住院号
  198. IsInformed int64 `name:"-"` //是否签知情同意书
  199. MaritalStatus int64 `name:"婚姻" des:"0,未婚;1,已婚;2,未知"` //婚姻状态0,未婚;1,已婚;2,未知
  200. PathologicalNum string `name:"病理号"` //病理号
  201. ClinicalDiagnosis string `name:"临床诊断"` //临床诊断
  202. ClinicNum string `name:"门诊号"` //门诊号
  203. CheckNum int64 `name:"-"` //检查次数
  204. CheckPoint string `name:"检查部位"` //检查部位
  205. IllnessName string `name:"病名"` //病名
  206. XPublicState int64 `name:"-"` //是否公开 备用 1公开 0私有
  207. Department string `name:"科室"` //科室
  208. DiagnosticTime time.Time `name:"诊断时间" form:"DiagnosticTime,2006-1-2 15:4:5"` //诊断时间
  209. CreateOn time.Time `name:"添加时间" form:"CreateOn,2006-1-2 15:4:5"`
  210. CreateUserId int64 `name:"-"`
  211. CreateBy string `name:"添加人"`
  212. ModifiedOn time.Time `name:"-" form:"ModifiedOn,2006-1-2 15:4:5"`
  213. ModifiedUserId int64 `name:"-"`
  214. ModifiedBy string `name:"-"`
  215. Remark string `name:"-"`
  216. ZBack11 string `name:"ZBack11" note:"扩展"`
  217. ZBack12 string `name:"ZBack12" note:"扩展"`
  218. ZBack13 string `name:"ZBack13" note:"扩展"`
  219. ZBack14 string `name:"ZBack14" note:"扩展"`
  220. ZBack15 string `name:"ZBack15" note:"扩展"`
  221. ZBack16 string `name:"ZBack16" note:"扩展"`
  222. ZBack17 string `name:"ZBack17" note:"扩展"`
  223. ZBack18 string `name:"ZBack18" note:"扩展"`
  224. ZBack19 string `name:"ZBack19" note:"扩展"`
  225. ZBack20 string `name:"ZBack20" note:"扩展"`
  226. ZBack21 string `name:"ZBack21" note:"扩展"`
  227. ZBack22 string `name:"ZBack22" note:"扩展"`
  228. ZBack23 string `name:"ZBack23" note:"扩展"`
  229. ZBack24 string `name:"ZBack24" note:"扩展"`
  230. ZBack25 string `name:"ZBack25" note:"扩展"`
  231. ZBack26 string `name:"ZBack26" note:"扩展"`
  232. ZBack27 string `name:"ZBack27" note:"扩展"`
  233. ZBack28 string `name:"ZBack28" note:"扩展"`
  234. ZBack29 string `name:"ZBack29" note:"扩展"`
  235. ZBack30 string `name:"ZBack30" note:"扩展"`
  236. ZBack31 string `name:"ZBack31" note:"扩展"`
  237. ZBack32 string `name:"ZBack32" note:"扩展"`
  238. ZBack33 string `name:"ZBack33" note:"扩展"`
  239. ZBack34 string `name:"ZBack34" note:"扩展"`
  240. ZBack35 string `name:"ZBack35" note:"扩展"`
  241. ZBack36 string `name:"ZBack36" note:"扩展"`
  242. ZBack37 string `name:"ZBack37" note:"扩展"`
  243. ZBack38 string `name:"ZBack38" note:"扩展"`
  244. ZBack39 string `name:"ZBack39" note:"扩展"`
  245. ZBack40 string `name:"ZBack40" note:"扩展"`
  246. ZBack41 string `name:"ZBack41" note:"扩展"`
  247. ZBack42 string `name:"ZBack42" note:"扩展"`
  248. ZBack43 string `name:"ZBack43" note:"扩展"`
  249. ZBack44 string `name:"ZBack44" note:"扩展"`
  250. ZBack45 string `name:"ZBack45" note:"扩展"`
  251. ZBack46 string `name:"ZBack46" note:"扩展"`
  252. ZBack47 string `name:"ZBack47" note:"扩展"`
  253. ZBack48 string `name:"ZBack48" note:"扩展"`
  254. ZBack49 string `name:"ZBack49" note:"扩展"`
  255. ZBack50 string `name:"ZBack50" note:"扩展"`
  256. ZBack51 string `name:"ZBack51" note:"扩展"`
  257. ZBack52 string `name:"ZBack52" note:"扩展"`
  258. ZBack53 string `name:"ZBack53" note:"扩展"`
  259. ZBack54 string `name:"ZBack54" note:"扩展"`
  260. ZBack55 string `name:"ZBack55" note:"扩展"`
  261. ZBack56 string `name:"ZBack56" note:"扩展"`
  262. ZBack57 string `name:"ZBack57" note:"扩展"`
  263. ZBack58 string `name:"ZBack58" note:"扩展"`
  264. ZBack59 string `name:"ZBack59" note:"扩展"`
  265. ZBack60 string `name:"ZBack60" note:"扩展"`
  266. }
  267. // @Title 日志列表
  268. // @Description 日志列表
  269. // @Success 200 {object} business.device.DeviceChannels
  270. // @router /list [get]
  271. func (this *LoginfosController) List() {
  272. page := this.GetPageInfoForm()
  273. svc := logsinfo.GetLogsinfoService(utils.DBE)
  274. searchkey := this.GetString("keyword")
  275. //权限
  276. svcuser := baseUser.GetBaseUserService(utils.DBE)
  277. uidint, _ := utils.StrTo(this.User.Id).Int()
  278. uids := svcuser.GetIdbyAcccodeAndUid(this.GetAccode(), uidint)
  279. where := " where Createuserid in (" + strings.Join(uids, ",") + ")"
  280. if searchkey != "" {
  281. where = where + " and ( RecordData like '%" + searchkey + "%' or Createby like '%" + searchkey + "%') "
  282. }
  283. total, list := svc.GetPagingEntitiesWithOrderSearch(page.CurrentPage, page.Size, "Createon desc", where, "")
  284. var datainfo DataInfo
  285. datainfo.Items = list
  286. datainfo.CurrentItemCount = total
  287. this.Data["json"] = &datainfo
  288. this.ServeJSON()
  289. }
  290. // @Title 样本日志列表
  291. // @Description 样本日志列表
  292. // @Success 200 {object} business.device.DeviceChannels
  293. // @router /samplelist [get]
  294. //func (this *LoginfosController) ListSampleLog() {
  295. // var data []logsinfo.SamplesLog
  296. // page := this.GetPageInfoForm()
  297. // CreateBy := this.GetString("CreateBy")
  298. // search := this.GetString("search")
  299. // CreateOnstart, _ := this.GetInt64("CreateOnstart")
  300. // CreateOnend, _ := this.GetInt64("CreateOnend")
  301. // sbarcode := this.GetString("sbarcode")
  302. // id := this.GetString("id")
  303. // where := " 1=1 "
  304. // if id != "" {
  305. // where = where + " and Id= " + id
  306. // }
  307. // if search != "" {
  308. // where = where + " and SampleCode like '%" + search + "%' "
  309. // }
  310. // if sbarcode != "" {
  311. // where = where + " and BarCode like '%" + sbarcode + "%' "
  312. // }
  313. // if CreateBy != "" {
  314. // where = where + "and CreateBy ='" + CreateBy + "'"
  315. // }
  316. // if CreateOnstart != 0 {
  317. // where = where + " and CreateOn >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
  318. // }
  319. // if CreateOnend != 0 {
  320. // where = where + " and CreateOn <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
  321. // }
  322. // svc := samplesinfo.GetSamplesInfoService(utils.DBE)
  323. // total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id", false, &data, where)
  324. // var datainfo DataInfo
  325. // datainfo.Items = data
  326. // datainfo.CurrentItemCount = total
  327. // this.Data["json"] = &datainfo
  328. // this.ServeJSON()
  329. //}
  330. // @Title 样本来源日志列表
  331. // @Description 样本来源日志列表
  332. // @Success 200 {object} business.device.DeviceChannels
  333. // @router /donorlist [get]
  334. //func (this *LoginfosController) ListDonorLog() {
  335. // var data []logsinfo.DonorsLog
  336. // page := this.GetPageInfoForm()
  337. // CreateBy := this.GetString("CreateBy")
  338. // sourcename := this.GetString("sourcename")
  339. // CreateOnstart, _ := this.GetInt64("CreateOnstart")
  340. // CreateOnend, _ := this.GetInt64("CreateOnend")
  341. // optype := this.GetString("optype")
  342. // id := this.GetString("id")
  343. // where := " 1=1 "
  344. // if id != "" {
  345. // where = where + " and Id= " + id
  346. // }
  347. // if sourcename != "" {
  348. // where = where + " and SourceName like '%" + sourcename + "%' "
  349. // }
  350. // if optype != "" {
  351. // where = where + " and OpType like '%" + optype + "%' "
  352. // }
  353. // if CreateBy != "" {
  354. // where = where + "and CreateBy ='" + CreateBy + "'"
  355. // }
  356. // if CreateOnstart != 0 {
  357. // where = where + " and CreateOn >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
  358. // }
  359. // if CreateOnend != 0 {
  360. // where = where + " and CreateOn <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
  361. // }
  362. // svc := donorsinfo.GetDonorsInfoService(utils.DBE)
  363. // total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id", false, &data, where)
  364. // var datainfo DataInfo
  365. // datainfo.Items = data
  366. // datainfo.CurrentItemCount = total
  367. // this.Data["json"] = &datainfo
  368. // this.ServeJSON()
  369. //}
  370. // @Title 样本日志列表
  371. // @Description 样本日志列表
  372. // @Success 200 {object} business.device.DeviceChannels
  373. // @router /operationlist [get]
  374. func (this *LoginfosController) ListOperationLog() {
  375. page := this.GetPageInfoForm()
  376. svc := operationlog.GetOperationLogService(utils.DBE)
  377. var operationloglist []db.Base_OperationLog
  378. CreateOnstart, _ := this.GetInt64("CreateOnstart")
  379. CreateOnend, _ := this.GetInt64("CreateOnend")
  380. tabledesc := this.GetString("tabledesc")
  381. opdesc := this.GetString("opdesc")
  382. createby := this.GetString("createby")
  383. id := this.GetString("id")
  384. where := " AccCode='" + this.User.AccCode + "'"
  385. if id != "" {
  386. where = where + " and Id= " + id
  387. }
  388. if tabledesc != "" {
  389. where = where + " and TableDesc like '%" + tabledesc + "%'"
  390. }
  391. if opdesc != "" {
  392. where = where + " and OpDesc like '%" + opdesc + "%'"
  393. }
  394. if createby != "" {
  395. where = where + "and Createby ='" + createby + "'"
  396. }
  397. if CreateOnstart != 0 {
  398. where = where + " and Createon >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
  399. }
  400. if CreateOnend != 0 {
  401. where = where + " and Createon <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
  402. }
  403. fmt.Println("==================sssssssssssssssssssssssssssssssss")
  404. total := svc.GetPagingEntitiesWithSortCode(page.CurrentPage, page.Size, "Createon desc ", &operationloglist, where)
  405. var datainfo DataInfo
  406. datainfo.Items = operationloglist
  407. datainfo.CurrentItemCount = total
  408. this.Data["json"] = &datainfo
  409. this.ServeJSON()
  410. }
  411. // @Title 登录日志列表
  412. // @Description 登录日志列表
  413. // @Success 200 {object} business.device.DeviceChannels
  414. // @router /loginlist [get]
  415. func (this *LoginfosController) ListLoginLog() {
  416. page := this.GetPageInfoForm()
  417. svc := operationlog.GetOperationLogService(utils.DBE)
  418. var loginloglist []db.Base_LoginLog
  419. loginip := this.GetString("loginip")
  420. loginby := this.GetString("loginby")
  421. CreateOnstart, _ := this.GetInt64("CreateOnstart")
  422. CreateOnend, _ := this.GetInt64("CreateOnend")
  423. where := " AccCode='" + this.User.AccCode + "'"
  424. if loginby != "" {
  425. where = where + "and Loginby like '%" + loginby + "%'"
  426. }
  427. if loginip != "" {
  428. where = where + " and LoginIp like '%" + loginip + "%'"
  429. }
  430. if CreateOnstart != 0 {
  431. where = where + " and Loginon >'" + time.Unix(CreateOnstart, 0).Format("2006-01-02") + "'"
  432. }
  433. if CreateOnend != 0 {
  434. where = where + " and Loginon <'" + time.Unix(CreateOnend, 0).Format("2006-01-02") + " 23:59:59'"
  435. }
  436. total := svc.GetPagingEntitiesWithSortCode(page.CurrentPage, page.Size, "Loginon desc ", &loginloglist, where)
  437. var datainfo DataInfo
  438. datainfo.Items = loginloglist
  439. datainfo.CurrentItemCount = total
  440. this.Data["json"] = &datainfo
  441. this.ServeJSON()
  442. }
  443. // @Title 样本日志列表详情
  444. // @Description 样本日志列表详情
  445. // @Success 200 {object} business.device.DeviceChannels
  446. // @router /samplelistinfo [get]
  447. //func (this *LoginfosController) SamplesInfo() {
  448. // id := this.GetString("id")
  449. // svc := samplesinfo.GetSamplesInfoService(utils.DBE)
  450. // logmodel := svc.GetContantById(this.User.AccCode+SamplesLogtbName, id)
  451. // this.Data["logmodel"] = logmodel
  452. // switch logmodel.TableName {
  453. // case "SamplesMain":
  454. // this.GetLog_Info(logmodel.TableName, logmodel, svc, &SamplesMain_Log{}, &SamplesMain_Log{}, logmodel.SampleType)
  455. // case "SamplesInfoShow":
  456. // this.GetLog_Info(logmodel.TableName, logmodel, svc, &SamplesInfoShow_Log{}, &SamplesInfoShow_Log{}, logmodel.SampleType)
  457. // }
  458. //}
  459. //func (this *LoginfosController) GetLog_Info(tname string, logmodel *mydb.SamplesLog, svc *samplesinfo.SamplesInfoService, m1 interface{}, m2 interface{}, sampletype int) {
  460. // json.Unmarshal([]byte(logmodel.RecordData), m1)
  461. // var datatr2 string
  462. // if logmodel.TableName == "SamplesMain" {
  463. // datatr2 = svc.GetNextContantById(this.User.AccCode+SamplesLogtbName, utils.ToStr(logmodel.Id), this.User.AccCode+SamplesMaintbName, logmodel.MId, m2)
  464. // } else if logmodel.TableName == "SamplesInfoShow" {
  465. // datatr2 = svc.GetNextContantShowInfoById(this.User.AccCode+SamplesLogtbName, utils.ToStr(logmodel.Id), logmodel.RecordId, m2, this.User.AccCode)
  466. // }
  467. // json.Unmarshal([]byte(datatr2), m2)
  468. // maplistpublic, maplistprivate := GetSamplePublicNoteNameMap(this.User.AccCode)
  469. // data := LogcomparefuncByNoteSample(m1, m2, maplistpublic, maplistprivate, sampletype)
  470. // var datainfo DataInfo
  471. // datainfo.Items = data
  472. // this.Data["json"] = &datainfo
  473. // this.ServeJSON()
  474. //}
  475. func LogcomparefuncByNoteSample(m1, m2 interface{}, map_listpublic, map_listprivate map[string]string, sampletype int) []Logcompare {
  476. objT1 := reflect.TypeOf(m1).Elem()
  477. objT2 := reflect.TypeOf(m2).Elem()
  478. list := make([]Logcompare, 0)
  479. if objT1 == objT2 {
  480. objV1 := reflect.ValueOf(m1).Elem()
  481. objV2 := reflect.ValueOf(m2).Elem()
  482. for i := 0; i < objT1.NumField(); i++ {
  483. fieldT := objT1.Field(i)
  484. field := fieldT.Name
  485. name := fieldT.Tag.Get("name")
  486. if name == "-" {
  487. continue
  488. }
  489. switch fieldT.Type.Kind() {
  490. case reflect.Int, reflect.Int32, reflect.Int64:
  491. des := fieldT.Tag.Get("des")
  492. if des != "" {
  493. v1str, v2str := "", ""
  494. v1 := objV1.FieldByName(field).Int()
  495. v2 := objV2.FieldByName(field).Int()
  496. desarr := strings.Split(des, ";")
  497. for _, v := range desarr {
  498. if strings.Split(v, ",")[0] == utils.ToStr(v1) {
  499. v1str = strings.Split(v, ",")[1]
  500. }
  501. if strings.Split(v, ",")[0] == utils.ToStr(v2) {
  502. v2str = strings.Split(v, ",")[1]
  503. }
  504. }
  505. list = append(list, Logcompare{name, field, v1str, v2str})
  506. } else {
  507. v1 := objV1.FieldByName(field).Int()
  508. v2 := objV2.FieldByName(field).Int()
  509. list = append(list, Logcompare{name, field, v1, v2})
  510. }
  511. case reflect.Float32, reflect.Float64:
  512. v1 := objV1.FieldByName(field).Float()
  513. v2 := objV2.FieldByName(field).Float()
  514. list = append(list, Logcompare{name, field, v1, v2})
  515. case reflect.String:
  516. des := fieldT.Tag.Get("des")
  517. if des != "" {
  518. v1str, v2str := "", ""
  519. v1 := objV1.FieldByName(field).String()
  520. v2 := objV2.FieldByName(field).String()
  521. desarr := strings.Split(des, ";")
  522. for _, v := range desarr {
  523. if strings.Split(v, ",")[0] == utils.ToStr(v1) {
  524. v1str = strings.Split(v, ",")[1]
  525. }
  526. if strings.Split(v, ",")[0] == utils.ToStr(v2) {
  527. v2str = strings.Split(v, ",")[1]
  528. }
  529. }
  530. list = append(list, Logcompare{name, field, v1str, v2str})
  531. } else {
  532. v1 := objV1.FieldByName(field).String()
  533. v2 := objV2.FieldByName(field).String()
  534. note := fieldT.Tag.Get("note")
  535. if note == "扩展" {
  536. notename := map_listpublic[name]
  537. if notename != "" {
  538. list = append(list, Logcompare{notename, field, v1, v2})
  539. } else {
  540. privatenotename := map_listprivate[name+"-"+utils.ToStr(sampletype)]
  541. if privatenotename != "" {
  542. list = append(list, Logcompare{privatenotename, field, v1, v2})
  543. }
  544. }
  545. } else {
  546. list = append(list, Logcompare{name, field, v1, v2})
  547. }
  548. }
  549. case reflect.Struct:
  550. switch fieldT.Type.String() {
  551. case "time.Time":
  552. stype := fieldT.Tag.Get("stype")
  553. if stype == "" {
  554. stype = "D"
  555. }
  556. v1 := objV1.FieldByName(field).Interface().(time.Time)
  557. v2 := objV2.FieldByName(field).Interface().(time.Time)
  558. list = append(list, Logcompare{name, field, v1, v2})
  559. }
  560. }
  561. }
  562. }
  563. return list
  564. }
  565. // @Title 样本日志列表详情
  566. // @Description 样本日志列表详情
  567. // @Success 200 {object} business.device.DeviceChannels
  568. // @router /donorlistinfo [get]
  569. //func (this *LoginfosController) DonorsInfo() {
  570. // id := this.GetString("id")
  571. // svc := donorsinfo.GetDonorsInfoService(utils.DBE)
  572. // logmodel := svc.GetContantById(this.User.AccCode+DonorslogtbName, id)
  573. // this.Data["logmodel"] = logmodel
  574. // switch logmodel.TableName {
  575. // case "DonorsInfo":
  576. // this.GetLog_DonorsInfo(logmodel.TableName, logmodel, svc, &DonorsInfo_log{}, &DonorsInfo_log{})
  577. // }
  578. //}
  579. //func (this *LoginfosController) GetLog_DonorsInfo(tname string, logmodel *mydb.DonorsLog, svc *donorsinfo.DonorsInfoService, m1 interface{}, m2 interface{}) {
  580. // json.Unmarshal([]byte(logmodel.RecordData), m1)
  581. // datatr2 := svc.GetNextContantById(this.User.AccCode+DonorslogtbName, utils.ToStr(logmodel.Id), this.User.AccCode+DonorstbName, logmodel.RecordId, m2)
  582. // json.Unmarshal([]byte(datatr2), m2)
  583. // maplist := GetDonorNoteNameMap(this.User.AccCode)
  584. // data := LogcomparefuncByNote(m1, m2, maplist)
  585. // var datainfo DataInfo
  586. // datainfo.Items = data
  587. // this.Data["json"] = &datainfo
  588. // this.ServeJSON()
  589. //}
  590. //func GetDonorNoteNameMap(acccode string) map[string]string {
  591. // svcdnote := extend.GetExtendService(utils.DBE)
  592. // where1 := " AccCode='" + acccode + "' "
  593. // var DnoteitemList []extend.DonorsNoteItem
  594. // DnoteitemList = svcdnote.GetDNoteItemList(where1)
  595. // map_list := make(map[string]string)
  596. // for i := 0; i < len(DnoteitemList); i++ {
  597. // map_list[utils.ToStr(DnoteitemList[i].FieldName)] = DnoteitemList[i].Name
  598. // }
  599. // return map_list
  600. //}
  601. func LogcomparefuncByNote(m1, m2 interface{}, map_list map[string]string) []Logcompare {
  602. objT1 := reflect.TypeOf(m1).Elem()
  603. objT2 := reflect.TypeOf(m2).Elem()
  604. list := make([]Logcompare, 0)
  605. if objT1 == objT2 {
  606. objV1 := reflect.ValueOf(m1).Elem()
  607. objV2 := reflect.ValueOf(m2).Elem()
  608. for i := 0; i < objT1.NumField(); i++ {
  609. fieldT := objT1.Field(i)
  610. field := fieldT.Name
  611. name := fieldT.Tag.Get("name")
  612. if name == "-" {
  613. continue
  614. }
  615. switch fieldT.Type.Kind() {
  616. case reflect.Int, reflect.Int32, reflect.Int64:
  617. des := fieldT.Tag.Get("des")
  618. if des != "" {
  619. v1str, v2str := "", ""
  620. v1 := objV1.FieldByName(field).Int()
  621. v2 := objV2.FieldByName(field).Int()
  622. desarr := strings.Split(des, ";")
  623. for _, v := range desarr {
  624. if strings.Split(v, ",")[0] == utils.ToStr(v1) {
  625. v1str = strings.Split(v, ",")[1]
  626. }
  627. if strings.Split(v, ",")[0] == utils.ToStr(v2) {
  628. v2str = strings.Split(v, ",")[1]
  629. }
  630. }
  631. list = append(list, Logcompare{name, field, v1str, v2str})
  632. } else {
  633. v1 := objV1.FieldByName(field).Int()
  634. v2 := objV2.FieldByName(field).Int()
  635. list = append(list, Logcompare{name, field, v1, v2})
  636. }
  637. case reflect.Float32, reflect.Float64:
  638. v1 := objV1.FieldByName(field).Float()
  639. v2 := objV2.FieldByName(field).Float()
  640. list = append(list, Logcompare{name, field, v1, v2})
  641. case reflect.String:
  642. des := fieldT.Tag.Get("des")
  643. if des != "" {
  644. v1str, v2str := "", ""
  645. v1 := objV1.FieldByName(field).String()
  646. v2 := objV2.FieldByName(field).String()
  647. desarr := strings.Split(des, ";")
  648. for _, v := range desarr {
  649. if strings.Split(v, ",")[0] == utils.ToStr(v1) {
  650. v1str = strings.Split(v, ",")[1]
  651. }
  652. if strings.Split(v, ",")[0] == utils.ToStr(v2) {
  653. v2str = strings.Split(v, ",")[1]
  654. }
  655. }
  656. list = append(list, Logcompare{name, field, v1str, v2str})
  657. } else {
  658. v1 := objV1.FieldByName(field).String()
  659. v2 := objV2.FieldByName(field).String()
  660. note := fieldT.Tag.Get("note")
  661. if note == "扩展" {
  662. notename := map_list[name]
  663. if notename != "" {
  664. list = append(list, Logcompare{notename, field, v1, v2})
  665. }
  666. } else {
  667. list = append(list, Logcompare{name, field, v1, v2})
  668. }
  669. }
  670. case reflect.Struct:
  671. switch fieldT.Type.String() {
  672. case "time.Time":
  673. stype := fieldT.Tag.Get("stype")
  674. if stype == "" {
  675. stype = "D"
  676. }
  677. v1 := objV1.FieldByName(field).Interface().(time.Time)
  678. v2 := objV2.FieldByName(field).Interface().(time.Time)
  679. list = append(list, Logcompare{name, field, v1, v2})
  680. }
  681. }
  682. }
  683. }
  684. return list
  685. }
  686. // @Title 操作日志列表详情
  687. // @Description 操作日志列表详情
  688. // @Success 200 {object} business.device.DeviceChannels
  689. // @router /operationslistinfo [get]
  690. func (this *LoginfosController) OperationsInfo() {
  691. id := this.GetString("id")
  692. svc := operationlog.GetOperationLogService(utils.DBE)
  693. logmodel := svc.GetContantById(id)
  694. this.Data["logmodel"] = logmodel
  695. switch logmodel.TName {
  696. case "Equipment":
  697. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Equipment_Log{}, &logsinfo.Equipment_Log{})
  698. case "Shelf":
  699. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Shelf_Log{}, &logsinfo.Shelf_Log{})
  700. case "Box":
  701. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Box_Log{}, &logsinfo.Box_Log{})
  702. case "SampleType":
  703. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.SampleType_Log{}, &logsinfo.SampleType_Log{})
  704. case "STypeNoteItem":
  705. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.STypeNoteItem_Log{}, &logsinfo.STypeNoteItem_Log{})
  706. case "SamplesNoteItem":
  707. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.SamplesNoteItem_Log{}, &logsinfo.SamplesNoteItem_Log{})
  708. case "DonorsNoteItem":
  709. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.DonorsNoteItem_Log{}, &logsinfo.DonorsNoteItem_Log{})
  710. case "SampleOrgan":
  711. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.SampleOrgan_Log{}, &logsinfo.SampleOrgan_Log{})
  712. case "CodeRule":
  713. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.CodeRule_Log{}, &logsinfo.CodeRule_Log{})
  714. case "CodeRuleDetail":
  715. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.CodeRuleDetail_Log{}, &logsinfo.CodeRuleDetail_Log{})
  716. case "PrintScheme":
  717. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.PrintScheme_Log{}, &logsinfo.PrintScheme_Log{})
  718. case "FamilyMan":
  719. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FamilyMan_Log{}, &logsinfo.FamilyMan_Log{})
  720. case "FamilyManDetail":
  721. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FamilyManDetail_Log{}, &logsinfo.FamilyManDetail_Log{})
  722. case "FlupPlan":
  723. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FlupPlan_Log{}, &logsinfo.FlupPlan_Log{})
  724. case "FlupRecord":
  725. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.FlupRecord_Log{}, &logsinfo.FlupRecord_Log{})
  726. case "TriggerAction":
  727. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.TriggerAction_Log{}, &logsinfo.TriggerAction_Log{})
  728. case "Actions":
  729. this.GetLog_OperationsInfo(logmodel.TName, logmodel, svc, &logsinfo.Actions_Log{}, &logsinfo.Actions_Log{})
  730. }
  731. }
  732. func (this *LoginfosController) GetLog_OperationsInfo(tname string, logmodel *operationlog.Logsinfo, svc *operationlog.OperationLogService, m1 interface{}, m2 interface{}) {
  733. json.Unmarshal([]byte(logmodel.RecordData), m1)
  734. datatr2 := svc.GetNextContantById(utils.ToStr(logmodel.Id), logmodel.TName, tname, logmodel.RecordId, m2)
  735. json.Unmarshal([]byte(datatr2), m2)
  736. data := Logcomparefunc2(m1, m2)
  737. var datainfo DataInfo
  738. datainfo.Items = data
  739. this.Data["json"] = &datainfo
  740. this.ServeJSON()
  741. }
  742. func Logcomparefunc2(m1, m2 interface{}) []Logcompare {
  743. objT1 := reflect.TypeOf(m1).Elem()
  744. objT2 := reflect.TypeOf(m2).Elem()
  745. list := make([]Logcompare, 0)
  746. if objT1 == objT2 {
  747. objV1 := reflect.ValueOf(m1).Elem()
  748. objV2 := reflect.ValueOf(m2).Elem()
  749. for i := 0; i < objT1.NumField(); i++ {
  750. fieldT := objT1.Field(i)
  751. field := fieldT.Name
  752. name := fieldT.Tag.Get("name")
  753. if name == "-" {
  754. continue
  755. }
  756. switch fieldT.Type.Kind() {
  757. case reflect.Int, reflect.Int32, reflect.Int64:
  758. des := fieldT.Tag.Get("des")
  759. if des != "" {
  760. v1str, v2str := "", ""
  761. v1 := objV1.FieldByName(field).Int()
  762. v2 := objV2.FieldByName(field).Int()
  763. desarr := strings.Split(des, ";")
  764. for _, v := range desarr {
  765. if strings.Split(v, ",")[0] == utils.ToStr(v1) {
  766. v1str = strings.Split(v, ",")[1]
  767. }
  768. if strings.Split(v, ",")[0] == utils.ToStr(v2) {
  769. v2str = strings.Split(v, ",")[1]
  770. }
  771. }
  772. list = append(list, Logcompare{name, field, v1str, v2str})
  773. } else {
  774. v1 := objV1.FieldByName(field).Int()
  775. v2 := objV2.FieldByName(field).Int()
  776. list = append(list, Logcompare{name, field, v1, v2})
  777. }
  778. case reflect.Float32, reflect.Float64:
  779. v1 := objV1.FieldByName(field).Float()
  780. v2 := objV2.FieldByName(field).Float()
  781. list = append(list, Logcompare{name, field, v1, v2})
  782. case reflect.String:
  783. des := fieldT.Tag.Get("des")
  784. if des != "" {
  785. v1str, v2str := "", ""
  786. v1 := objV1.FieldByName(field).String()
  787. v2 := objV2.FieldByName(field).String()
  788. desarr := strings.Split(des, ";")
  789. for _, v := range desarr {
  790. if strings.Split(v, ",")[0] == utils.ToStr(v1) {
  791. v1str = strings.Split(v, ",")[1]
  792. }
  793. if strings.Split(v, ",")[0] == utils.ToStr(v2) {
  794. v2str = strings.Split(v, ",")[1]
  795. }
  796. }
  797. list = append(list, Logcompare{name, field, v1str, v2str})
  798. } else {
  799. v1 := objV1.FieldByName(field).String()
  800. v2 := objV2.FieldByName(field).String()
  801. list = append(list, Logcompare{name, field, v1, v2})
  802. }
  803. case reflect.Struct:
  804. switch fieldT.Type.String() {
  805. case "time.Time":
  806. stype := fieldT.Tag.Get("stype")
  807. if stype == "" {
  808. stype = "D"
  809. }
  810. v1 := objV1.FieldByName(field).Interface().(time.Time)
  811. v2 := objV2.FieldByName(field).Interface().(time.Time)
  812. list = append(list, Logcompare{name, field, v1, v2})
  813. }
  814. }
  815. }
  816. }
  817. return list
  818. }