Browse Source

2024/6/17

28169 1 month ago
parent
commit
d279e13123

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10318 //机构id
86
+		subscibe.OrgId = 10164 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10318 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
97
 		adminUserInfo.CurrentAppId = 12627 //4
97
 		adminUserInfo.CurrentAppId = 12627 //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10318 //机构id小英9675或4
332
+		subscibe.OrgId = 10164 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10318 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
343
 		adminUserInfo.CurrentAppId = 12627 //4
343
 		adminUserInfo.CurrentAppId = 12627 //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes

+ 1 - 1
controllers/dialysis_api_controller.go View File

2573
 			service.CreateDialysisFinish(finish)
2573
 			service.CreateDialysisFinish(finish)
2574
 		}
2574
 		}
2575
 
2575
 
2576
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 {
2576
+		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 3877 || adminUserInfo.CurrentOrgId == 10469 || adminUserInfo.CurrentOrgId == 10551 || adminUserInfo.CurrentOrgId == 10579 || adminUserInfo.CurrentOrgId == 10580 || adminUserInfo.CurrentOrgId == 10585 || adminUserInfo.CurrentOrgId == 10344 || adminUserInfo.CurrentOrgId == 10622 || adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 || adminUserInfo.CurrentOrgId == 10723 || adminUserInfo.CurrentOrgId == 10164 {
2577
 			var dewater_amount float64
2577
 			var dewater_amount float64
2578
 			dewater_amount = 0
2578
 			dewater_amount = 0
2579
 			if dry_weight > 0 {
2579
 			if dry_weight > 0 {

+ 199 - 0
controllers/his_api_controller.go View File

108
 
108
 
109
 	beego.Router("/api/getallgoodinforlist", &HisApiController{}, "Get:GetAllGoodInforList")
109
 	beego.Router("/api/getallgoodinforlist", &HisApiController{}, "Get:GetAllGoodInforList")
110
 
110
 
111
+	beego.Router("/api/savegoodlist", &HisApiController{}, "Post:SaveGoodList")
112
+
113
+	beego.Router("/api/getgoodlist", &HisApiController{}, "Get:GetGoodList")
114
+
115
+	beego.Router("/api/getgoodnamedetail", &HisApiController{}, "Get:GetGoodNameDetail")
116
+
117
+	beego.Router("/api/updategoodlist", &HisApiController{}, "Post:UpdateGoodList")
118
+
119
+	beego.Router("/api/deletegoodteam", &HisApiController{}, "Get:DeleteGoodTeam")
120
+
121
+	beego.Router("/api/deletegood", &HisApiController{}, "Get:DeleteGood")
122
+
111
 }
123
 }
112
 
124
 
113
 func (c *HisApiController) CheckHisPatient() {
125
 func (c *HisApiController) CheckHisPatient() {
14187
 	})
14199
 	})
14188
 	return
14200
 	return
14189
 }
14201
 }
14202
+
14203
+func (this *HisApiController) SaveGoodList() {
14204
+
14205
+	project_name := this.GetString("project_name")
14206
+	sort, _ := this.GetInt64("sort")
14207
+	orgId := this.GetAdminUserInfo().CurrentOrgId
14208
+
14209
+	dataBody := make(map[string]interface{}, 0)
14210
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
14211
+	if err != nil {
14212
+		utils.ErrorLog(err.Error())
14213
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
14214
+		return
14215
+	}
14216
+
14217
+	goodTeam := models.XtGoodTeam{
14218
+		ProjectName: project_name,
14219
+		Sort:        sort,
14220
+		UserOrgId:   orgId,
14221
+		Status:      1,
14222
+		Ctime:       time.Now().Unix(),
14223
+		Mtime:       time.Now().Unix(),
14224
+	}
14225
+
14226
+	service.CreateGoodTeam(goodTeam)
14227
+
14228
+	lastGoodTeam, _ := service.GetLastGoodTeam(orgId)
14229
+
14230
+	if dataBody["info"] != nil && reflect.TypeOf(dataBody["info"]).String() == "[]interface {}" {
14231
+		infos, _ := dataBody["info"].([]interface{})
14232
+		if len(infos) > 0 {
14233
+			for _, item := range infos {
14234
+				items := item.(map[string]interface{})
14235
+				if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
14236
+					utils.ErrorLog("good_id")
14237
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
14238
+					return
14239
+				}
14240
+				good_id := int64(items["good_id"].(float64))
14241
+
14242
+				if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "float64" {
14243
+					utils.ErrorLog("number")
14244
+				}
14245
+
14246
+				number := int64(items["number"].(float64))
14247
+
14248
+				xtGoodTeamList := models.XtGoodTeamList{
14249
+					GoodId:    good_id,
14250
+					Count:     number,
14251
+					TeamId:    lastGoodTeam.ID,
14252
+					UserOrgId: orgId,
14253
+					Status:    1,
14254
+					Ctime:     time.Now().Unix(),
14255
+					Mtime:     time.Now().Unix(),
14256
+				}
14257
+
14258
+				service.CreateGoodList(xtGoodTeamList)
14259
+			}
14260
+			this.ServeSuccessJSON(map[string]interface{}{
14261
+				"lastGoodTeam": lastGoodTeam,
14262
+			})
14263
+		}
14264
+	}
14265
+	return
14266
+}
14267
+
14268
+func (this *HisApiController) GetGoodList() {
14269
+
14270
+	orgId := this.GetAdminUserInfo().CurrentOrgId
14271
+	limit, _ := this.GetInt64("limit")
14272
+	page, _ := this.GetInt64("page")
14273
+	keyword := this.GetString("keyword")
14274
+	list, total, _ := service.GetGoodList(orgId, limit, page, keyword)
14275
+
14276
+	this.ServeSuccessJSON(map[string]interface{}{
14277
+		"list":  list,
14278
+		"total": total,
14279
+	})
14280
+}
14281
+
14282
+func (this *HisApiController) GetGoodNameDetail() {
14283
+
14284
+	id, _ := this.GetInt64("id")
14285
+
14286
+	orgId := this.GetAdminUserInfo().CurrentOrgId
14287
+	goodNameDetail, _ := service.GetGoodNameDetail(id, orgId)
14288
+	goodList, _ := service.GetAllGoodList(orgId)
14289
+	this.ServeSuccessJSON(map[string]interface{}{
14290
+		"goodNameDetail": goodNameDetail,
14291
+		"goodList":       goodList,
14292
+	})
14293
+}
14294
+
14295
+func (this *HisApiController) UpdateGoodList() {
14296
+
14297
+	project_name := this.GetString("project_name")
14298
+	sort, _ := this.GetInt64("sort")
14299
+	id, _ := this.GetInt64("id")
14300
+	orgId := this.GetAdminUserInfo().CurrentOrgId
14301
+
14302
+	dataBody := make(map[string]interface{}, 0)
14303
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
14304
+	if err != nil {
14305
+		utils.ErrorLog(err.Error())
14306
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
14307
+		return
14308
+	}
14309
+
14310
+	goodTeam := models.XtGoodTeam{
14311
+		ProjectName: project_name,
14312
+		Sort:        sort,
14313
+		UserOrgId:   orgId,
14314
+		Status:      1,
14315
+		Ctime:       time.Now().Unix(),
14316
+		Mtime:       time.Now().Unix(),
14317
+		ID:          id,
14318
+	}
14319
+
14320
+	service.SaveGoodTeam(goodTeam)
14321
+
14322
+	lastGoodTeam, _ := service.GetLastGoodTeam(orgId)
14323
+
14324
+	if dataBody["info"] != nil && reflect.TypeOf(dataBody["info"]).String() == "[]interface {}" {
14325
+		infos, _ := dataBody["info"].([]interface{})
14326
+		if len(infos) > 0 {
14327
+			for _, item := range infos {
14328
+				items := item.(map[string]interface{})
14329
+				if items["good_id"] == nil || reflect.TypeOf(items["good_id"]).String() != "float64" {
14330
+					utils.ErrorLog("good_id")
14331
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
14332
+					return
14333
+				}
14334
+				good_id := int64(items["good_id"].(float64))
14335
+
14336
+				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
14337
+					utils.ErrorLog("id")
14338
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
14339
+					return
14340
+				}
14341
+				id := int64(items["id"].(float64))
14342
+
14343
+				if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "float64" {
14344
+					utils.ErrorLog("number")
14345
+				}
14346
+
14347
+				number := int64(items["number"].(float64))
14348
+
14349
+				xtGoodTeamList := models.XtGoodTeamList{
14350
+					ID:        id,
14351
+					GoodId:    good_id,
14352
+					Count:     number,
14353
+					TeamId:    lastGoodTeam.ID,
14354
+					UserOrgId: orgId,
14355
+					Status:    1,
14356
+					Ctime:     time.Now().Unix(),
14357
+					Mtime:     time.Now().Unix(),
14358
+				}
14359
+
14360
+				service.SaveGoodList(xtGoodTeamList)
14361
+			}
14362
+			this.ServeSuccessJSON(map[string]interface{}{
14363
+				"lastGoodTeam": lastGoodTeam,
14364
+			})
14365
+		}
14366
+	}
14367
+	return
14368
+}
14369
+
14370
+func (this *HisApiController) DeleteGoodTeam() {
14371
+
14372
+	id, _ := this.GetInt64("id")
14373
+	team, _ := service.DeleteGoodTeam(id)
14374
+	this.ServeSuccessJSON(map[string]interface{}{
14375
+		"team": team,
14376
+	})
14377
+}
14378
+
14379
+func (this *HisApiController) DeleteGood() {
14380
+
14381
+	id, _ := this.GetInt64("id")
14382
+
14383
+	good, _ := service.DeleteGood(id)
14384
+
14385
+	this.ServeSuccessJSON(map[string]interface{}{
14386
+		"good": good,
14387
+	})
14388
+}

+ 1 - 1
controllers/mobile_api_controllers/check_weight_api_controller.go View File

319
 
319
 
320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
320
 	template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
321
 
321
 
322
-	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 {
322
+	if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 || adminUserInfo.Org.Id == 10537 || adminUserInfo.Org.Id == 10667 || adminUserInfo.Org.Id == 10723 {
323
 		if adminUserInfo.Org.Id != 10447 {
323
 		if adminUserInfo.Org.Id != 10447 {
324
 			dewater_amount = dewater_amount * 1000
324
 			dewater_amount = dewater_amount * 1000
325
 		}
325
 		}

+ 2 - 2
controllers/new_stock_api_controller.go View File

112
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
112
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
113
 	dealerList, _ := service.GetAllDealerList(orgId)
113
 	dealerList, _ := service.GetAllDealerList(orgId)
114
 	houseList, _ := service.GetAllStoreHouseList(orgId)
114
 	houseList, _ := service.GetAllStoreHouseList(orgId)
115
-	//patientList, _ := service.GetAllPatientListSix(orgId)
115
+	patientList, _ := service.GetAllPatientListSix(orgId)
116
 	c.ServeSuccessJSON(map[string]interface{}{
116
 	c.ServeSuccessJSON(map[string]interface{}{
117
 		"info":             list,
117
 		"info":             list,
118
 		"total":            total,
118
 		"total":            total,
119
 		"manufacturerList": manufacturerList,
119
 		"manufacturerList": manufacturerList,
120
 		"dealerList":       dealerList,
120
 		"dealerList":       dealerList,
121
 		"houseList":        houseList,
121
 		"houseList":        houseList,
122
-		//"patientList":      patientList,
122
+		"patientList":      patientList,
123
 	})
123
 	})
124
 }
124
 }
125
 func (c *NewStockApiController) GetDrugQuery() {
125
 func (c *NewStockApiController) GetDrugQuery() {

+ 6 - 5
controllers/pharmacy_controller.go View File

4
 	"fmt"
4
 	"fmt"
5
 	"math"
5
 	"math"
6
 	"strconv"
6
 	"strconv"
7
+	"strings"
7
 	"time"
8
 	"time"
8
 
9
 
9
 	"XT_New/enums"
10
 	"XT_New/enums"
1377
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1378
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1378
 	data_source, _ := this.GetInt64("data_source")
1379
 	data_source, _ := this.GetInt64("data_source")
1379
 	drug_code := this.GetString("drug_code")
1380
 	drug_code := this.GetString("drug_code")
1380
-
1381
-	fmt.Println("data_source--------------------", data_source)
1381
+	str := strings.Replace(drug_code, " ", "", -1)
1382
+	// 去除换行符
1383
+	str = strings.Replace(str, "\n", "", -1)
1382
 	if data_source == 1 {
1384
 	if data_source == 1 {
1383
-		fmt.Println("HHAHAHAH")
1384
-		service.ChangeHisDrugCode(id, drug_code, orgId)
1385
+		service.ChangeHisDrugCode(id, str, orgId)
1385
 	}
1386
 	}
1386
 	if data_source == 2 {
1387
 	if data_source == 2 {
1387
-		service.ChangeAdivceDrugCode(id, drug_code, orgId)
1388
+		service.ChangeAdivceDrugCode(id, str, orgId)
1388
 	}
1389
 	}
1389
 
1390
 
1390
 	this.ServeSuccessJSON(map[string]interface{}{
1391
 	this.ServeSuccessJSON(map[string]interface{}{

+ 30 - 0
models/his_models.go View File

2903
 func (XtSelfDrugOutConfig) TableName() string {
2903
 func (XtSelfDrugOutConfig) TableName() string {
2904
 	return "xt_self_drug_out_config"
2904
 	return "xt_self_drug_out_config"
2905
 }
2905
 }
2906
+
2907
+type XtGoodTeam struct {
2908
+	ID             int64             `gorm:"column:id" json:"id" form:"id"`
2909
+	ProjectName    string            `gorm:"column:project_name" json:"project_name" form:"project_name"`
2910
+	Sort           int64             `gorm:"column:sort" json:"sort" form:"sort"`
2911
+	UserOrgId      int64             `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2912
+	Status         int64             `gorm:"column:status" json:"status" form:"status"`
2913
+	Ctime          int64             `gorm:"column:ctime" json:"ctime" form:"ctime"`
2914
+	Mtime          int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
2915
+	XtGoodTeamList []*XtGoodTeamList `gorm:"ForeignKey:TeamId;AssociationForeignKey:ID" json:"xt_good_team_list"`
2916
+}
2917
+
2918
+func (XtGoodTeam) TableName() string {
2919
+	return "xt_good_team"
2920
+}
2921
+
2922
+type XtGoodTeamList struct {
2923
+	ID        int64 `gorm:"column:id" json:"id" form:"id"`
2924
+	GoodId    int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
2925
+	Count     int64 `gorm:"column:count" json:"count" form:"count"`
2926
+	TeamId    int64 `gorm:"column:team_id" json:"team_id" form:"team_id"`
2927
+	UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2928
+	Status    int64 `gorm:"column:status" json:"status" form:"status"`
2929
+	Ctime     int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
2930
+	Mtime     int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
2931
+}
2932
+
2933
+func (XtGoodTeamList) TableName() string {
2934
+	return "xt_good_team_list"
2935
+}

+ 5 - 5
models/new_drug_stock.go View File

65
 	IsChange                  int64                  `gorm:"column:is_change" json:"is_change" form:"is_change"`
65
 	IsChange                  int64                  `gorm:"column:is_change" json:"is_change" form:"is_change"`
66
 	Bchno                     string                 `gorm:"column:bchno" json:"bchno" form:"bchno"`
66
 	Bchno                     string                 `gorm:"column:bchno" json:"bchno" form:"bchno"`
67
 	BgBchno                   string                 `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
67
 	BgBchno                   string                 `gorm:"column:bg_bchno" json:"bg_bchno" form:"bg_bchno"`
68
-
69
-	PCount float64
70
-	SDate  string
71
-	PDate  int64
72
-	Unit   string
68
+	HisDoctorAdviceInfo       HisDoctorAdviceInfo    `gorm:"ForeignKey:PatientId,AdviceDate,DrugId;AssociationForeignKey:PatientId,SystemTime,DrugId"json:"his_advice_info" `
69
+	PCount                    float64
70
+	SDate                     string
71
+	PDate                     int64
72
+	Unit                      string
73
 }
73
 }
74
 
74
 
75
 func (NewDrugFlow) TableName() string {
75
 func (NewDrugFlow) TableName() string {

+ 83 - 0
service/his_service.go View File

3520
 
3520
 
3521
 	return prescriptionInfo, err
3521
 	return prescriptionInfo, err
3522
 }
3522
 }
3523
+
3524
+func CreateGoodTeam(team models.XtGoodTeam) error {
3525
+
3526
+	err := XTWriteDB().Create(&team).Error
3527
+
3528
+	return err
3529
+}
3530
+
3531
+func SaveGoodTeam(team models.XtGoodTeam) error {
3532
+
3533
+	err := XTWriteDB().Save(&team).Error
3534
+
3535
+	return err
3536
+}
3537
+
3538
+func GetLastGoodTeam(org_id int64) (models.XtGoodTeam, error) {
3539
+
3540
+	goodTeam := models.XtGoodTeam{}
3541
+
3542
+	err := XTReadDB().Where("user_org_id = ? and status=1", org_id).Last(&goodTeam).Error
3543
+
3544
+	return goodTeam, err
3545
+}
3546
+
3547
+func CreateGoodList(list models.XtGoodTeamList) error {
3548
+
3549
+	err := XTWriteDB().Create(&list).Error
3550
+
3551
+	return err
3552
+}
3553
+
3554
+func SaveGoodList(list models.XtGoodTeamList) error {
3555
+
3556
+	err := XTWriteDB().Save(&list).Error
3557
+
3558
+	return err
3559
+}
3560
+
3561
+func GetGoodList(user_org_id int64, limit int64, page int64, keyword string) (list []*models.XtGoodTeam, total int64, err error) {
3562
+
3563
+	key := "%" + keyword + "%"
3564
+	offset := (page - 1) * limit
3565
+	db := XTReadDB().Model(&list).Where("status=1")
3566
+
3567
+	if user_org_id > 0 {
3568
+		db = db.Where("user_org_id = ?", user_org_id)
3569
+	}
3570
+
3571
+	if len(keyword) > 0 {
3572
+		db = db.Where("project_name like ?", key)
3573
+	}
3574
+
3575
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("id desc").Find(&list).Error
3576
+
3577
+	return list, total, err
3578
+}
3579
+
3580
+func GetGoodNameDetail(id int64, org_id int64) (models.XtGoodTeam, error) {
3581
+
3582
+	goodTeam := models.XtGoodTeam{}
3583
+
3584
+	err := XTReadDB().Where("id = ? and status =1 and user_org_id = ?", id, org_id).Preload("XtGoodTeamList", "status = 1 and user_org_id = ?", org_id).Find(&goodTeam).Error
3585
+
3586
+	return goodTeam, err
3587
+}
3588
+
3589
+func DeleteGoodTeam(id int64) (models.XtGoodTeamList, error) {
3590
+
3591
+	goodTeamList := models.XtGoodTeamList{}
3592
+
3593
+	err := XTWriteDB().Model(&goodTeamList).Where("id = ? and status =1", id).Updates(map[string]interface{}{"status": 0}).Error
3594
+
3595
+	return goodTeamList, err
3596
+}
3597
+
3598
+func DeleteGood(id int64) (models.XtGoodTeam, error) {
3599
+
3600
+	goodTeam := models.XtGoodTeam{}
3601
+
3602
+	err := XTWriteDB().Model(&goodTeam).Where("id = ? and status=1", id).Updates(map[string]interface{}{"status": 0}).Error
3603
+
3604
+	return goodTeam, err
3605
+}

+ 1 - 1
service/new_stock_medical_insurance_service.go View File

58
 	//}
58
 	//}
59
 
59
 
60
 	//}
60
 	//}
61
-	err = db.Count(&total).Offset(offset).Limit(limit).Order("id desc").Preload("BaseDrugLib", "status = 1").Preload("DrugWarehouseInfo", "status = 1").Preload("XtDrugWarehouseOutInfo", "status = 1").Find(&drug_flow).Error
61
+	err = db.Count(&total).Offset(offset).Limit(limit).Order("id desc").Preload("BaseDrugLib", "status = 1 and org_id =?", orgid).Preload("DrugWarehouseInfo", "status = 1 and org_id = ?", orgid).Preload("XtDrugWarehouseOutInfo", "status = 1 and org_id = ?", orgid).Preload("HisDoctorAdviceInfo", "status=1 and user_org_id =?", orgid).Find(&drug_flow).Error
62
 	for _, item := range drug_flow {
62
 	for _, item := range drug_flow {
63
 		var doc models.HisDoctorAdviceInfo
63
 		var doc models.HisDoctorAdviceInfo
64
 		var p models.HisPrescription
64
 		var p models.HisPrescription