|
@@ -6329,8 +6329,9 @@ func UpdateGoodByGoodId(good_id int64, sum_count int64, sum_in_count int64, orgi
|
6329
|
6329
|
|
6330
|
6330
|
func GetDrugDetailSummary(startime int64, endtime int64, keyword string, limit int64, page int64, orgid int64) (adviceinfo []*models.BloodHisDoctorAdviceInfo, total int64, err error) {
|
6331
|
6331
|
|
6332
|
|
- db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1 and x.execution_state = 1")
|
6333
|
|
-
|
|
6332
|
+ db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1")
|
|
6333
|
+ table := XTReadDB().Table("xt_base_drug as x d")
|
|
6334
|
+ fmt.Println(table)
|
6334
|
6335
|
if startime > 0 {
|
6335
|
6336
|
db = db.Where("x.advice_date >= ?", startime)
|
6336
|
6337
|
}
|
|
@@ -6344,17 +6345,19 @@ func GetDrugDetailSummary(startime int64, endtime int64, keyword string, limit i
|
6344
|
6345
|
|
6345
|
6346
|
if len(keyword) > 0 {
|
6346
|
6347
|
likeKey := "%" + keyword + "%"
|
6347
|
|
- db = db.Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey).Group("d.id")
|
|
6348
|
+ db = db.Select("x.patient_id,x.user_org_id,x.id,x.advice_date,x.advice_date").Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey)
|
6348
|
6349
|
}
|
|
6350
|
+
|
6349
|
6351
|
offset := (page - 1) * limit
|
6350
|
|
- err = db.Count(&total).Offset(offset).Limit(limit).Order("x.created_time desc").Group("x.drug_id").Find(&adviceinfo).Error
|
|
6352
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Order("x.created_time desc").Group("x.drug_id").Scan(&adviceinfo).Error
|
6351
|
6353
|
return adviceinfo, total, err
|
6352
|
6354
|
}
|
6353
|
6355
|
|
6354
|
6356
|
func GetDrugDetailSummaryOne(startime int64, endtime int64, keyword string, limit int64, page int64, orgid int64) (adviceinfo []*models.BloodHisDoctorAdviceInfo, total int64, err error) {
|
6355
|
6357
|
|
6356
|
|
- db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1 and x.execution_state = 1")
|
6357
|
|
-
|
|
6358
|
+ db := XTReadDB().Table("his_doctor_advice_info as x").Where("x.status = 1")
|
|
6359
|
+ table := XTReadDB().Table("xt_base_drug as x d")
|
|
6360
|
+ fmt.Println(table)
|
6358
|
6361
|
if startime > 0 {
|
6359
|
6362
|
db = db.Where("x.advice_date >= ?", startime)
|
6360
|
6363
|
}
|
|
@@ -6369,10 +6372,11 @@ func GetDrugDetailSummaryOne(startime int64, endtime int64, keyword string, limi
|
6369
|
6372
|
|
6370
|
6373
|
if len(keyword) > 0 {
|
6371
|
6374
|
likeKey := "%" + keyword + "%"
|
6372
|
|
- db = db.Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey).Group("d.id")
|
|
6375
|
+ db = db.Select("x.patient_id,x.user_org_id,x.id,x.advice_date,x.advice_date").Joins("left join sgj_xt.xt_base_drug as d on d.id = x.drug_id").Where("d.drug_name like ?", likeKey)
|
6373
|
6376
|
}
|
|
6377
|
+
|
6374
|
6378
|
offset := (page - 1) * limit
|
6375
|
|
- err = db.Count(&total).Offset(offset).Limit(limit).Order("x.created_time desc").Find(&adviceinfo).Error
|
|
6379
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Order("x.created_time desc").Scan(&adviceinfo).Error
|
6376
|
6380
|
return adviceinfo, total, err
|
6377
|
6381
|
}
|
6378
|
6382
|
|
|
@@ -6384,8 +6388,9 @@ func GetAllDrugSummary(orgid int64) (drug []*models.BaseDrugLib, err error) {
|
6384
|
6388
|
|
6385
|
6389
|
func GetGoodDetailSummary(startime int64, endtime int64, keyword string, limit int64, page int64, orgid int64) (project []*models.BloodHisPrescriptionProject, total int64, err error) {
|
6386
|
6390
|
|
6387
|
|
- db := XTReadDB().Table("his_prescription_project as x").Where("x.status = 1 and x.execution_state = 1 and x.type = 3")
|
6388
|
|
-
|
|
6391
|
+ db := XTReadDB().Table("his_prescription_project as x").Where("x.status = 1 and x.type = 3")
|
|
6392
|
+ table := XTReadDB().Table("xt_good_information as d")
|
|
6393
|
+ fmt.Println(table)
|
6389
|
6394
|
if startime > 0 {
|
6390
|
6395
|
db = db.Where("x.record_date >= ?", startime)
|
6391
|
6396
|
}
|
|
@@ -6399,17 +6404,19 @@ func GetGoodDetailSummary(startime int64, endtime int64, keyword string, limit i
|
6399
|
6404
|
|
6400
|
6405
|
if len(keyword) > 0 {
|
6401
|
6406
|
likeKey := "%" + keyword + "%"
|
6402
|
|
- db = db.Joins("left join sgj_xt.xt_good_information as d on d.id = x.drug_id").Where("d.good_name like ?", likeKey).Group("d.id")
|
|
6407
|
+ db = db.Select("x.id,x.project_id,x.user_org_id,x.patient_id,x.record_date").Joins("left join xt_good_information as d on d.id = x.project_id").Where("d.good_name like ?", likeKey)
|
6403
|
6408
|
}
|
|
6409
|
+
|
6404
|
6410
|
offset := (page - 1) * limit
|
6405
|
|
- err = db.Count(&total).Offset(offset).Limit(limit).Order("x.ctime desc").Group("x.project_id").Find(&project).Error
|
|
6411
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Order("x.ctime desc").Group("x.project_id").Scan(&project).Error
|
6406
|
6412
|
return project, total, err
|
6407
|
6413
|
}
|
6408
|
6414
|
|
6409
|
6415
|
func GetGoodDetailSummaryOne(startime int64, endtime int64, keyword string, limit int64, page int64, orgid int64) (project []*models.BloodHisPrescriptionProject, total int64, err error) {
|
6410
|
6416
|
|
6411
|
|
- db := XTReadDB().Table("his_prescription_project as x").Where("x.status = 1 and x.execution_state = 1 and x.type = 3")
|
6412
|
|
-
|
|
6417
|
+ db := XTReadDB().Table("his_prescription_project as x").Where("x.status = 1 and x.type = 3")
|
|
6418
|
+ table := XTReadDB().Table("xt_good_information as d")
|
|
6419
|
+ fmt.Println(table)
|
6413
|
6420
|
if startime > 0 {
|
6414
|
6421
|
db = db.Where("x.record_date >= ?", startime)
|
6415
|
6422
|
}
|
|
@@ -6423,10 +6430,11 @@ func GetGoodDetailSummaryOne(startime int64, endtime int64, keyword string, limi
|
6423
|
6430
|
|
6424
|
6431
|
if len(keyword) > 0 {
|
6425
|
6432
|
likeKey := "%" + keyword + "%"
|
6426
|
|
- db = db.Joins("left join sgj_xt.xt_good_information as d on d.id = x.drug_id").Where("d.good_name like ?", likeKey).Group("d.id")
|
|
6433
|
+ db = db.Select("x.id,x.project_id,x.user_org_id,x.patient_id,x.record_date").Joins("left join xt_good_information as d on d.id = x.project_id").Where("d.good_name like ? ", likeKey)
|
6427
|
6434
|
}
|
|
6435
|
+
|
6428
|
6436
|
offset := (page - 1) * limit
|
6429
|
|
- err = db.Count(&total).Offset(offset).Limit(limit).Order("x.ctime desc").Find(&project).Error
|
|
6437
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Order("x.ctime desc").Group("x.id").Scan(&project).Error
|
6430
|
6438
|
return project, total, err
|
6431
|
6439
|
}
|
6432
|
6440
|
|
|
@@ -6468,3 +6476,10 @@ func FindStockSettingById(orgid int64) (models.XtStockSetting, error) {
|
6468
|
6476
|
err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&setting).Error
|
6469
|
6477
|
return setting, err
|
6470
|
6478
|
}
|
|
6479
|
+
|
|
6480
|
+func GetAutoStockOutById(good_id, record_date int64, orgid int64, patient_id int64) (models.BloodAutomaticReduceDetail, error) {
|
|
6481
|
+
|
|
6482
|
+ detail := models.BloodAutomaticReduceDetail{}
|
|
6483
|
+ err := XTReadDB().Where("good_id = ? and record_time = ? and org_id = ? and status = 1 and patient_id = ?", good_id, record_date, orgid, patient_id).Find(&detail).Error
|
|
6484
|
+ return detail, err
|
|
6485
|
+}
|