XMLWAN il y a 2 ans
Parent
révision
0009a8c6b8

+ 2 - 1
.idea/vcs.xml Voir le fichier

@@ -7,5 +7,6 @@
7 7
   </component>
8 8
   <component name="VcsDirectoryMappings">
9 9
     <mapping directory="$PROJECT_DIR$" vcs="Git" />
10
+    <mapping directory="$PROJECT_DIR$/src/golang.org/x/sync" vcs="Git" />
10 11
   </component>
11
-</project>
12
+</project>

+ 1 - 0
controllers/dialysis_api_controller.go Voir le fichier

@@ -1289,6 +1289,7 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
1289 1289
 	assessment.MachineRun = data.MachineRun
1290 1290
 	assessment.AfterUrea = data.AfterUrea
1291 1291
 	assessment.PipCoagulation = data.PipCoagulation
1292
+	assessment.AccumulatedBloodVolume = data.AccumulatedBloodVolume
1292 1293
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
1293 1294
 
1294 1295
 	if assessment.ID > 0 {

+ 0 - 1
controllers/stock_in_api_controller.go Voir le fichier

@@ -7021,7 +7021,6 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7021 7021
 	//更改审核状态
7022 7022
 	err := service.UpdateCheckWarehouseInfo(warehousing_info_id)
7023 7023
 	if err == nil {
7024
-
7025 7024
 		list, _ := service.GetWarehouseInfoList(warehousing_info_id, orgId)
7026 7025
 		Creator := this.GetAdminUserInfo().AdminUser.Id
7027 7026
 		for _, item := range list {

+ 1 - 0
models/dialysis.go Voir le fichier

@@ -640,6 +640,7 @@ type AssessmentAfterDislysis struct {
640 640
 	MachineRun                      string  `gorm:"column:machine_run" json:"machine_run" form:"machine_run"`
641 641
 	AfterUrea                       string  `gorm:"column:after_urea" json:"after_urea" form:"after_urea"`
642 642
 	PipCoagulation                  string  `gorm:"column:pip_coagulation" json:"pip_coagulation" form:"pip_coagulation"`
643
+	AccumulatedBloodVolume          string  `gorm:"column:accumulated_blood_volume" json:"accumulated_blood_volume" form:"accumulated_blood_volume"`
643 644
 }
644 645
 
645 646
 func (AssessmentAfterDislysis) TableName() string {

+ 1 - 1
service/auto_create_week_schedules_service.go Voir le fichier

@@ -142,7 +142,7 @@ func _refreshWeekSchedulesWithTemplateItems(tx *gorm.DB, orgID int64, week time.
142 142
 
143 143
 	now := time.Now()
144 144
 	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&week)
145
-	disableErr := tx.Model(&models.Schedule{}).Where("user_org_id = ? AND status = 1 AND schedule_date >= ? AND schedule_date <= ?", orgID, monday.Unix(), sunday.Unix()).Updates(map[string]interface{}{"status": 0, "mtime": now.Unix()}).Error
145
+	disableErr := tx.Model(&models.Schedule{}).Where("user_org_id = ? AND status = 1 AND schedule_date >= ? AND schedule_date <= ?", orgID, monday.Unix(), sunday.Unix()).Updates(map[string]interface{}{"status": 0, "updated_time": now.Unix()}).Error
146 146
 	//fmt.Println("disableErr323232332323232233222332232332",disableErr)
147 147
 	if disableErr != nil {
148 148
 		return disableErr

+ 2 - 1
service/his_config_service.go Voir le fichier

@@ -3,10 +3,11 @@ package service
3 3
 import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/models"
6
+	"XT_New/src/golang.org/x/sync/errgroup"
6 7
 	"XT_New/utils"
7 8
 	"fmt"
8 9
 	"github.com/astaxie/beego/config"
9
-	"golang.org/x/sync/errgroup"
10
+
10 11
 	"reflect"
11 12
 	"strconv"
12 13
 	"time"

+ 2 - 0
service/mobile_dialysis_service.go Voir le fichier

@@ -634,6 +634,7 @@ func MobileGetPredialysisEvaluation(orgID int64, patientID int64, recordDate int
634 634
 	defer redis.Close()
635 635
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate, 10) + ":assessment_before_dislysis"
636 636
 	assessment_before_dislysis_str, _ := redis.Get(key).Result()
637
+	redis.Set(key, "", time.Second)
637 638
 	if len(assessment_before_dislysis_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
638 639
 		err := readDb.Model(&models.PredialysisEvaluation{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date = ?", patientID, orgID, recordDate).First(&record).Error
639 640
 		if err != nil {
@@ -901,6 +902,7 @@ func MobileGetMonitorRecords(orgID int64, patientID int64, recordDate int64) ([]
901 902
 
902 903
 	// cur_date := time.Now().Format("2006-01-02")
903 904
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate, 10) + ":monitor_records"
905
+	redis.Set(key, "", time.Second)
904 906
 	monitor_records_str, _ := redis.Get(key).Result()
905 907
 
906 908
 	if len(monitor_records_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis

+ 152 - 36
service/stock_service.go Voir le fichier

@@ -753,8 +753,13 @@ func UpdateDrugFlowTens(patientid int64, warehouse_out_number string, drug_id in
753 753
 }
754 754
 
755 755
 func CreateDrugFlowTwo(flow *models.DrugFlow) error {
756
-
757
-	err := XTWriteDB().Create(&flow).Error
756
+	tx := XTWriteDB().Begin()
757
+	err := tx.Create(&flow).Error
758
+	if err != nil {
759
+		tx.Rollback()
760
+		return err
761
+	}
762
+	tx.Commit()
758 763
 	return err
759 764
 }
760 765
 func FindLastWarehousingInfo(order string) (info models.WarehousingInfo, err error) {
@@ -4896,8 +4901,13 @@ func CreateStockFlow(warehousingInfo []*models.VmStockFlow) (err error) {
4896 4901
 }
4897 4902
 
4898 4903
 func CreateStockFlowOne(flow models.VmStockFlow) error {
4899
-
4900
-	err := XTWriteDB().Create(&flow).Error
4904
+	tx := XTWriteDB().Begin()
4905
+	err := tx.Create(&flow).Error
4906
+	if err != nil {
4907
+		tx.Rollback()
4908
+		return err
4909
+	}
4910
+	tx.Commit()
4901 4911
 	return err
4902 4912
 }
4903 4913
 
@@ -6564,8 +6574,13 @@ func ModifyGoodReduceInformationTwentyOne(good_id int64, waresing_count int64, s
6564 6574
 }
6565 6575
 
6566 6576
 func UpdateMedicalSumCount(drug_id int64, sum_count int64, sum_in_count int64, orgid int64) error {
6567
-
6568
-	err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and org_id = ? and status = 1", drug_id, orgid).Update(map[string]interface{}{"sum_count": sum_count, "sum_in_count": sum_in_count}).Error
6577
+	tx := XTWriteDB().Begin()
6578
+	err := tx.Model(&models.BaseDrugLib{}).Where("id = ? and org_id = ? and status = 1", drug_id, orgid).Update(map[string]interface{}{"sum_count": sum_count, "sum_in_count": sum_in_count}).Error
6579
+	if err != nil {
6580
+		tx.Rollback()
6581
+		return err
6582
+	}
6583
+	tx.Commit()
6569 6584
 	return err
6570 6585
 }
6571 6586
 
@@ -7080,8 +7095,13 @@ func UpdateWarehouseDetail(info *models.WarehousingInfo, id int64) error {
7080 7095
 }
7081 7096
 
7082 7097
 func UpdateCheckWarehouseInfo(id int64) error {
7083
-
7084
-	err := XTWriteDB().Model(&models.Warehousing{}).Where("id =? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7098
+	tx := XTWriteDB().Begin()
7099
+	err := tx.Model(&models.Warehousing{}).Where("id =? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7100
+	if err != nil {
7101
+		tx.Rollback()
7102
+		return err
7103
+	}
7104
+	tx.Commit()
7085 7105
 	return err
7086 7106
 }
7087 7107
 
@@ -7092,29 +7112,58 @@ func GetWarehouseInfoList(id int64, orgid int64) (info []*models.WarehousingInfo
7092 7112
 }
7093 7113
 
7094 7114
 func UpdateWarehouseInfoByIdList(count int64, id int64) error {
7095
-
7096
-	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_count", gorm.Expr("stock_count + ?", count)).Error
7097
-	err = XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7115
+	tx := XTWriteDB().Begin()
7116
+	err := tx.Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_count", gorm.Expr("stock_count + ?", count)).Error
7117
+	if err != nil {
7118
+		tx.Rollback()
7119
+		return err
7120
+	}
7121
+	err = tx.Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7122
+	if err != nil {
7123
+		tx.Rollback()
7124
+		return err
7125
+	}
7126
+	tx.Commit()
7098 7127
 	return err
7099 7128
 }
7100 7129
 
7101 7130
 func ReturnCheckWarehouseInfo(id int64) error {
7102
-
7103
-	err := XTWriteDB().Model(&models.Warehousing{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7104
-	err = XTWriteDB().Model(&models.WarehousingInfo{}).Where("warehousing_id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7131
+	tx := XTWriteDB().Begin()
7132
+	err := tx.Model(&models.Warehousing{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7133
+	if err != nil {
7134
+		tx.Rollback()
7135
+		return err
7136
+	}
7137
+	err = tx.Model(&models.WarehousingInfo{}).Where("warehousing_id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7138
+	tx.Commit()
7105 7139
 	return err
7106 7140
 }
7107 7141
 
7108 7142
 func UpdateWarehouseInfoByIdListTwo(count int64, id int64) error {
7109
-
7110
-	err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_count", gorm.Expr("stock_count - ?", count)).Error
7111
-	err = XTWriteDB().Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7143
+	tx := XTWriteDB().Begin()
7144
+	err := tx.Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_count", gorm.Expr("stock_count - ?", count)).Error
7145
+	if err != nil {
7146
+		tx.Rollback()
7147
+		return err
7148
+	}
7149
+	err = tx.Model(&models.WarehousingInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7150
+	if err != nil {
7151
+		tx.Rollback()
7152
+		return err
7153
+	}
7154
+	tx.Commit()
7112 7155
 	return err
7113 7156
 }
7114 7157
 
7115 7158
 func UpdateWarehouseInfoFlow(id int64) error {
7159
+	tx := XTWriteDB().Begin()
7160
+	err := tx.Model(models.VmStockFlow{}).Where("warehousing_detail_id =  ?", id).Update(map[string]interface{}{"status": 0}).Error
7116 7161
 
7117
-	err := XTWriteDB().Model(models.VmStockFlow{}).Where("warehousing_detail_id =  ?", id).Update(map[string]interface{}{"status": 0}).Error
7162
+	if err != nil {
7163
+		tx.Rollback()
7164
+		return err
7165
+	}
7166
+	tx.Commit()
7118 7167
 	return err
7119 7168
 }
7120 7169
 
@@ -7158,8 +7207,13 @@ func UpdateWarehouseing(info *models.DrugWarehouseInfo) error {
7158 7207
 }
7159 7208
 
7160 7209
 func CheckWarehousingInfo(id int64, orgid int64) error {
7161
-
7162
-	err := XTWriteDB().Model(&models.DrugWarehouse{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
7210
+	tx := XTWriteDB().Begin()
7211
+	err := tx.Model(&models.DrugWarehouse{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"is_check": 1}).Error
7212
+	if err != nil {
7213
+		tx.Rollback()
7214
+		return err
7215
+	}
7216
+	tx.Commit()
7163 7217
 	return err
7164 7218
 }
7165 7219
 
@@ -7170,41 +7224,89 @@ func GetWarehousingInfoByList(id int64, orgid int64) (info []*models.DrugWarehou
7170 7224
 }
7171 7225
 
7172 7226
 func AddDrugWarehouseStockMaxNumber(count int64, id int64) error {
7173
-
7174
-	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number + ?", count)).Error
7175
-	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7227
+	tx := XTWriteDB().Begin()
7228
+	err := tx.Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number + ?", count)).Error
7229
+	if err != nil {
7230
+		tx.Rollback()
7231
+		return err
7232
+	}
7233
+	err = tx.Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7234
+	if err != nil {
7235
+		tx.Rollback()
7236
+		return err
7237
+	}
7238
+	tx.Commit()
7176 7239
 	return err
7177 7240
 }
7178 7241
 
7179 7242
 func UpdateWarehousingInfoFlow(id int64, orgid int64) error {
7180
-
7181
-	err := XTWriteDB().Model(&models.DrugFlow{}).Where("warehousing_detail_id = ? and user_org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"status": 0}).Error
7243
+	tx := XTWriteDB().Begin()
7244
+	err := tx.Model(&models.DrugFlow{}).Where("warehousing_detail_id = ? and user_org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"status": 0}).Error
7245
+	if err != nil {
7246
+		tx.Rollback()
7247
+		return err
7248
+	}
7249
+	tx.Commit()
7182 7250
 	return err
7183 7251
 }
7184 7252
 
7185 7253
 func AddDrugWarehouseStockMinNumber(count int64, id int64) error {
7186
-
7254
+	tx := XTWriteDB().Begin()
7187 7255
 	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_min_number", gorm.Expr("stock_min_number + ?", count)).Error
7256
+	if err != nil {
7257
+		tx.Rollback()
7258
+		return err
7259
+	}
7188 7260
 	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 1}).Error
7261
+	tx.Commit()
7189 7262
 	return err
7190 7263
 }
7191 7264
 
7192 7265
 func ReturnCheckWarehouseingInfo(id int64, orgid int64) error {
7193
-
7266
+	tx := XTWriteDB().Begin()
7194 7267
 	err := XTWriteDB().Model(&models.DrugWarehouse{}).Where("id = ? and status = 1 and org_id = ?", id, orgid).Update(map[string]interface{}{"is_check": 2}).Error
7268
+	if err != nil {
7269
+		tx.Rollback()
7270
+		return err
7271
+	}
7195 7272
 	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("warehousing_id = ? and status = 1 and org_id = ?", id, orgid).Update(map[string]interface{}{"is_check": 2}).Error
7273
+	if err != nil {
7274
+		tx.Rollback()
7275
+		return err
7276
+	}
7277
+	tx.Commit()
7196 7278
 	return err
7197 7279
 }
7198 7280
 
7199 7281
 func AddDrugReturnWarehouseStockMaxNumber(count int64, id int64) error {
7200
-	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number - ?", count)).Error
7201
-	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7282
+	tx := XTWriteDB().Begin()
7283
+	err := tx.Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_max_number", gorm.Expr("stock_max_number - ?", count)).Error
7284
+	if err != nil {
7285
+		tx.Rollback()
7286
+		return err
7287
+	}
7288
+	err = tx.Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7289
+	if err != nil {
7290
+		tx.Rollback()
7291
+		return err
7292
+	}
7293
+	tx.Commit()
7202 7294
 	return err
7203 7295
 }
7204 7296
 
7205 7297
 func AddDrugReturnWarehouseStockMinNumber(count int64, id int64) error {
7206
-	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_min_number", gorm.Expr("stock_min_number - ?", count)).Error
7207
-	err = XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7298
+	tx := XTWriteDB().Begin()
7299
+	err := tx.Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).UpdateColumn("stock_min_number", gorm.Expr("stock_min_number - ?", count)).Error
7300
+	if err != nil {
7301
+		tx.Rollback()
7302
+		return err
7303
+	}
7304
+	err = tx.Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"is_check": 2}).Error
7305
+	if err != nil {
7306
+		tx.Rollback()
7307
+		return err
7308
+	}
7309
+	tx.Commit()
7208 7310
 	return err
7209 7311
 }
7210 7312
 
@@ -7318,8 +7420,13 @@ func UpdateGoodInfoReduceSumCount(goodid int64, sum_count int64, orgid int64) er
7318 7420
 }
7319 7421
 
7320 7422
 func UpdateGoodInfoAddSumCount(goodid int64, sum_count int64, orgid int64) error {
7321
-
7322
-	err := XTReadDB().Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
7423
+	tx := XTWriteDB().Begin()
7424
+	err := tx.Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", goodid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
7425
+	if err != nil {
7426
+		tx.Rollback()
7427
+		return err
7428
+	}
7429
+	tx.Commit()
7323 7430
 	return err
7324 7431
 }
7325 7432
 
@@ -7424,9 +7531,18 @@ func GetDrugAllStockInfo(storehouse_id int64, orgid int64, drugid int64) (info [
7424 7531
 }
7425 7532
 
7426 7533
 func UpdateBaseDrugSumInfo(sum_count int64, drugid int64, orgid int64, sum_in_count int64) error {
7427
-
7428
-	err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
7429
-	err = XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_in_count": sum_in_count}).Error
7534
+	tx := XTWriteDB().Begin()
7535
+	err := tx.Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_count": sum_count}).Error
7536
+	if err != nil {
7537
+		tx.Rollback()
7538
+		return err
7539
+	}
7540
+	err = tx.Model(&models.BaseDrugLib{}).Where("id = ? and status = 1 and org_id = ?", drugid, orgid).Update(map[string]interface{}{"sum_in_count": sum_in_count}).Error
7541
+	if err != nil {
7542
+		tx.Rollback()
7543
+		return err
7544
+	}
7545
+	tx.Commit()
7430 7546
 	return err
7431 7547
 }
7432 7548
 

+ 1 - 0
src/golang.org/x/sync

@@ -0,0 +1 @@
1
+Subproject commit f12130a5280420d36872ab0a7717d160c768df46