|
|
@@ -655,10 +655,10 @@ func (this *SamplesSourceController) EditImage() {
|
|
|
// @Title 获取动物样本来源列表
|
|
|
// @Description get user by token
|
|
|
// @Success 200 {object} models.Userblood
|
|
|
-// @router /samplesanimallist [get]
|
|
|
-func (this *SamplesSourceController) SamplesAnimalList() {
|
|
|
+// @router /animallist [get]
|
|
|
+func (this *SamplesSourceController) AnimalList() {
|
|
|
page := this.GetPageInfoForm()
|
|
|
- var list []samplessource.Microbial
|
|
|
+ var list []samplessource.AnimalInfo
|
|
|
genus := this.GetString("Genus")
|
|
|
name := this.GetString("Name")
|
|
|
tive := this.GetString("Tive")
|
|
|
@@ -711,7 +711,7 @@ func (this *SamplesSourceController) InnerNoMakeSure() {
|
|
|
InnerNo := this.GetString("InnerNo")
|
|
|
svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
where := " InnerNo= '" + InnerNo + "'"
|
|
|
- total := svc.GetInnerNo(this.User.AccCode+MicrobialName, where)
|
|
|
+ total := svc.GetInnerNo(this.User.AccCode+AnimaltbName, where)
|
|
|
var datainfo DataInfo
|
|
|
datainfo.Items = total
|
|
|
this.Data["json"] = &datainfo
|
|
|
@@ -722,14 +722,14 @@ func (this *SamplesSourceController) InnerNoMakeSure() {
|
|
|
// @Success 200 {object}
|
|
|
// @router /saveanimal [post]
|
|
|
func (this *SamplesSourceController) SaveAnimal() {
|
|
|
- var model samplessource.Microbial
|
|
|
+ var model samplessource.AnimalInfo
|
|
|
var jsonblob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonblob, &model)
|
|
|
model.AccCode = this.User.AccCode
|
|
|
model.CreateBy = this.User.Realname
|
|
|
model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
- _, err := svc.InsertEntityBytbl(this.User.AccCode+MicrobialName, &model)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+AnimaltbName, &model)
|
|
|
var errinfo ErrorDataInfo
|
|
|
if err == nil {
|
|
|
errinfo.Message = "操作成功!"
|
|
|
@@ -745,16 +745,16 @@ func (this *SamplesSourceController) SaveAnimal() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @Title 获取客户基本信息
|
|
|
+// @Title 获取动物样本源基本信息
|
|
|
// @Description get user by token
|
|
|
// @Success 200 {object} models.Userblood
|
|
|
// @router /getanimalinfo [get]
|
|
|
func (this *SamplesSourceController) GetAnimalDetail() {
|
|
|
Id := this.GetString("Id")
|
|
|
- var entity samplessource.Microbial
|
|
|
+ var entity samplessource.AnimalInfo
|
|
|
svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
where := " Id ='" + Id + "'"
|
|
|
- svc.GetEntityByWhere(this.User.AccCode+MicrobialName, where, &entity)
|
|
|
+ svc.GetEntityByWhere(this.User.AccCode+AnimaltbName, where, &entity)
|
|
|
var datainfo DataInfo
|
|
|
datainfo.Items = entity
|
|
|
this.Data["json"] = &datainfo
|
|
|
@@ -776,10 +776,10 @@ func (this *SamplesSourceController) EditAnimal() {
|
|
|
this.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- var model samplessource.Microbial
|
|
|
+ var model samplessource.AnimalInfo
|
|
|
var jsonblob = this.Ctx.Input.RequestBody
|
|
|
json.Unmarshal(jsonblob, &model)
|
|
|
- var entity samplessource.Microbial
|
|
|
+ var entity samplessource.AnimalInfo
|
|
|
model.ModifiedBy = this.User.Realname
|
|
|
model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
@@ -789,9 +789,7 @@ func (this *SamplesSourceController) EditAnimal() {
|
|
|
cols = append(cols, zback[i].Id)
|
|
|
}
|
|
|
opdesc := "修改样本来源-" + model.Name
|
|
|
- err := svc.UpdateDonorAndWriteLogBytbl(this.User.AccCode+MicrobialName, this.User.AccCode+DonorslogtbName, id, &model, &entity, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, model.Name)
|
|
|
- // opdesc := "修改样本来源-" + model.Name
|
|
|
- //err := svc.UpdateSample(this.User.AccCode+MicrobialName, id, &model, cols)
|
|
|
+ err := svc.UpdateDonorAndWriteLogBytbl(this.User.AccCode+AnimaltbName, this.User.AccCode+DonorslogtbName, id, &model, &entity, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, model.Name)
|
|
|
|
|
|
if err == nil {
|
|
|
errinfo.Message = "操作成功!"
|
|
|
@@ -821,11 +819,177 @@ func (this *SamplesSourceController) DelBioInfo() {
|
|
|
this.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
- var entity samplessource.Microbial
|
|
|
- var entityempty samplessource.Microbial
|
|
|
+ var entity samplessource.AnimalInfo
|
|
|
+ var entityempty samplessource.AnimalInfo
|
|
|
+ opdesc := "删除生物样本源-" + id
|
|
|
+ svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
+ err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+AnimaltbName, BaseOperationLogName, id, &entity, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "样本来源")
|
|
|
+ if err == nil {
|
|
|
+ errinfo.Message = "删除成功"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取动物样本来源列表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /microbiallist [get]
|
|
|
+func (this *SamplesSourceController) MicrobialList() {
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ var list []samplessource.MicrobialInfo
|
|
|
+ genus := this.GetString("genus")
|
|
|
+ name := this.GetString("name")
|
|
|
+ tive := this.GetString("tive")
|
|
|
+ innerno := this.GetString("innerno")
|
|
|
+ weight := this.GetString("weight")
|
|
|
+ svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
+ where := " 1=1"
|
|
|
+ orderby := "CreateOn"
|
|
|
+ asc := false
|
|
|
+ Order := this.GetString("Order")
|
|
|
+ Prop := this.GetString("Prop")
|
|
|
+ if Order != "" && Prop != "" {
|
|
|
+ orderby = Prop
|
|
|
+ if Order == "asc" {
|
|
|
+ asc = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if genus != "" {
|
|
|
+ where = where + " and Genus = '" + genus + "'"
|
|
|
+ }
|
|
|
+ if name != "" {
|
|
|
+ where = where + " and Name like '%" + name + "%'"
|
|
|
+ }
|
|
|
+ if tive != "" {
|
|
|
+ where = where + " and Tive =" + tive + " "
|
|
|
+ }
|
|
|
+ if innerno != "" {
|
|
|
+ where = where + " and InnerNo = '" + innerno + "'"
|
|
|
+ }
|
|
|
+ if weight != "" {
|
|
|
+ where = where + " and Weight = '" + weight + "'"
|
|
|
+ }
|
|
|
+ total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 新增微生物来源基本信息
|
|
|
+// @Success 200 {object}
|
|
|
+// @router /savemicro [post]
|
|
|
+func (this *SamplesSourceController) SaveMicro() {
|
|
|
+ var model samplessource.MicrobialInfo
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ model.AccCode = this.User.AccCode
|
|
|
+ model.CreateBy = this.User.Realname
|
|
|
+ model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+MicrobialtbName, &model)
|
|
|
+ var errinfo ErrorDataInfo
|
|
|
+ if err == nil {
|
|
|
+ errinfo.Message = "操作成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ errinfo.Item = model.Id
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "操作失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取微生物样本源基本信息
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getmicrobialinfo [get]
|
|
|
+func (this *SamplesSourceController) GetMicrobialDetail() {
|
|
|
+ Id := this.GetString("Id")
|
|
|
+ var entity samplessource.MicrobialInfo
|
|
|
+ svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
+ where := " Id ='" + Id + "'"
|
|
|
+ svc.GetEntityByWhere(this.User.AccCode+MicrobialtbName, where, &entity)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = entity
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 更新微生物基本信息
|
|
|
+// @Description 更新微生物基本信息
|
|
|
+// @Param id path string true "需要修改的试管信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /editmicro/:id [put]
|
|
|
+func (this *SamplesSourceController) EditMicro() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var model samplessource.MicrobialInfo
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ var entity samplessource.MicrobialInfo
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
+ var cols []string = []string{"Genus", "InnerNo", "Name", "Amount", "Unit", "SourceType", "Weight", "Remark", "ModifiedBy", "ModifiedUserId"}
|
|
|
+ zback := svc.QueryZBackList(this.User.AccCode)
|
|
|
+ for i := 0; i < (len(zback)); i++ {
|
|
|
+ cols = append(cols, zback[i].Id)
|
|
|
+ }
|
|
|
+ opdesc := "修改样本来源-" + model.Name
|
|
|
+ err := svc.UpdateDonorAndWriteLogBytbl(this.User.AccCode+MicrobialtbName, this.User.AccCode+DonorslogtbName, id, &model, &entity, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, model.Name)
|
|
|
+
|
|
|
+ if err == nil {
|
|
|
+ errinfo.Message = "操作成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+ errinfo.Message = "操作失败!" + utils.AlertProcess(err.Error())
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 删除微生物样本来源信息
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /delmicrobial/:id [delete]
|
|
|
+func (this *SamplesSourceController) DelMicrobial() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var entity samplessource.MicrobialInfo
|
|
|
+ var entityempty samplessource.MicrobialInfo
|
|
|
opdesc := "删除生物样本源-" + id
|
|
|
svc := samplessource.GetSamplesSourceService(utils.DBE)
|
|
|
- err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+MicrobialName, BaseOperationLogName, id, &entity, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "样本来源")
|
|
|
+ err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+MicrobialtbName, BaseOperationLogName, id, &entity, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "样本来源")
|
|
|
if err == nil {
|
|
|
errinfo.Message = "删除成功"
|
|
|
errinfo.Code = 0
|