|
@@ -961,14 +961,8 @@ func FindFirstMonitorRecordToday(patient_id int64, org_id int64, monitoring_date
|
961
|
961
|
}
|
962
|
962
|
|
963
|
963
|
func ExceDoctorAdviceByGroupNo(m *models.DoctorAdvice, groupNo int64, org_id int64) (err error) {
|
964
|
|
- ut := writeDb.Begin()
|
965
|
|
- err = ut.Model(&models.DoctorAdvice{}).Where("groupno = ? AND user_org_id = ? AND status = 1 AND execution_state = 2", groupNo, org_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
966
|
|
- if err != nil {
|
967
|
|
- ut.Rollback()
|
968
|
|
- return
|
969
|
|
- }
|
970
|
|
- ut.Commit()
|
971
|
964
|
|
|
965
|
+ err = writeDb.Model(&models.DoctorAdvice{}).Where("groupno = ? AND user_org_id = ? AND status = 1 AND execution_state = 2", groupNo, org_id).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
972
|
966
|
return err
|
973
|
967
|
}
|
974
|
968
|
|
|
@@ -1125,36 +1119,18 @@ func FindAdminRoleTypeById(orgId int64, adminUserId int64, appId int64) (models.
|
1125
|
1119
|
|
1126
|
1120
|
func BatchExceOldDoctorAdvice(m *models.DoctorAdvice, ids []string) (err error) {
|
1127
|
1121
|
|
1128
|
|
- ut := writeDb.Begin()
|
1129
|
|
- err = ut.Model(&models.DoctorAdvice{}).Where("status = 1 AND id IN (?) AND execution_state = 2", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
1130
|
|
- if err != nil {
|
1131
|
|
- ut.Rollback()
|
1132
|
|
- return
|
1133
|
|
- }
|
1134
|
|
- err = ut.Model(&models.DoctorAdvice{}).Where("status = 1 AND parent_id IN (?) AND execution_state = 2 ", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
1135
|
|
- if err != nil {
|
1136
|
|
- ut.Rollback()
|
1137
|
|
- return
|
1138
|
|
- }
|
1139
|
|
- ut.Commit()
|
|
1122
|
+ err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1 AND id IN (?) AND execution_state = 2", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
|
1123
|
+
|
|
1124
|
+ err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1 AND parent_id IN (?) AND execution_state = 2 ", ids).Updates(map[string]interface{}{"execution_time": m.ExecutionTime, "execution_staff": m.ExecutionStaff, "execution_state": 1}).Error
|
|
1125
|
+
|
1140
|
1126
|
return err
|
1141
|
1127
|
}
|
1142
|
1128
|
|
1143
|
1129
|
func BatchCheckOldDoctorAdvice(m *models.DoctorAdvice, ids []string, org_id int64, date int64) (err error) {
|
1144
|
1130
|
|
1145
|
|
- ut := writeDb.Begin()
|
1146
|
1131
|
err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1 AND id IN (?) AND user_org_id = ? AND advice_date = ?", ids, org_id, date).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
|
1147
|
|
- if err != nil {
|
1148
|
|
- ut.Rollback()
|
1149
|
|
- return
|
1150
|
|
- }
|
1151
|
1132
|
|
1152
|
1133
|
err = writeDb.Model(&models.DoctorAdvice{}).Where("status = 1 AND parent_id IN (?) AND user_org_id = ? AND advice_date = ?", ids, org_id, date).Updates(map[string]interface{}{"check_time": m.CheckTime, "checker": m.Checker, "check_state": 1}).Error
|
1153
|
|
- if err != nil {
|
1154
|
|
- ut.Rollback()
|
1155
|
|
- return
|
1156
|
|
- }
|
1157
|
|
- ut.Commit()
|
1158
|
1134
|
return err
|
1159
|
1135
|
}
|
1160
|
1136
|
|