|
|
@@ -0,0 +1,1230 @@
|
|
|
+package biobank
|
|
|
+
|
|
|
+import (
|
|
|
+ "encoding/json"
|
|
|
+ "strings"
|
|
|
+
|
|
|
+ "dashoo.cn/backend/api/business/inspectionproject"
|
|
|
+ "dashoo.cn/backend/api/business/organize"
|
|
|
+ . "dashoo.cn/backend/api/controllers"
|
|
|
+ "dashoo.cn/utils"
|
|
|
+)
|
|
|
+
|
|
|
+// Operations about Users
|
|
|
+type InspectionController struct {
|
|
|
+ BaseController
|
|
|
+}
|
|
|
+
|
|
|
+// 检测套餐model
|
|
|
+type Packagemodel struct {
|
|
|
+ Itemlist []string `json:"itemlist"`
|
|
|
+ SelectPacktype string `json:"selectpacktype"`
|
|
|
+}
|
|
|
+
|
|
|
+// TestListIdmodel
|
|
|
+type TestListIdModel struct {
|
|
|
+ TestListId int
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据ID查检验项目明细
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inspectiondelte/:Id [get]
|
|
|
+func (this *InspectionController) Inspectiondelte() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ where := " TestListId=" + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ list := svc.QueryinspectionEntity(this.User.AccCode+TestItemsListName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据用户AccCode get检验主表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inspectionviewlist [get]
|
|
|
+func (this *InspectionController) Inspectionviewlist() {
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ searchkey := this.GetString("searchkey")
|
|
|
+ var list []inspectionproject.TestList
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ if searchkey != "" {
|
|
|
+ where = where + " and (TestName like '%" + searchkey + "%')"
|
|
|
+ }
|
|
|
+ total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id ", true, &list, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加检验项目
|
|
|
+// @Description 新增检验项目
|
|
|
+// @Param body body business.device.DeviceChannels "检验项目信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router / [post]
|
|
|
+func (this *InspectionController) AddPost() {
|
|
|
+ var testlistentity inspectionproject.TestList
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &testlistentity)
|
|
|
+ testlistentity.CreateBy = this.User.Realname
|
|
|
+ testlistentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestListName, &testlistentity)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ 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 get主表详情
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inspectiondetail [get]
|
|
|
+func (this *InspectionController) InspectionDetailviewlist() {
|
|
|
+ TestName := this.GetString("TestName")
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " a.TestName='" + TestName + "' "
|
|
|
+ list := svc.InspectionDetail(this.User.AccCode+TestItemsListName, this.User.AccCode+TestListDetailName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 查询所有质控项
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inquireallqc [get]
|
|
|
+func (this *InspectionController) InquireAllQC() {
|
|
|
+ where := " IsQC=1 "
|
|
|
+ testlistid := this.GetString("testlistid")
|
|
|
+ if testlistid != "" {
|
|
|
+ where += " and TestListId = " + testlistid
|
|
|
+ }
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ list := svc.QueryinspectionEntity(this.User.AccCode+TestItemsListName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 删除单条信息
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /inspdelete/:Id [delete]
|
|
|
+func (this *InspectionController) Inspdelete() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " Id= " + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestListName, where)
|
|
|
+ where2 := " TestListId = " + Id
|
|
|
+ err2 := svc.DeleteEntityBytbl(this.User.AccCode+TestItemsListName, where2)
|
|
|
+ if err == nil && err2 == 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 根据用户AccCode编辑检验项目
|
|
|
+// @Description 编辑检验项目
|
|
|
+// @Param id path string true "需要修改的传感器编号"
|
|
|
+// @Param body body business.device.DeviceChannels "传感器信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /edititem [put]
|
|
|
+func (this *InspectionController) EditItem() {
|
|
|
+ TestListId := this.GetString("TestListId")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if TestListId == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var model inspectionproject.TestItemsList
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " TestListId= " + TestListId
|
|
|
+ // arr := strings.Join(model.Sensors, ",")
|
|
|
+ err := svc.UpdateTestItemsList(this.User.AccCode+TestItemsListName, "", where)
|
|
|
+
|
|
|
+ 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 get主表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /allinspectionviewlist [get]
|
|
|
+func (this *InspectionController) AllInspectionviewlist() {
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ list := make([]inspectionproject.TestList, 0)
|
|
|
+ total := svc.GetPagingWithSortCode("LabId desc", this.User.AccCode, &list, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据检验ID 查询质控项
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /labtestqc/:id [get]
|
|
|
+func (this *InspectionController) LabTestQC() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ where := " TestListId= " + id + " "
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ list := svc.QueryQCEntityByTestId(this.User.AccCode+TestItemsListName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据实验室ID get检验
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /gettestbylabid/:LabId [get]
|
|
|
+func (this *InspectionController) GetTestByLabId() {
|
|
|
+ LabId := this.Ctx.Input.Param(":LabId")
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " LabId= " + LabId
|
|
|
+ list := svc.GetPaginginspviewlist(this.User.AccCode+TestListName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 查询所有实验室
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getlaboratorys [get]
|
|
|
+func (this *InspectionController) Getlaboratorys() {
|
|
|
+ where := " 1=1 "
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ var list []inspectionproject.TestLaboratory
|
|
|
+ svc.GetEntitysByWhere(this.User.AccCode+TestLaboratoryName, where, &list)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取编辑时的样本类型信息
|
|
|
+// @Description 获取编辑时的样本类型信息
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /getmodel/:id [get]
|
|
|
+func (this *InspectionController) GetModel() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var model inspectionproject.TestList
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(this.User.AccCode+TestListName, id, &model) //修改时获取列表
|
|
|
+ this.Data["json"] = &model
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑检测项目
|
|
|
+// @Description 编辑检测项目
|
|
|
+// @Param id path string true "需要修改的传感器编号"
|
|
|
+// @Param body body business.device.DeviceChannels "传感器信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /:id [put]
|
|
|
+func (this *InspectionController) EditPost() {
|
|
|
+ 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 inspectionproject.TestList
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ var entityempty inspectionproject.TestList
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验-" + model.TestName
|
|
|
+ var cols []string = []string{"TestName", "Laboratory", "Describe", "LabId", "DataGatherItem", "TATTimeItem", "TATTimeItemValue", "TATTime"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestListName, BaseOperationLogName, id, &model, &entityempty, cols, 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 新增检验项目
|
|
|
+// @Param body body business.device.DeviceChannels "检验项目信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /testItemslist [post]
|
|
|
+func (this *InspectionController) AddPostdetail() {
|
|
|
+ var testlistentity inspectionproject.TestItemsList
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &testlistentity)
|
|
|
+ testlistentity.CreateBy = this.User.Realname
|
|
|
+ testlistentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestItemsListName, &testlistentity)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ 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} business.device.DeviceChannels
|
|
|
+// @router /getdetails/:id [get]
|
|
|
+func (this *InspectionController) Getdetails() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var model inspectionproject.TestItemsList
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(this.User.AccCode+TestItemsListName, id, &model) //修改时获取列表
|
|
|
+ this.Data["json"] = &model
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑检测项目
|
|
|
+// @Description 编辑检测项目
|
|
|
+// @Param id path string true "需要修改的传感器编号"
|
|
|
+// @Param body body business.device.DeviceChannels "传感器信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /testItemslist/:id [put]
|
|
|
+func (this *InspectionController) EditPostdetail() {
|
|
|
+ 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 inspectionproject.TestItemsList
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ var entityempty inspectionproject.TestItemsList
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验-" + model.ItemName
|
|
|
+ var cols []string = []string{"Code", "ItemName", "Reference", "Unit", "InterfaceCode", "AdjustmentCoefficient", "NumberDecimals", "ItemCategory", "ReferenceLower", "ReferenceUpper", "ReferenceItem", "TestListId", "ModifiedBy", "ModifiedUserId", "IsQC", "ValueMethod", "CalcMethod"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestItemsListName, BaseOperationLogName, id, &model, &entityempty, cols, 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
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /detailsdelete/:Id [delete]
|
|
|
+func (this *InspectionController) Detailsdelete() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " Id= " + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestItemsListName, where)
|
|
|
+ where2 := " TestListId = " + Id
|
|
|
+ err2 := svc.DeleteEntityBytbl(this.User.AccCode+TestItemsListName, where2)
|
|
|
+ if err == nil && err2 == 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 编辑检测项目
|
|
|
+// @Param id path string true "需要修改的传感器编号"
|
|
|
+// @Param body body business.device.DeviceChannels "传感器信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /setdetailisqc/:id [put]
|
|
|
+func (this *InspectionController) Setdetailisqc() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ isqc := this.GetString("isqc")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var model inspectionproject.TestItemsList
|
|
|
+ var entityempty inspectionproject.TestItemsList
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ model.IsQC, _ = utils.StrTo(isqc).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验项状态设置-" + this.GetString("name")
|
|
|
+ var cols []string = []string{"IsQC", "ModifiedBy", "ModifiedUserId"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestItemsListName, BaseOperationLogName, id, &model, &entityempty, cols, 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 根据ID查试管
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inspectiontesttube/:Id [get]
|
|
|
+func (this *InspectionController) Inspectiontesttube() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ where := " TestListId=" + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ var list []inspectionproject.TestListDetail
|
|
|
+ svc.GetEntitysByOrderbyWhere(this.User.AccCode+TestListDetailName, where, "Id desc", &list)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加试管类型
|
|
|
+// @Description 新增试管类型
|
|
|
+// @Param body body business.device.DeviceChannels "试管类型"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /testtubeadd [post]
|
|
|
+func (this *InspectionController) Testtubeadd() {
|
|
|
+ var testlistentity inspectionproject.TestListDetail
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &testlistentity)
|
|
|
+ testlistentity.CreateBy = this.User.Realname
|
|
|
+ testlistentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestListDetailName, &testlistentity)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ 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} business.device.DeviceChannels
|
|
|
+// @router /gettesttube/:id [get]
|
|
|
+func (this *InspectionController) Gettesttube() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var model inspectionproject.TestListDetail
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(this.User.AccCode+TestListDetailName, id, &model) //修改时获取列表
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = model
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑试管信息
|
|
|
+// @Description 编辑试管信息
|
|
|
+// @Param id path string true "需要修改的试管信息"
|
|
|
+// @Param body body business.device.DeviceChannels "试管信息"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /testtubeedit/:id [put]
|
|
|
+func (this *InspectionController) Testtubeedit() {
|
|
|
+ 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 inspectionproject.TestListDetail
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ var entityempty inspectionproject.TestListDetail
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验-" + model.TestTube
|
|
|
+ var cols []string = []string{"SampleType", "TestTube", "Size", "Number", "StorageConditions", "TestListId", "SampleTypeId", "TestTubeId"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestListDetailName, BaseOperationLogName, id, &model, &entityempty, cols, 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
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /testtubedelete/:Id [delete]
|
|
|
+func (this *InspectionController) Testtubedelete() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " Id= " + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestListDetailName, where)
|
|
|
+ where2 := " TestListId = " + Id
|
|
|
+ err2 := svc.DeleteEntityBytbl(this.User.AccCode+TestListDetailName, where2)
|
|
|
+ if err == nil && err2 == 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 根据用户AccCode get检验主表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inspectiontestprinttemplate [get]
|
|
|
+func (this *InspectionController) Inspectiontestprinttemplate() {
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ searchkey := this.GetString("searchkey")
|
|
|
+ var list []inspectionproject.TestPrintTemplate
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ if searchkey != "" {
|
|
|
+ where = where + " and (TempName like '%" + searchkey + "%')"
|
|
|
+ }
|
|
|
+ total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id", true, &list, where)
|
|
|
+ //根据组织ID查询父级并输出
|
|
|
+ svv := organize.GetOrganizeService(utils.DBE)
|
|
|
+ var i int
|
|
|
+ var listtotal int
|
|
|
+ var length int
|
|
|
+ length = len(list)
|
|
|
+ if length < int(page.Size) {
|
|
|
+ listtotal = length
|
|
|
+ } else {
|
|
|
+ listtotal = int(page.Size)
|
|
|
+ }
|
|
|
+ for i = 0; i < listtotal; i++ {
|
|
|
+ var hoapital = ""
|
|
|
+ model := svv.GetAllParentByTopAccCode(list[i].OrgId, this.User.AccCode)
|
|
|
+ arr := strings.Split(model, ",")
|
|
|
+ for j := len(arr) - 4; j >= 0; j-- {
|
|
|
+ if j == 0 {
|
|
|
+ where := " Id= " + arr[j]
|
|
|
+ entity := svv.QueryEntity(where)
|
|
|
+ hoapital += entity.Fullname
|
|
|
+ } else {
|
|
|
+ where := " Id= " + arr[j]
|
|
|
+ entity := svv.QueryEntity(where)
|
|
|
+ hoapital += entity.Fullname + "/"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list[i].OrgId = hoapital
|
|
|
+ }
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加打印模板
|
|
|
+// @Description 新增打印模板
|
|
|
+// @Param body body business.device.DeviceChannels "打印模板"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /testprinttemplateadd [post]
|
|
|
+func (this *InspectionController) Testprinttemplateadd() {
|
|
|
+ var testlistentity inspectionproject.TestPrintTemplate
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &testlistentity)
|
|
|
+ testlistentity.CreateBy = this.User.Realname
|
|
|
+ testlistentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestPrintTemplateName, &testlistentity)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ 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} business.device.DeviceChannels
|
|
|
+// @router /gettestprinttemplate/:id [get]
|
|
|
+func (this *InspectionController) Gettestprinttemplate() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var model inspectionproject.TestPrintTemplate
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(this.User.AccCode+TestPrintTemplateName, id, &model) //修改时获取列表
|
|
|
+ this.Data["json"] = &model
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取编辑时的打印模板信息
|
|
|
+// @Description 获取编辑时的打印模板信息
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /gettemplate/:id [get]
|
|
|
+func (this *InspectionController) Gettemplate() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var model inspectionproject.TestPrintTemplate
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(this.User.AccCode+TestPrintTemplateName, id, &model) //修改时获取列表
|
|
|
+ this.Data["json"] = &model
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑打印模板
|
|
|
+// @Description 编辑打印模板
|
|
|
+// @Param id path string true "需要修改的打印模板"
|
|
|
+// @Param body body business.device.DeviceChannels "打印模板"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /testprinttemplateedit/:id [put]
|
|
|
+func (this *InspectionController) Testprinttemplateedit() {
|
|
|
+ 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 inspectionproject.TestPrintTemplate
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ var entityempty inspectionproject.TestPrintTemplate
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验-" + model.TempName
|
|
|
+ var cols []string = []string{"Id", "OrgId", "TempName", "FileName", "UseModule", "Describe"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestPrintTemplateName, BaseOperationLogName, id, &model, &entityempty, cols, 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
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /testprinttemplatedelete/:Id [delete]
|
|
|
+func (this *InspectionController) Testprinttemplatedelete() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " Id= " + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestPrintTemplateName, where)
|
|
|
+ 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 根据用户AccCode get检验主表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /inspectionpackagecategory [get]
|
|
|
+func (this *InspectionController) Inspectionpackagecategory() {
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ searchkey := this.GetString("keyword")
|
|
|
+ // var list []inspectionproject.TestPackageCategory
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ if searchkey != "" {
|
|
|
+ where = where + " and (a.FullName like '%" + searchkey + "%')"
|
|
|
+ }
|
|
|
+ parentid := this.GetString("parentId")
|
|
|
+ if parentid != "" {
|
|
|
+ where = where + " and (a.ParentId = " + parentid + " or a.Id = " + parentid + ")"
|
|
|
+ }
|
|
|
+ total, list := svc.GetpackagecategoryListandparentname(this.User.AccCode+TestPackageCategoryName, page.CurrentPage, page.Size, "Id desc", where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加检验套餐
|
|
|
+// @Description 新增检验套餐
|
|
|
+// @Param body body business.device.DeviceChannels "检验套餐"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /packagecategoryadd [post]
|
|
|
+func (this *InspectionController) Packagecategoryadd() {
|
|
|
+ var testlistentity inspectionproject.TestPackageCategory
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &testlistentity)
|
|
|
+ testlistentity.CreateBy = this.User.Realname
|
|
|
+ testlistentity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestPackageCategoryName, &testlistentity)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ 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 /packagecategorydelete/:Id [delete]
|
|
|
+func (this *InspectionController) Packagecategorydelete() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " Id= " + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestPackageCategoryName, where)
|
|
|
+
|
|
|
+ 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} business.device.DeviceChannels
|
|
|
+// @router /inspectionpackagecategoryall [get]
|
|
|
+func (this *InspectionController) Inspectionpackagecategoryall() {
|
|
|
+ var list []inspectionproject.TestPackageCategory
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ svc.GetEntitysByOrderbyWhere(this.User.AccCode+TestPackageCategoryName, where, "Id desc", &list)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑检验套餐
|
|
|
+// @Description 编辑检验套餐
|
|
|
+// @Param id path string true "需要修改的检验套餐"
|
|
|
+// @Param body body business.device.DeviceChannels "检验套餐"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /packagecategoryedit/:id [put]
|
|
|
+func (this *InspectionController) Packagecategoryedit() {
|
|
|
+ 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 inspectionproject.TestPackageCategory
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ var entityempty inspectionproject.TestPackageCategory
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验-" + model.FullName
|
|
|
+ var cols []string = []string{"Id", "ParentId", "FullName", "Describe"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestPackageCategoryName, BaseOperationLogName, id, &model, &entityempty, cols, 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 获取父集列表
|
|
|
+// @Success 200 {object} business.device.DeviceChannels
|
|
|
+// @router /packagecategoryparentlist/:id [get]
|
|
|
+func (this *InspectionController) Packagecategoryparentlist() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ errinfo.Message = svc.GetAllParentByTopId(id)
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据用户AccCode get检验主表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /packagesettinglist [get]
|
|
|
+func (this *InspectionController) Packagesettinglist() {
|
|
|
+ page := this.GetPageInfoForm()
|
|
|
+ searchkey := this.GetString("searchkey")
|
|
|
+ var list []inspectionproject.TestPackage
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ if searchkey != "" {
|
|
|
+ where = where + " and (PackageName like '%" + searchkey + "%')"
|
|
|
+ }
|
|
|
+ total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, "Id", false, &list, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ datainfo.CurrentItemCount = total
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据项目Id查找包含项目的套餐
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getpackagebytestid/:TestListId [get]
|
|
|
+func (this *InspectionController) GetPackageByTestId() {
|
|
|
+ TestListId := this.Ctx.Input.Param(":TestListId")
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " b.TestListId= " + TestListId
|
|
|
+ list := svc.GetTestPackageviewlist(this.User.AccCode+TestPackageName, this.User.AccCode+TestPackageItemsName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 查询所有套餐
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getallpackage [get]
|
|
|
+func (this *InspectionController) GetAllPackage() {
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ where := " 1=1 "
|
|
|
+ list := svc.GetAllPackageviewlist(this.User.AccCode+TestPackageName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 查询所有质控项
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getCategoryName [get]
|
|
|
+func (this *InspectionController) GetCategoryName() {
|
|
|
+ where := " 1=1 "
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ var list []inspectionproject.TestPackage
|
|
|
+ svc.GetEntitysByWhere(this.User.AccCode+TestPackageName, where, &list)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 查询所有质控项
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getIteamName [get]
|
|
|
+func (this *InspectionController) GetIteamName() {
|
|
|
+ where := " 1=1 "
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ var list []inspectionproject.TestItemsList
|
|
|
+ svc.GetEntitysByWhere(this.User.AccCode+TestItemsListName, where, &list)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 添加检验套餐
|
|
|
+// @Description 新增检验套餐
|
|
|
+// @Param body body business.device.DeviceChannels "检验套餐"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /packagesettingadd [post]
|
|
|
+func (this *InspectionController) Packagesettingadd() {
|
|
|
+ var testlistentity inspectionproject.TestPackage
|
|
|
+ var uimodel Packagemodel
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &testlistentity)
|
|
|
+ json.Unmarshal(jsonblob, &uimodel)
|
|
|
+
|
|
|
+ testlistentity.CreateBy = this.User.Realname
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ // 生成套餐
|
|
|
+ if uimodel.SelectPacktype == "1" {
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestPackageName, &testlistentity)
|
|
|
+
|
|
|
+ if err == nil {
|
|
|
+
|
|
|
+ for _, itemid := range uimodel.Itemlist {
|
|
|
+ itemid = strings.Split(itemid, ",")[0]
|
|
|
+ var testpackitementity inspectionproject.TestPackageItems
|
|
|
+ testpackitementity.PackageId = testlistentity.Id
|
|
|
+ testpackitementity.ItemsListId, _ = utils.StrTo(itemid).Int()
|
|
|
+ var testlistmodel TestListIdModel
|
|
|
+ svc.GetEntityByWhere(this.User.AccCode+TestItemsListName, "Id = "+utils.ToStr(testpackitementity.ItemsListId), &testlistmodel)
|
|
|
+ testpackitementity.TestListId = testlistmodel.TestListId
|
|
|
+
|
|
|
+ svc.InsertEntityBytbl(this.User.AccCode+TestPackageItemsName, &testpackitementity)
|
|
|
+ }
|
|
|
+
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ } else if uimodel.SelectPacktype == "2" { // 生成单个套餐
|
|
|
+
|
|
|
+ for _, itemid := range uimodel.Itemlist {
|
|
|
+
|
|
|
+ testlistentity.PackageName = strings.Split(itemid, ",")[1]
|
|
|
+ _, err := svc.InsertEntityBytbl(this.User.AccCode+TestPackageName, &testlistentity)
|
|
|
+
|
|
|
+ if err == nil {
|
|
|
+
|
|
|
+ itemid = strings.Split(itemid, ",")[0]
|
|
|
+ var testpackitementity inspectionproject.TestPackageItems
|
|
|
+ testpackitementity.PackageId = testlistentity.Id
|
|
|
+ testpackitementity.ItemsListId, _ = utils.StrTo(itemid).Int()
|
|
|
+ var testlistmodel TestListIdModel
|
|
|
+ svc.GetEntityByWhere(this.User.AccCode+TestItemsListName, "Id = "+utils.ToStr(testpackitementity.ItemsListId), &testlistmodel)
|
|
|
+ testpackitementity.TestListId = testlistmodel.TestListId
|
|
|
+
|
|
|
+ svc.InsertEntityBytbl(this.User.AccCode+TestPackageItemsName, &testpackitementity)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ errinfo.Message = "操作成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据ID查检验项目明细
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getIteamNames/:Id [get]
|
|
|
+func (this *InspectionController) GetIteamNames() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ where := " TestListId=" + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ list := svc.QueryinspectionEntity(this.User.AccCode+TestItemsListName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 删除单条信息
|
|
|
+// @Description
|
|
|
+// @Success 200 {object} ErrorInfo
|
|
|
+// @Failure 403 :id 为空
|
|
|
+// @router /packagesettingdelete/:Id [delete]
|
|
|
+func (this *InspectionController) Packagesettingdelete() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if Id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " Id= " + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestPackageName, where)
|
|
|
+
|
|
|
+ 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} business.device.DeviceChannels
|
|
|
+// @router /getpackage/:id [get]
|
|
|
+func (this *InspectionController) Getpackage() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var model inspectionproject.TestPackage
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ svc.GetEntityByIdBytbl(this.User.AccCode+TestPackageName, id, &model) //修改时获取列表
|
|
|
+ this.Data["json"] = &model
|
|
|
+ this.ServeJSON()
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 根据ID查检验项目明细
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} models.Userblood
|
|
|
+// @router /getpackageId/:Id [get]
|
|
|
+func (this *InspectionController) GetpackageId() {
|
|
|
+ Id := this.Ctx.Input.Param(":Id")
|
|
|
+ where := " a.PackageId=" + Id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ list := svc.QuerySelectPackItemlist(this.User.AccCode+TestPackageItemsName, this.User.AccCode+TestItemsListName, where)
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = list
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 编辑套餐检验
|
|
|
+// @Description 编辑套餐检验
|
|
|
+// @Param id path string true "需要修改的套餐检验"
|
|
|
+// @Param body body business.device.DeviceChannels "套餐检验"
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /packagesettingedit/:id [put]
|
|
|
+func (this *InspectionController) Packagesettingedit() {
|
|
|
+ id := this.Ctx.Input.Param(":id")
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var uimodel Packagemodel
|
|
|
+ var model inspectionproject.TestPackage
|
|
|
+ var jsonblob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonblob, &model)
|
|
|
+ json.Unmarshal(jsonblob, &uimodel)
|
|
|
+ var entityempty inspectionproject.TestPackage
|
|
|
+ model.ModifiedBy = this.User.Realname
|
|
|
+ model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+
|
|
|
+ opdesc := "检验-" + model.PackageName
|
|
|
+ var cols []string = []string{"PackageName", "CategoryId", "CategoryName", "Describe", "PackageCode"}
|
|
|
+ err := svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+TestPackageName, BaseOperationLogName, id, &model, &entityempty, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "试管信息")
|
|
|
+
|
|
|
+ if err == nil {
|
|
|
+
|
|
|
+ var errinfo ErrorInfo
|
|
|
+ if id == "" {
|
|
|
+ errinfo.Message = "操作失败!请求信息不完整"
|
|
|
+ errinfo.Code = -2
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ where := " PackageId= " + id
|
|
|
+ svc := inspectionproject.GetInspectionprojectService(utils.DBE)
|
|
|
+ err := svc.DeleteEntityBytbl(this.User.AccCode+TestPackageItemsName, where)
|
|
|
+
|
|
|
+ if err == nil {
|
|
|
+ for _, itemid := range uimodel.Itemlist {
|
|
|
+
|
|
|
+ itemid = strings.Split(itemid, ",")[0]
|
|
|
+
|
|
|
+ var testpackitementity inspectionproject.TestPackageItems
|
|
|
+ testpackitementity.PackageId, _ = utils.StrTo(id).Int()
|
|
|
+
|
|
|
+ testpackitementity.ItemsListId, _ = utils.StrTo(itemid).Int()
|
|
|
+ var testlistmodel TestListIdModel
|
|
|
+
|
|
|
+ svc.GetEntityByWhere(this.User.AccCode+TestItemsListName, "id = "+utils.ToStr(testpackitementity.ItemsListId), &testlistmodel)
|
|
|
+ testpackitementity.TestListId = testlistmodel.TestListId
|
|
|
+
|
|
|
+ svc.InsertEntityBytbl(this.User.AccCode+TestPackageItemsName, &testpackitementity)
|
|
|
+ }
|
|
|
+
|
|
|
+ errinfo.Message = "操作成功!"
|
|
|
+ errinfo.Code = 0
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+}
|