28169 3 nedēļas atpakaļ
vecāks
revīzija
b1e8eeea93

+ 23 - 23
conf/app.conf Parādīt failu

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = dev
3
+runmode = prod
4 4
 #dev/prod
5 5
 
6 6
 #
@@ -51,75 +51,75 @@ sso_domain = https://sso.kuyicloud.com
51 51
 call_domain = https://hf.sgjyun.com
52 52
 front_end_domain = "https://xt.kuyicloud.com/#"
53 53
 
54
-readmysqlhost = shengws1.mysql.rds.aliyuncs.com
54
+readmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
55 55
 readmysqlport = 3306
56 56
 readmysqluser = syh
57
-readmysqlpass = xhPECP2nFObR8aUK
57
+readmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
58 58
 readmysqlname = sgj_xt
59 59
 
60 60
 
61 61
 
62
-readmysqlhost2 = rr-kuyicloud.mysql.rds.aliyuncs.com
62
+readmysqlhost2 = read-kuyicloud2024lt.mysql.rds.aliyuncs.com
63 63
 readmysqlport2 = 3306
64 64
 readmysqluser2 = syh
65
-readmysqlpass2 = xhPECP2nFObR8aUK
65
+readmysqlpass2 = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
66 66
 readmysqlname2 = sgj_xt
67 67
 
68
-writemysqlhost = shengws1.mysql.rds.aliyuncs.com
68
+writemysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
69 69
 writemysqlport = 3306
70 70
 writemysqluser = syh
71
-writemysqlpass = xhPECP2nFObR8aUK
71
+writemysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
72 72
 writemysqlname = sgj_xt
73 73
 
74 74
 
75
-readuserhost = shengws1.mysql.rds.aliyuncs.com
75
+readuserhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
76 76
 readuserport = 3306
77 77
 readuseruser = syh
78
-readuserpass = xhPECP2nFObR8aUK
78
+readuserpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
79 79
 readusername = sgj_users
80 80
 
81
-writeuserhost = shengws1.mysql.rds.aliyuncs.com
81
+writeuserhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
82 82
 writeuserport = 3306
83 83
 writeuseruser = syh
84
-writeuserpass = xhPECP2nFObR8aUK
84
+writeuserpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
85 85
 writeusername = sgj_users
86 86
 
87
-readmiddlehost = shengws1.mysql.rds.aliyuncs.com
87
+readmiddlehost = kuyicloud2024lt.mysql.rds.aliyuncs.com
88 88
 readmiddleport = 3306
89 89
 readmiddleuser = syh
90
-readmiddlepass = xhPECP2nFObR8aUK
90
+readmiddlepass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
91 91
 readmiddlename = ky_xt_middle
92 92
 
93
-writemiddlehost = shengws1.mysql.rds.aliyuncs.com
93
+writemiddlehost = kuyicloud2024lt.mysql.rds.aliyuncs.com
94 94
 writemiddleport = 3306
95 95
 writemiddleuser = syh
96
-writemiddlepass = xhPECP2nFObR8aUK
96
+writemiddlepass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
97 97
 writemiddlename = ky_xt_middle
98 98
 
99 99
 
100
-readsgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
100
+readsgjpatientmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
101 101
 readsgjpatientmysqlport = 3306
102 102
 readsgjpatientmysqluser = syh
103
-readsgjpatientmysqlpass = xhPECP2nFObR8aUK
103
+readsgjpatientmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
104 104
 readsgjpatientmysqlname = sgj_patient
105 105
 
106
-writesgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
106
+writesgjpatientmysqlhost = kuyicloud2024lt.mysql.rds.aliyuncs.com
107 107
 writesgjpatientmysqlport = 3306
108 108
 writesgjpatientmysqluser = syh
109
-writesgjpatientmysqlpass = xhPECP2nFObR8aUK
109
+writesgjpatientmysqlpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
110 110
 writesgjpatientmysqlname = sgj_patient
111 111
 
112 112
 
113
-readpatienthost = shengws1.mysql.rds.aliyuncs.com
113
+readpatienthost = kuyicloud2024lt.mysql.rds.aliyuncs.com
114 114
 readpatientport = 3306
115 115
 readpatientuser = syh
116
-readpatientpass = xhPECP2nFObR8aUK
116
+readpatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
117 117
 readpatientname = sgj_cdm
118 118
 
119
-writepatienthost = shengws1.mysql.rds.aliyuncs.com
119
+writepatienthost = kuyicloud2024lt.mysql.rds.aliyuncs.com
120 120
 writepatientport = 3306
121 121
 writepatientuser = syh
122
-writepatientpass = xhPECP2nFObR8aUK
122
+writepatientpass = Zc8xxwN4jkZswprx8VKHRSd2rBMRWgC4
123 123
 writepatientname = sgj_cdm
124 124
 
125 125
 redishost = kuyicloud.redis.rds.aliyuncs.com

+ 15 - 12
controllers/his_api_controller.go Parādīt failu

@@ -3100,7 +3100,7 @@ func (c *HisApiController) CreateHisPrescription() {
3100 3100
 	var adviceList []models.HisDoctorAdviceInfo
3101 3101
 	var projectList []models.HisPrescriptionProject
3102 3102
 
3103
-	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10164 {
3103
+	if adminInfo.CurrentOrgId == 10489 {
3104 3104
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3105 3105
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3106 3106
 
@@ -3154,16 +3154,18 @@ func (c *HisApiController) CreateHisPrescription() {
3154 3154
 						utils.ErrorLog("pre_time")
3155 3155
 					}
3156 3156
 					preTime, _ := items["pre_time"].(string)
3157
-
3157
+					fmt.Println("preTime", preTime)
3158 3158
 					timeLayout := "2006-01-02"
3159 3159
 					loc, _ := time.LoadLocation("Local")
3160 3160
 					theTime2, err := time.ParseInLocation(timeLayout+" 15:04", preTime, loc)
3161
+					result := strings.Split(preTime, " ")
3162
+					theTime3, _ := time.ParseInLocation(timeLayout, result[0], loc)
3161 3163
 					if err != nil {
3162 3164
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
3163 3165
 						return
3164 3166
 					}
3165 3167
 					pTime := theTime2.Unix()
3166
-					fmt.Println("pTime----------------------------------------", pTime)
3168
+
3167 3169
 					ctime := time.Now().Unix()
3168 3170
 
3169 3171
 					if tempPrescription.ID == 0 {
@@ -3246,10 +3248,10 @@ func (c *HisApiController) CreateHisPrescription() {
3246 3248
 								s.AdviceDoctor = doctor_id
3247 3249
 								s.StopState = 2
3248 3250
 								s.ExecutionState = 2
3249
-								s.AdviceDate = recordDateTime
3251
+								s.AdviceDate = theTime3.Unix()
3250 3252
 								s.Status = 1
3251 3253
 								s.UserOrgId = adminInfo.CurrentOrgId
3252
-								s.RecordDate = recordDateTime
3254
+								s.RecordDate = theTime3.Unix()
3253 3255
 								s.StartTime = tempPrescription.PreTime
3254 3256
 								s.Groupno = groupNo
3255 3257
 								s.CreatedTime = ctime
@@ -3485,7 +3487,7 @@ func (c *HisApiController) CreateHisPrescription() {
3485 3487
 								p.Ctime = time.Now().Unix()
3486 3488
 								p.Mtime = time.Now().Unix()
3487 3489
 								p.PatientId = patient_id
3488
-								p.RecordDate = recordDateTime
3490
+								p.RecordDate = theTime3.Unix()
3489 3491
 								p.Doctor = doctor_id
3490 3492
 								p.UserOrgId = adminInfo.CurrentOrgId
3491 3493
 								p.HisPatientId = his_patient_id
@@ -3551,9 +3553,6 @@ func (c *HisApiController) CreateHisPrescription() {
3551 3553
 										}
3552 3554
 										parseIntCount, _ := strconv.ParseInt(p.Count, 10, 64)
3553 3555
 
3554
-										fmt.Println("出库数据------------------------------------------", out_count_five)
3555
-										fmt.Println("出库数据------------------------------------------2", parseIntCount)
3556
-
3557 3556
 										//如果当前处方的出库数量和已经出库的数量不一致,需要进行退库或者出库
3558 3557
 										if out_count_five != parseIntCount {
3559 3558
 											//查询耗材最后一次出库记录
@@ -4165,6 +4164,9 @@ func (c *HisApiController) CreateHisPrescription() {
4165 4164
 					timeLayout := "2006-01-02"
4166 4165
 					loc, _ := time.LoadLocation("Local")
4167 4166
 					theTime2, err := time.ParseInLocation(timeLayout+" 15:04", preTime, loc)
4167
+					result := strings.Split(preTime, " ")
4168
+					theTime3, _ := time.ParseInLocation(timeLayout, result[0], loc)
4169
+					fmt.Println("theTime30000000000000000000000", theTime3.Unix())
4168 4170
 					if err != nil {
4169 4171
 						c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4170 4172
 						return
@@ -4244,10 +4246,10 @@ func (c *HisApiController) CreateHisPrescription() {
4244 4246
 								s.AdviceDoctor = doctor_id
4245 4247
 								s.StopState = 2
4246 4248
 								s.ExecutionState = 2
4247
-								s.AdviceDate = recordDateTime
4249
+								s.AdviceDate = theTime3.Unix()
4248 4250
 								s.Status = 1
4249 4251
 								s.UserOrgId = adminInfo.CurrentOrgId
4250
-								s.RecordDate = recordDateTime
4252
+								s.RecordDate = theTime3.Unix()
4251 4253
 								s.StartTime = tempPrescription.PreTime
4252 4254
 								s.Groupno = groupNo
4253 4255
 								s.CreatedTime = ctime
@@ -4348,7 +4350,7 @@ func (c *HisApiController) CreateHisPrescription() {
4348 4350
 								p.Ctime = time.Now().Unix()
4349 4351
 								p.Mtime = time.Now().Unix()
4350 4352
 								p.PatientId = patient_id
4351
-								p.RecordDate = recordDateTime
4353
+								p.RecordDate = theTime3.Unix()
4352 4354
 								p.Doctor = doctor_id
4353 4355
 								p.UserOrgId = adminInfo.CurrentOrgId
4354 4356
 								p.HisPatientId = his_patient_id
@@ -4773,6 +4775,7 @@ func (c *HisApiController) CreateHisPrescription() {
4773 4775
 				}
4774 4776
 			}
4775 4777
 		}
4778
+		tx.Commit()
4776 4779
 		if err == nil {
4777 4780
 			c.ServeSuccessJSON(map[string]interface{}{
4778 4781
 				"msg": "保存成功",

+ 1 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Parādīt failu

@@ -409,6 +409,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
409 409
 				newprescribe.Sodium = 138
410 410
 				newprescribe.Bicarbonate = 31.1
411 411
 				newprescribe.DialysateFlow = 500
412
+				newprescribe.TargetUltrafiltration = 0
412 413
 			}
413 414
 			// 针对新化博翔
414 415
 			if adminUserInfo.Org.Id == 10447 {

+ 16 - 16
controllers/mobile_api_controllers/patient_api_controller.go Parādīt failu

@@ -1665,22 +1665,22 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1665 1665
 				}
1666 1666
 
1667 1667
 				//
1668
-				if config.IsOpen == 1 && item.UserOrgId == 10210 {
1669
-
1670
-					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1671
-					//更新字典里面的库存
1672
-					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1673
-					var sum_count int64
1674
-					for _, its := range stockInfo {
1675
-						if its.MaxUnit == medical.MaxUnit {
1676
-							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1677
-						}
1678
-						sum_count += its.StockMaxNumber + its.StockMinNumber
1679
-					}
1680
-					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1681
-					//剩余库存
1682
-					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1683
-				}
1668
+				//if config.IsOpen == 1 && item.UserOrgId == 10210 {
1669
+				//
1670
+				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1671
+				//	//更新字典里面的库存
1672
+				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1673
+				//	var sum_count int64
1674
+				//	for _, its := range stockInfo {
1675
+				//		if its.MaxUnit == medical.MaxUnit {
1676
+				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1677
+				//		}
1678
+				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1679
+				//	}
1680
+				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1681
+				//	//剩余库存
1682
+				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1683
+				//}
1684 1684
 
1685 1685
 			}
1686 1686
 		}

+ 12 - 1
controllers/patient_api_controller.go Parādīt failu

@@ -143,6 +143,8 @@ func PatientApiRegistRouters() {
143 143
 
144 144
 	beego.Router("/api/patient/getpatientcriticalonelist", &PatientApiController{}, "Get:GetPatientCriticalOneList")
145 145
 
146
+	beego.Router("/api/patient/deletesolution", &PatientApiController{}, "Get:DeleteSolution")
147
+
146 148
 }
147 149
 func (c *PatientApiController) GetExportList() {
148 150
 	startTime := c.GetString("start_time")
@@ -1130,7 +1132,7 @@ func (c *PatientApiController) UpdateDialysisSolution() {
1130 1132
 	loc, _ := time.LoadLocation("Local")
1131 1133
 	todayTime, err := time.ParseInLocation(timeLayout, today, loc)
1132 1134
 
1133
-	if adminUserInfo.CurrentOrgId == 9538 || adminUserInfo.CurrentOrgId == 10375 || adminUserInfo.CurrentOrgId == 10164 {
1135
+	if adminUserInfo.CurrentOrgId == 9538 || adminUserInfo.CurrentOrgId == 10164 {
1134 1136
 		prescription := models.DialysisPrescription{
1135 1137
 			Dialyzer:                   solution.Dialyzer,
1136 1138
 			Anticoagulant:              solution.Anticoagulant,
@@ -6776,3 +6778,12 @@ func (c *PatientApiController) GetPatientCriticalOneList() {
6776 6778
 		"list": list,
6777 6779
 	})
6778 6780
 }
6781
+
6782
+func (c *PatientApiController) DeleteSolution() {
6783
+
6784
+	id, _ := c.GetInt64("id")
6785
+	solution, _ := service.DeleteSolutionById(id)
6786
+	c.ServeSuccessJSON(map[string]interface{}{
6787
+		"solution": solution,
6788
+	})
6789
+}

+ 4 - 4
controllers/stock_in_api_controller.go Parādīt failu

@@ -7970,13 +7970,13 @@ func (this *StockManagerApiController) GetStockFlowOrderList() {
7970 7970
 			var count int64
7971 7971
 
7972 7972
 			if index == 0 {
7973
-				count = list[index].OverCount - list[index].Count
7973
+				count = list[index].FlushOverCount - list[index].Count
7974 7974
 				service.UpdateOverCount(list[index+1].ID, count)
7975 7975
 			}
7976 7976
 
7977 7977
 			if index >= 1 {
7978 7978
 				lastStockFlow, _ := service.GetLastOverCount(list[index-1].ID)
7979
-				count = lastStockFlow.OverCount - list[index].Count
7979
+				count = lastStockFlow.FlushOverCount - list[index].Count
7980 7980
 				service.UpdateOverCount(list[index].ID, count)
7981 7981
 			}
7982 7982
 
@@ -7984,14 +7984,14 @@ func (this *StockManagerApiController) GetStockFlowOrderList() {
7984 7984
 		if list[index].ConsumableType == 7 || list[index].ConsumableType == 4 || list[index].ConsumableType == 1 || list[index].ConsumableType == 10 || list[index].ConsumableType == 13 {
7985 7985
 			if index == 0 {
7986 7986
 				var count int64
7987
-				count = list[index].OverCount + list[index].Count
7987
+				count = list[index].FlushOverCount + list[index].Count
7988 7988
 				service.UpdateOverCount(list[index+1].ID, count)
7989 7989
 			}
7990 7990
 
7991 7991
 			if index >= 1 {
7992 7992
 				var count int64
7993 7993
 				lastStockFlow, _ := service.GetLastOverCount(list[index-1].ID)
7994
-				count = lastStockFlow.OverCount + list[index].Count
7994
+				count = lastStockFlow.FlushOverCount + list[index].Count
7995 7995
 				service.UpdateOverCount(list[index].ID, count)
7996 7996
 			}
7997 7997
 

+ 1 - 0
models/stock_models.go Parādīt failu

@@ -693,6 +693,7 @@ type VmStockFlow struct {
693 693
 	OverCount                 int64           `gorm:"column:over_count" json:"over_count" form:"over_count"`
694 694
 	OrderId                   int64           `gorm:"column:order_id" json:"order_id" form:"order_id"`
695 695
 	Remark                    string          `gorm:"column:remark" json:"remark" form:"remark"`
696
+	FlushOverCount            int64           `gorm:"column:flush_over_count" json:"flush_over_count" form:"flush_over_count"`
696 697
 }
697 698
 
698 699
 func (VmStockFlow) TableName() string {

+ 12 - 7
service/new_warehouse_service.go Parādīt failu

@@ -2752,11 +2752,13 @@ func FindNewDrugCancelStock(return_date int64, org_id int64, tx *gorm.DB) (*mode
2752 2752
 	stock := models.DrugCancelStock{}
2753 2753
 	var err error
2754 2754
 	err = tx.Where("return_time = ? and org_id = ? and status = 1", return_date, org_id).Find(&stock).Error
2755
-
2756
-	if err != nil {
2757
-		tx.Rollback()
2758
-		return &stock, nil
2755
+	if err != gorm.ErrRecordNotFound {
2756
+		if err != nil {
2757
+			tx.Rollback()
2758
+			return &stock, nil
2759
+		}
2759 2760
 	}
2761
+
2760 2762
 	return &stock, nil
2761 2763
 }
2762 2764
 
@@ -2771,10 +2773,13 @@ func FindNewLastDrugCancelStock(advice_date int64, org_id int64, tx *gorm.DB) (m
2771 2773
 
2772 2774
 	cancelStock := models.DrugCancelStock{}
2773 2775
 	err := tx.Where("return_time = ? and org_id = ? and status = 1", advice_date, org_id).Find(&cancelStock).Error
2774
-	if err != nil {
2775
-		tx.Rollback()
2776
-		return cancelStock, err
2776
+	if err != gorm.ErrRecordNotFound {
2777
+		if err != nil {
2778
+			tx.Rollback()
2779
+			return cancelStock, err
2780
+		}
2777 2781
 	}
2782
+
2778 2783
 	return cancelStock, err
2779 2784
 }
2780 2785
 

+ 9 - 0
service/patient_service.go Parādīt failu

@@ -4015,3 +4015,12 @@ func GetInspectionByPatientId(patient_id int64, item_id int64) (models.XtInspect
4015 4015
 	err := XTReadDB().Where("patient_id =? and status =1 and inspect_date>=1704038400 and inspect_date<=1711814400 and item_id =?", patient_id, item_id).Order("id asc").Last(&inspection).Limit(1).Error
4016 4016
 	return inspection, err
4017 4017
 }
4018
+
4019
+func DeleteSolutionById(id int64) (models.DialysisSolution, error) {
4020
+
4021
+	solution := models.DialysisSolution{}
4022
+
4023
+	err := XTWriteDB().Model(&solution).Where("id=? and status=1", id).Updates(map[string]interface{}{"status": 12}).Error
4024
+
4025
+	return solution, err
4026
+}

+ 2 - 2
service/secondary_service.go Parādīt failu

@@ -1152,13 +1152,13 @@ func DeleteSecondOrderInfo(id int64) error {
1152 1152
 
1153 1153
 func GetStockFlowOrderList(good_id int64, user_org_id int64) (list []*models.VmStockFlow, err error) {
1154 1154
 
1155
-	err = XTReadDB().Where("good_id = ? and user_org_id =? and ctime>=1706630400 and ctime<=1709222399 and status=1", good_id, user_org_id).Order("ctime asc").Find(&list).Error
1155
+	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1", good_id, user_org_id).Order("ctime asc").Find(&list).Error
1156 1156
 	return list, err
1157 1157
 }
1158 1158
 
1159 1159
 func UpdateOverCount(id int64, count int64) (err error) {
1160 1160
 
1161
-	err = XTWriteDB().Model(models.VmStockFlow{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"over_count": count}).Error
1161
+	err = XTWriteDB().Model(models.VmStockFlow{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"flush_over_count": count}).Error
1162 1162
 	return err
1163 1163
 }
1164 1164
 

+ 18 - 10
service/stock_service.go Parādīt failu

@@ -2002,10 +2002,13 @@ func GetLastDrugCancelStockById(orgid int64) (models.DrugCancelStock, error) {
2002 2002
 func GetNewLastDrugCancelStockById(orgid int64, tx *gorm.DB) (models.DrugCancelStock, error) {
2003 2003
 	stock := models.DrugCancelStock{}
2004 2004
 	err := tx.Where("org_id = ? and status = 1", orgid).Last(&stock).Error
2005
-	if err != nil {
2006
-		tx.Rollback()
2007
-		return stock, err
2005
+	if err != gorm.ErrRecordNotFound {
2006
+		if err != nil {
2007
+			tx.Rollback()
2008
+			return stock, err
2009
+		}
2008 2010
 	}
2011
+
2009 2012
 	return stock, err
2010 2013
 }
2011 2014
 
@@ -5802,10 +5805,13 @@ func GetHisAdviceListByDrugIdTwo(patient_id int64, advice_date int64, orgid int6
5802 5805
 func GetNewHisAdviceListByDrugIdTwo(patient_id int64, advice_date int64, orgid int64, tx *gorm.DB) (info []*models.HisDoctorAdviceInfo, err error) {
5803 5806
 
5804 5807
 	err = tx.Where("patient_id = ? and advice_date = ? and status = 1 and user_org_id = ?", patient_id, advice_date, orgid).Find(&info).Error
5805
-	if err != nil {
5806
-		tx.Rollback()
5807
-		return info, err
5808
+	if err != gorm.ErrRecordNotFound {
5809
+		if err != nil {
5810
+			tx.Rollback()
5811
+			return info, err
5812
+		}
5808 5813
 	}
5814
+
5809 5815
 	return info, err
5810 5816
 }
5811 5817
 
@@ -5845,11 +5851,13 @@ func GetLastDrugWarehouseOutByDrugIdTwenty(drugid int64, patient_id int64, advic
5845 5851
 func GetLastNewDrugWarehouseOutByDrugIdTwenty(drugid int64, patient_id int64, advice_date int64, advice_id int64, tx *gorm.DB) (out []*models.DrugWarehouseOutInfo, err error) {
5846 5852
 
5847 5853
 	err = tx.Where("advice_id = ?  and drug_id = ? and patient_id = ? and sys_record_time = ? and status = 1 and is_check = 1", advice_id, drugid, patient_id, advice_date).Find(&out).Error
5848
-
5849
-	if err != nil {
5850
-		tx.Rollback()
5851
-		return out, err
5854
+	if err != gorm.ErrRecordNotFound {
5855
+		if err != nil {
5856
+			tx.Rollback()
5857
+			return out, err
5858
+		}
5852 5859
 	}
5860
+
5853 5861
 	return out, err
5854 5862
 }
5855 5863