Explorar el Código

库存流水展示

XMLWAN hace 2 años
padre
commit
97b2e44620

+ 6 - 6
controllers/base_api_controller.go Ver fichero

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

+ 1 - 1
service/manage_service.go Ver fichero

1036
 	//db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
1036
 	//db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
1037
 	//err = db.Raw("select id,date,class,zone,bed_number,patient_id,contagion,dialysis_mode,start_time,end_time,dialysis_hour,hyperfiltratio,weight_loss,warning_value,user_total,move,failure_stage,fault_description,code_information,disinfect_type,disinfectant_type,disinfection,machine_run,fluid_path,disinfectant,disinfection_status,disinfection_residue,long_time,disinfec_startime,disinfec_endtime,dialysis_checked,dialysis_name,norms,dialysis_concentration,germ_checked,germ_name,germ_number,clean,sign_name,status,ctime,mtime,user_org_id,equiment_id,bed,stime from xt_device_information where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= ? and equiment_id = ? and user_org_id = ?",timenow,equitid, orgid).Error
1037
 	//err = db.Raw("select id,date,class,zone,bed_number,patient_id,contagion,dialysis_mode,start_time,end_time,dialysis_hour,hyperfiltratio,weight_loss,warning_value,user_total,move,failure_stage,fault_description,code_information,disinfect_type,disinfectant_type,disinfection,machine_run,fluid_path,disinfectant,disinfection_status,disinfection_residue,long_time,disinfec_startime,disinfec_endtime,dialysis_checked,dialysis_name,norms,dialysis_concentration,germ_checked,germ_name,germ_number,clean,sign_name,status,ctime,mtime,user_org_id,equiment_id,bed,stime from xt_device_information where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= ? and equiment_id = ? and user_org_id = ?",timenow,equitid, orgid).Error
1038
 	day := time.Now().Day()
1038
 	day := time.Now().Day()
1039
-	oldMonth := day - 30
1039
+	oldMonth := day - 90
1040
 	t := time.Date(time.Now().Year(), time.Now().Month(), oldMonth, time.Now().Hour(), time.Now().Minute(), time.Now().Second(), time.Now().Nanosecond(), time.Local)
1040
 	t := time.Date(time.Now().Year(), time.Now().Month(), oldMonth, time.Now().Hour(), time.Now().Minute(), time.Now().Second(), time.Now().Nanosecond(), time.Local)
1041
 
1041
 
1042
 	err = UserReadDB().Model(&information).Where("date>= ? and date <= ? and equiment_id = ? and user_org_id = ? and dialysis_checked = 1 ", t.Unix(), timenow, equitid, orgid).Find(&information).Error
1042
 	err = UserReadDB().Model(&information).Where("date>= ? and date <= ? and equiment_id = ? and user_org_id = ? and dialysis_checked = 1 ", t.Unix(), timenow, equitid, orgid).Find(&information).Error

+ 9 - 6
service/pharmacy_service.go Ver fichero

679
 			if PettyCash(v.DrugId) {
679
 			if PettyCash(v.DrugId) {
680
 				continue
680
 				continue
681
 			}
681
 			}
682
-			////判断药品库存是否充足
683
-			kou := FenDrugInventory(v, orgid)
684
-			if !kou {
685
-				err = fmt.Errorf(FindDrugsName(v.DrugId) + "库存不足")
686
-				return
682
+			if orgid != 10217 && orgid != 10188 && orgid != 9671 && orgid != 10164 && orgid != 10387 {
683
+				////判断药品库存是否充足
684
+				kou := FenDrugInventory(v, orgid)
685
+				if !kou {
686
+					err = fmt.Errorf(FindDrugsName(v.DrugId) + "库存不足")
687
+					return
688
+				}
687
 			}
689
 			}
690
+
688
 			//扣减库存
691
 			//扣减库存
689
 			err = FenStock(orgid, creater, v)
692
 			err = FenStock(orgid, creater, v)
690
 			if err != nil {
693
 			if err != nil {
1998
 
2001
 
1999
 func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2002
 func FindeHisAdviceDocAdvice(orgid int64, patient_id int64, stime int64, etime int64) (advice []*models.HisDoctorAdviceInfo, err error) {
2000
 
2003
 
2001
-	db := XTReadDB().Model(&advice).Where("status= 1")
2004
+	db := XTReadDB().Model(&advice).Where("status= 1 and is_medicine = 0")
2002
 
2005
 
2003
 	if orgid > 0 {
2006
 	if orgid > 0 {
2004
 		db = db.Where("user_org_id = ?", orgid)
2007
 		db = db.Where("user_org_id = ?", orgid)

+ 2 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Ver fichero

107
 
107
 
108
 func GetAllAdminUsers(orgId int64, appid int64) (list []*AdminUserList, err error) {
108
 func GetAllAdminUsers(orgId int64, appid int64) (list []*AdminUserList, err error) {
109
 	db := p_service.UserReadDB()
109
 	db := p_service.UserReadDB()
110
-	err = db.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1 and uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
110
+	err = db.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
111
 	return
111
 	return
112
 }
112
 }
113
 
113
 
114
 func GetAllName(orgId int64, appid int64) (list []AdminUserListTwo, err error) {
114
 func GetAllName(orgId int64, appid int64) (list []AdminUserListTwo, err error) {
115
 	db := p_service.UserReadDB()
115
 	db := p_service.UserReadDB()
116
-	err = db.Table("sgj_user_admin_role as uar").Joins("left join sgj_user_admin as ua on ua.id = uar.admin_user_id").Joins("left join sgj_user_admin_electronic_signature  as e on e.creator = uar.admin_user_id").Where("uar.status=1 and uar.org_id=? and uar.app_id =? and ua.status=1 and e.status = 1 and e.org_id = ? and e.app_id = ?", orgId, appid, orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,e.url").Scan(&list).Error
116
+	err = db.Table("sgj_user_admin_role as uar").Joins("left join sgj_user_admin as ua on ua.id = uar.admin_user_id").Joins("left join sgj_user_admin_electronic_signature  as e on e.creator = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1 and e.status = 1 and e.org_id = ? and e.app_id = ?", orgId, appid, orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,e.url").Scan(&list).Error
117
 	return
117
 	return
118
 }
118
 }
119
 
119
 

+ 3 - 3
service/stock_service.go Ver fichero

1161
 }
1161
 }
1162
 
1162
 
1163
 func FindDrugWarehousingInfoById(id int64, org_id int64) (list []*VMDrugWarehouseInfo, err error) {
1163
 func FindDrugWarehousingInfoById(id int64, org_id int64) (list []*VMDrugWarehouseInfo, err error) {
1164
-	err = readDb.Model(&VMDrugWarehouseInfo{}).Preload("Drug", "status = 1 AND org_id = ? AND find_in_set('停用',drug_status) = 0", org_id).Where("warehousing_id = ? AND status = 1", id).Find(&list).Error
1164
+	err = readDb.Model(&VMDrugWarehouseInfo{}).Preload("Drug", "status = 1 AND org_id = ? AND find_in_set('',drug_status) = 0", org_id).Where("warehousing_id = ? AND status = 1", id).Find(&list).Error
1165
 	return list, err
1165
 	return list, err
1166
 }
1166
 }
1167
 
1167
 
3772
 
3772
 
3773
 func GetSearchDrugList(keywords string, orgid int64) (drug []*models.BaseDrugLib, err error) {
3773
 func GetSearchDrugList(keywords string, orgid int64) (drug []*models.BaseDrugLib, err error) {
3774
 
3774
 
3775
-	db := XTReadDB().Model(&drug).Where("org_id=? and status=1  and drug_status<>'停用'", orgid)
3775
+	db := XTReadDB().Model(&drug).Where("org_id=? and status=1 and find_in_set('停用',drug_status) = 0", orgid)
3776
 	if len(keywords) > 0 {
3776
 	if len(keywords) > 0 {
3777
 		likekey := "%" + keywords + "%"
3777
 		likekey := "%" + keywords + "%"
3778
 		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
3778
 		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
3788
 
3788
 
3789
 func GetSearchDrugListSix(keywords string, orgid int64, storehouse_id int64) (drug []*models.BaseDrugLib, err error) {
3789
 func GetSearchDrugListSix(keywords string, orgid int64, storehouse_id int64) (drug []*models.BaseDrugLib, err error) {
3790
 
3790
 
3791
-	db := XTReadDB().Model(&drug).Where("org_id=? and status=1  and drug_status<>'停用'", orgid)
3791
+	db := XTReadDB().Model(&drug).Where("org_id=? and status=1 and find_in_set('停用',drug_status) = 0", orgid)
3792
 	if len(keywords) > 0 {
3792
 	if len(keywords) > 0 {
3793
 		likekey := "%" + keywords + "%"
3793
 		likekey := "%" + keywords + "%"
3794
 		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
3794
 		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {