Browse Source

库存流水展示

XMLWAN 1 year ago
parent
commit
97b2e44620

+ 6 - 6
controllers/base_api_controller.go View File

@@ -82,7 +82,7 @@ func (this *BaseAuthAPIController) Prepare() {
82 82
 		userAdmin.ModifyTime = 1530786071
83 83
 		var subscibe models.ServeSubscibe
84 84
 		subscibe.ID = 11
85
-		subscibe.OrgId = 10440 //机构id
85
+		subscibe.OrgId = 9671 //机构id
86 86
 		subscibe.PeriodStart = 1547447814
87 87
 		subscibe.PeriodEnd = 1550039814
88 88
 		subscibe.State = 1
@@ -92,8 +92,8 @@ func (this *BaseAuthAPIController) Prepare() {
92 92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93 93
 		subscibes[4] = &subscibe
94 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 97
 		adminUserInfo.AdminUser = &userAdmin
98 98
 		adminUserInfo.Subscibes = subscibes
99 99
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -328,7 +328,7 @@ func (this *BaseServeAPIController) Prepare() {
328 328
 		userAdmin.ModifyTime = 1530786071
329 329
 		var subscibe models.ServeSubscibe
330 330
 		subscibe.ID = 11
331
-		subscibe.OrgId = 10440 //机构id小英9675或4
331
+		subscibe.OrgId = 9671 //机构id小英9675或4
332 332
 		subscibe.PeriodStart = 1538035409
333 333
 		subscibe.PeriodEnd = 1569571409
334 334
 		subscibe.State = 1
@@ -338,8 +338,8 @@ func (this *BaseServeAPIController) Prepare() {
338 338
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339 339
 		subscibes[4] = &subscibe
340 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 343
 		adminUserInfo.AdminUser = &userAdmin
344 344
 		adminUserInfo.Subscibes = subscibes
345 345
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 1 - 1
service/manage_service.go View File

@@ -1036,7 +1036,7 @@ func GetTimeData(equitid int64, orgid int64, timenow int64) (information []*mode
1036 1036
 	//db := UserReadDB().Table("xt_device_information as x").Where("x.status = 1")
1037 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 1038
 	day := time.Now().Day()
1039
-	oldMonth := day - 30
1039
+	oldMonth := day - 90
1040 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 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 View File

@@ -679,12 +679,15 @@ func DispensingMedicine(orgid, patient_id, stime, etime, creater int64) (err err
679 679
 			if PettyCash(v.DrugId) {
680 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 692
 			err = FenStock(orgid, creater, v)
690 693
 			if err != nil {
@@ -1998,7 +2001,7 @@ func GetAllValidDeviceZones02(orgID int64) ([]*models.DeviceZone, error) {
1998 2001
 
1999 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 2006
 	if orgid > 0 {
2004 2007
 		db = db.Where("user_org_id = ?", orgid)

+ 2 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go View File

@@ -107,13 +107,13 @@ type AdminUserListTwo struct {
107 107
 
108 108
 func GetAllAdminUsers(orgId int64, appid int64) (list []*AdminUserList, err error) {
109 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 111
 	return
112 112
 }
113 113
 
114 114
 func GetAllName(orgId int64, appid int64) (list []AdminUserListTwo, err error) {
115 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 117
 	return
118 118
 }
119 119
 

+ 3 - 3
service/stock_service.go View File

@@ -1161,7 +1161,7 @@ func FindWarehousingInfoByIdOne(id []int64) (list []*models.WarehousingInfo, err
1161 1161
 }
1162 1162
 
1163 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 1165
 	return list, err
1166 1166
 }
1167 1167
 
@@ -3772,7 +3772,7 @@ func GetWarehouseOrderInfoList(orgid int64) (list []*models.WarehousingInfo, err
3772 3772
 
3773 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 3776
 	if len(keywords) > 0 {
3777 3777
 		likekey := "%" + keywords + "%"
3778 3778
 		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {
@@ -3788,7 +3788,7 @@ func GetSearchDrugList(keywords string, orgid int64) (drug []*models.BaseDrugLib
3788 3788
 
3789 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 3792
 	if len(keywords) > 0 {
3793 3793
 		likekey := "%" + keywords + "%"
3794 3794
 		err = db.Where("(drug_name LIKE ?)", likekey).Preload("DrugWarehouseInfo", func(db *gorm.DB) *gorm.DB {