|
|
@@ -128,6 +128,51 @@ func (s *SamplesInfoService) GetPagingEntitiesWithTb(acccode string, pageIndex,
|
|
|
return total, List
|
|
|
}
|
|
|
|
|
|
+func (s *SamplesInfoService) GetPagingEntitiesWithDonorsTb(acccode string, pageIndex, itemsPerPage int64, tbldonor, order, where string) (int64, []SamplesInfoList) {
|
|
|
+ var err error
|
|
|
+ var total int64
|
|
|
+ if order != "" {
|
|
|
+ order = " order by " + order
|
|
|
+ }
|
|
|
+ //获取总记录数
|
|
|
+ if where == "" {
|
|
|
+ where = "1=1"
|
|
|
+ }
|
|
|
+ tbldetail := acccode + SamplesDetailtbName
|
|
|
+ tblmain := acccode + SamplesMaintbName
|
|
|
+ groupdetail := acccode + GroupDetailName
|
|
|
+
|
|
|
+ sqlCount := " select count(*) from " + tbldetail + " a left join " + tblmain + " b on a.SampleCode = b.SampleCode left join " + tbldonor + " c on b.SourceId = c.Id left join Shelf d on a.ShelfId=d.Id left join Box e on a.BoxId=e.Id left join Equipment f on a.EquipmentId=f.Id left join " + groupdetail + " g on g.SampleId=a.Id where " + where
|
|
|
+
|
|
|
+ fmt.Println(sqlCount)
|
|
|
+ var sql string
|
|
|
+
|
|
|
+ sql = ` select a.*,b.*,c.*,d.XStation ShelfX,d.YStation ShelfY,d.Code ShelfCode,e.XStation BoxX,e.YStation BoxY,e.Code BoxCode,f.Id Eid,f.Name EName,f.Code ECode,g.GroupId,g.GroupName from ` + tbldetail + ` a
|
|
|
+ left join ` + tblmain + ` b on a.SampleCode = b.SampleCode
|
|
|
+ left join ` + tbldonor + ` c on b.SourceId = c.Id
|
|
|
+ left join Shelf d on a.ShelfId=d.Id
|
|
|
+ left join Box e on a.BoxId=e.Id
|
|
|
+ left join Equipment f on a.EquipmentId=f.Id
|
|
|
+ left join ` + groupdetail + ` g on g.SampleId=a.Id
|
|
|
+ where ` + where + order + `
|
|
|
+ limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage) + ""
|
|
|
+ fmt.Println(sql)
|
|
|
+ List := make([]SamplesInfoList, 0)
|
|
|
+ utils.DBE.Sql(sql).Find(&List)
|
|
|
+ resultsSlice, err := s.DBE.Query(sqlCount)
|
|
|
+ LogError(err)
|
|
|
+
|
|
|
+ if len(resultsSlice) > 0 {
|
|
|
+ results := resultsSlice[0]
|
|
|
+ for _, value := range results {
|
|
|
+ total, err = strconv.ParseInt(string(value), 10, 64)
|
|
|
+ LogError(err)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total, List
|
|
|
+}
|
|
|
+
|
|
|
//质控随机显示
|
|
|
func (s *SamplesInfoService) GetPagingEntitiesSearch(acccode string, page, size string, order, where string) (int64, []SamplesInfoList) {
|
|
|
var err error
|