|
@@ -183,18 +183,18 @@ func (c *PatientApiController) CreateDoctorAdvice() {
|
183
|
183
|
// return
|
184
|
184
|
//}
|
185
|
185
|
|
186
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
187
|
|
-
|
188
|
|
- if appRole.UserType == 3 {
|
189
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
190
|
|
- if getPermissionErr != nil {
|
191
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
192
|
|
- return
|
193
|
|
- } else if headNursePermission == nil {
|
194
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
195
|
|
- return
|
196
|
|
- }
|
197
|
|
- }
|
|
186
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
187
|
+ //
|
|
188
|
+ //if appRole.UserType == 3 {
|
|
189
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
190
|
+ // if getPermissionErr != nil {
|
|
191
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
192
|
+ // return
|
|
193
|
+ // } else if headNursePermission == nil {
|
|
194
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
195
|
+ // return
|
|
196
|
+ // }
|
|
197
|
+ //}
|
198
|
198
|
|
199
|
199
|
var advice models.DoctorAdvice
|
200
|
200
|
code := adviceFormData(&advice, c.Ctx.Input.RequestBody, "create")
|
|
@@ -259,18 +259,18 @@ func (c *PatientApiController) EditDoctorAdvice() {
|
259
|
259
|
|
260
|
260
|
//appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
261
|
261
|
|
262
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
263
|
|
-
|
264
|
|
- if appRole.UserType == 3 {
|
265
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
266
|
|
- if getPermissionErr != nil {
|
267
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
268
|
|
- return
|
269
|
|
- } else if headNursePermission == nil {
|
270
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
271
|
|
- return
|
272
|
|
- }
|
273
|
|
- }
|
|
262
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
263
|
+ //
|
|
264
|
+ //if appRole.UserType == 3 {
|
|
265
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
266
|
+ // if getPermissionErr != nil {
|
|
267
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
268
|
+ // return
|
|
269
|
+ // } else if headNursePermission == nil {
|
|
270
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
271
|
+ // return
|
|
272
|
+ // }
|
|
273
|
+ //}
|
274
|
274
|
|
275
|
275
|
advice, _ := service.FindDoctorAdvice(adminUserInfo.Org.Id, id)
|
276
|
276
|
if advice.ID == 0 {
|
|
@@ -278,11 +278,6 @@ func (c *PatientApiController) EditDoctorAdvice() {
|
278
|
278
|
return
|
279
|
279
|
}
|
280
|
280
|
|
281
|
|
- if advice.AdviceDoctor != adminUserInfo.AdminUser.Id {
|
282
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCanotEditOtherAdvice)
|
283
|
|
- return
|
284
|
|
- }
|
285
|
|
-
|
286
|
281
|
code := adviceFormData(&advice, c.Ctx.Input.RequestBody, "update")
|
287
|
282
|
if code > 0 {
|
288
|
283
|
c.ServeFailJSONWithSGJErrorCode(code)
|
|
@@ -381,18 +376,18 @@ func (c *PatientApiController) StopDoctorAdvice() {
|
381
|
376
|
// return
|
382
|
377
|
//}
|
383
|
378
|
|
384
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
385
|
|
-
|
386
|
|
- if appRole.UserType == 3 {
|
387
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
388
|
|
- if getPermissionErr != nil {
|
389
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
390
|
|
- return
|
391
|
|
- } else if headNursePermission == nil {
|
392
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
393
|
|
- return
|
394
|
|
- }
|
395
|
|
- }
|
|
379
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
380
|
+ //
|
|
381
|
+ //if appRole.UserType == 3 {
|
|
382
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
383
|
+ // if getPermissionErr != nil {
|
|
384
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
385
|
+ // return
|
|
386
|
+ // } else if headNursePermission == nil {
|
|
387
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
388
|
+ // return
|
|
389
|
+ // }
|
|
390
|
+ //}
|
396
|
391
|
|
397
|
392
|
if advice.StopState == 1 {
|
398
|
393
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceStoped)
|
|
@@ -480,18 +475,18 @@ func (c *PatientApiController) DeleteDoctorAdvice() {
|
480
|
475
|
// return
|
481
|
476
|
//}
|
482
|
477
|
|
483
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
484
|
|
-
|
485
|
|
- if appRole.UserType == 3 {
|
486
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
487
|
|
- if getPermissionErr != nil {
|
488
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
489
|
|
- return
|
490
|
|
- } else if headNursePermission == nil {
|
491
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
492
|
|
- return
|
493
|
|
- }
|
494
|
|
- }
|
|
478
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
479
|
+ //
|
|
480
|
+ //if appRole.UserType == 3 {
|
|
481
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
482
|
+ // if getPermissionErr != nil {
|
|
483
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
484
|
+ // return
|
|
485
|
+ // } else if headNursePermission == nil {
|
|
486
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
487
|
+ // return
|
|
488
|
+ // }
|
|
489
|
+ //}
|
495
|
490
|
|
496
|
491
|
advice.UpdatedTime = time.Now().Unix()
|
497
|
492
|
advice.Status = 0
|
|
@@ -540,18 +535,18 @@ func (c *PatientApiController) ExecDoctorAdvice() {
|
540
|
535
|
|
541
|
536
|
adminUserInfo := c.GetMobileAdminUserInfo()
|
542
|
537
|
|
543
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
544
|
|
-
|
545
|
|
- if appRole.UserType == 2 || appRole.UserType == 1 {
|
546
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
547
|
|
- if getPermissionErr != nil {
|
548
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
549
|
|
- return
|
550
|
|
- } else if headNursePermission == nil {
|
551
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
552
|
|
- return
|
553
|
|
- }
|
554
|
|
- }
|
|
538
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
539
|
+ //
|
|
540
|
+ //if appRole.UserType == 2 || appRole.UserType == 1 {
|
|
541
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
542
|
+ // if getPermissionErr != nil {
|
|
543
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
544
|
+ // return
|
|
545
|
+ // } else if headNursePermission == nil {
|
|
546
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
547
|
+ // return
|
|
548
|
+ // }
|
|
549
|
+ //}
|
555
|
550
|
|
556
|
551
|
var advice models.DoctorAdvice
|
557
|
552
|
|
|
@@ -673,16 +668,16 @@ func (c *PatientApiController) ModifyExecDoctorAdvice() {
|
673
|
668
|
}
|
674
|
669
|
}
|
675
|
670
|
|
676
|
|
- if advice.ExecutionStaff != adminUserInfo.AdminUser.Id {
|
677
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
678
|
|
- if getPermissionErr != nil {
|
679
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
680
|
|
- return
|
681
|
|
- } else if headNursePermission == nil {
|
682
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
683
|
|
- return
|
684
|
|
- }
|
685
|
|
- }
|
|
671
|
+ //if advice.ExecutionStaff != adminUserInfo.AdminUser.Id {
|
|
672
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
673
|
+ // if getPermissionErr != nil {
|
|
674
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
675
|
+ // return
|
|
676
|
+ // } else if headNursePermission == nil {
|
|
677
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
678
|
+ // return
|
|
679
|
+ // }
|
|
680
|
+ //}
|
686
|
681
|
|
687
|
682
|
if advice.StartTime > theTime.Unix() {
|
688
|
683
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
|
|
@@ -732,18 +727,18 @@ func (c *PatientApiController) CheckDoctorAdvice() {
|
732
|
727
|
}
|
733
|
728
|
|
734
|
729
|
adminUserInfo := c.GetMobileAdminUserInfo()
|
735
|
|
-
|
736
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
737
|
|
- if appRole.UserType != 3 {
|
738
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
739
|
|
- if getPermissionErr != nil {
|
740
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
741
|
|
- return
|
742
|
|
- } else if headNursePermission == nil {
|
743
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
744
|
|
- return
|
745
|
|
- }
|
746
|
|
- }
|
|
730
|
+ //
|
|
731
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
732
|
+ //if appRole.UserType != 3 {
|
|
733
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
734
|
+ // if getPermissionErr != nil {
|
|
735
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
736
|
+ // return
|
|
737
|
+ // } else if headNursePermission == nil {
|
|
738
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
739
|
+ // return
|
|
740
|
+ // }
|
|
741
|
+ //}
|
747
|
742
|
|
748
|
743
|
var advice models.DoctorAdvice
|
749
|
744
|
|
|
@@ -848,27 +843,27 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
|
848
|
843
|
return
|
849
|
844
|
}
|
850
|
845
|
//templateInfo,_ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
|
851
|
|
- appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
|
846
|
+ //appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
|
852
|
847
|
var evaluation models.PredialysisEvaluation
|
853
|
848
|
if theEvaluation != nil {
|
854
|
|
- if appRole.UserType == 2 || appRole.UserType == 1 {
|
855
|
|
-
|
856
|
|
- evaluation = *theEvaluation
|
857
|
|
-
|
858
|
|
- } else {
|
859
|
|
- if theEvaluation.Creater != adminUserInfo.AdminUser.Id && theEvaluation.Creater != 0 {
|
860
|
|
- headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
861
|
|
- if getPermissionErr != nil {
|
862
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
863
|
|
- return
|
864
|
|
- } else if headNursePermission == nil {
|
865
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
866
|
|
- return
|
867
|
|
- }
|
868
|
|
- } else {
|
869
|
|
- evaluation = *theEvaluation
|
870
|
|
- }
|
871
|
|
- }
|
|
849
|
+ //if appRole.UserType == 2 || appRole.UserType == 1 {
|
|
850
|
+
|
|
851
|
+ evaluation = *theEvaluation
|
|
852
|
+
|
|
853
|
+ //} else {
|
|
854
|
+ // if theEvaluation.Creater != adminUserInfo.AdminUser.Id && theEvaluation.Creater != 0 {
|
|
855
|
+ // headNursePermission, getPermissionErr := service.GetAdminUserSpecialPermission(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id, models.SpecialPermissionTypeHeadNurse)
|
|
856
|
+ // if getPermissionErr != nil {
|
|
857
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
858
|
+ // return
|
|
859
|
+ // } else if headNursePermission == nil {
|
|
860
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
861
|
+ // return
|
|
862
|
+ // }
|
|
863
|
+ // } else {
|
|
864
|
+ // evaluation = *theEvaluation
|
|
865
|
+ // }
|
|
866
|
+ //}
|
872
|
867
|
}
|
873
|
868
|
|
874
|
869
|
code := predialysisEvaluationFormData(&evaluation, c.Ctx.Input.RequestBody)
|
|
@@ -884,24 +879,24 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
|
884
|
879
|
evaluation.AssessmentDate = theAssessmentDateTime
|
885
|
880
|
evaluation.PatientId = id
|
886
|
881
|
evaluation.UserOrgId = adminUserInfo.Org.Id
|
887
|
|
- if appRole.UserType == 2 || appRole.UserType == 1 {
|
888
|
|
- evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
|
889
|
|
- evaluation.AssessmentTime = time.Now().Unix()
|
890
|
|
- } else {
|
891
|
|
- evaluation.Creater = adminUserInfo.AdminUser.Id
|
892
|
|
- }
|
|
882
|
+ //if appRole.UserType == 2 || appRole.UserType == 1 {
|
|
883
|
+ // evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
|
|
884
|
+ // evaluation.AssessmentTime = time.Now().Unix()
|
|
885
|
+ //} else {
|
|
886
|
+ evaluation.Creater = adminUserInfo.AdminUser.Id
|
|
887
|
+ //}
|
893
|
888
|
} else {
|
894
|
889
|
evaluation.UpdatedTime = time.Now().Unix()
|
895
|
890
|
evaluation.Evaluator = adminUserInfo.AdminUser.Id
|
896
|
|
- if appRole.UserType == 2 || appRole.UserType == 1 {
|
897
|
|
- evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
|
898
|
|
- evaluation.AssessmentTime = time.Now().Unix()
|
899
|
|
- } else {
|
900
|
|
- evaluation.Modifier = adminUserInfo.AdminUser.Id
|
901
|
|
- if evaluation.Creater == 0 {
|
902
|
|
- evaluation.Creater = adminUserInfo.AdminUser.Id
|
903
|
|
- }
|
|
891
|
+ //if appRole.UserType == 2 || appRole.UserType == 1 {
|
|
892
|
+ // evaluation.AssessmentDoctor = adminUserInfo.AdminUser.Id
|
|
893
|
+ // evaluation.AssessmentTime = time.Now().Unix()
|
|
894
|
+ //} else {
|
|
895
|
+ evaluation.Modifier = adminUserInfo.AdminUser.Id
|
|
896
|
+ if evaluation.Creater == 0 {
|
|
897
|
+ evaluation.Creater = adminUserInfo.AdminUser.Id
|
904
|
898
|
}
|
|
899
|
+ //}
|
905
|
900
|
}
|
906
|
901
|
|
907
|
902
|
//新增逻辑
|
|
@@ -2439,27 +2434,13 @@ func (c *PatientApiController) setAdviceWithJSON(advice *models.GroupAdvice, jso
|
2439
|
2434
|
|
2440
|
2435
|
func (c *PatientApiController) DelDoctorAdvice() {
|
2441
|
2436
|
groupno, _ := c.GetInt64("groupno", -1)
|
|
2437
|
+ is_sub, _ := c.GetInt64("is_sub", -1) //是否子药
|
2442
|
2438
|
|
2443
|
|
- var ids []string
|
2444
|
|
- if groupno == 0 {
|
2445
|
|
- advice_id := c.GetString("advice_id")
|
2446
|
|
- ids = strings.Split(advice_id, ",")
|
2447
|
|
- if len(ids) <= 0 {
|
2448
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2449
|
|
- return
|
2450
|
|
- }
|
2451
|
|
- }
|
2452
|
|
- if groupno < 0 {
|
2453
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2454
|
|
- return
|
2455
|
|
- }
|
2456
|
|
-
|
2457
|
|
- adminUserInfo := c.GetMobileAdminUserInfo()
|
|
2439
|
+ if is_sub == 1 { //是
|
2458
|
2440
|
|
2459
|
|
- var advice models.DoctorAdvice
|
2460
|
|
-
|
2461
|
|
- if groupno > 0 {
|
2462
|
|
- advice, _ = service.FindDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
|
2441
|
+ advice_id, _ := c.GetInt64("advice_id")
|
|
2442
|
+ adminUserInfo := c.GetMobileAdminUserInfo()
|
|
2443
|
+ advice, _ := service.FindOldDoctorAdvice(adminUserInfo.Org.Id, advice_id)
|
2463
|
2444
|
if advice.ID == 0 {
|
2464
|
2445
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
|
2465
|
2446
|
return
|
|
@@ -2468,40 +2449,80 @@ func (c *PatientApiController) DelDoctorAdvice() {
|
2468
|
2449
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
2469
|
2450
|
return
|
2470
|
2451
|
}
|
2471
|
|
- } else {
|
2472
|
|
- advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
2473
|
|
- for _, item := range advices {
|
2474
|
|
- if item.ID == 0 {
|
2475
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
|
|
2452
|
+
|
|
2453
|
+ advice.Status = 0
|
|
2454
|
+ advice.UpdatedTime = time.Now().Unix()
|
|
2455
|
+ advice.Modifier = adminUserInfo.AdminUser.Id
|
|
2456
|
+
|
|
2457
|
+ err := service.DeleteDoctorAdvice(&advice)
|
|
2458
|
+ if err != nil {
|
|
2459
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteAdviceFail)
|
|
2460
|
+ return
|
|
2461
|
+ }
|
|
2462
|
+
|
|
2463
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2464
|
+ "msg": "ok",
|
|
2465
|
+ })
|
|
2466
|
+
|
|
2467
|
+ return
|
|
2468
|
+
|
|
2469
|
+ } else { //
|
|
2470
|
+
|
|
2471
|
+ var ids []string
|
|
2472
|
+ if groupno == 0 {
|
|
2473
|
+ advice_id := c.GetString("advice_id")
|
|
2474
|
+ ids = strings.Split(advice_id, ",")
|
|
2475
|
+ if len(ids) <= 0 {
|
|
2476
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
2476
|
2477
|
return
|
2477
|
2478
|
}
|
2478
|
|
- if !adminUserInfo.AdminUser.IsSuperAdmin && item.AdviceDoctor != adminUserInfo.AdminUser.Id {
|
2479
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisPermissionDeniedModify)
|
|
2479
|
+ }
|
|
2480
|
+ if groupno < 0 {
|
|
2481
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
2482
|
+ return
|
|
2483
|
+ }
|
|
2484
|
+
|
|
2485
|
+ adminUserInfo := c.GetMobileAdminUserInfo()
|
|
2486
|
+ var advice models.DoctorAdvice
|
|
2487
|
+ if groupno > 0 {
|
|
2488
|
+ advice, _ = service.FindDoctorAdviceByGoroupNo(adminUserInfo.Org.Id, groupno)
|
|
2489
|
+ if advice.ID == 0 {
|
|
2490
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
|
2480
|
2491
|
return
|
2481
|
2492
|
}
|
|
2493
|
+ } else {
|
|
2494
|
+ advices, _ := service.FindDoctorAdviceByIds(adminUserInfo.Org.Id, ids)
|
|
2495
|
+ for _, item := range advices {
|
|
2496
|
+ if item.ID == 0 {
|
|
2497
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDoctorAdviceNotExist)
|
|
2498
|
+ return
|
|
2499
|
+ }
|
|
2500
|
+ }
|
2482
|
2501
|
}
|
2483
|
|
- }
|
2484
|
2502
|
|
2485
|
|
- advice.UpdatedTime = time.Now().Unix()
|
2486
|
|
- advice.Status = 0
|
2487
|
|
- advice.GroupNo = groupno
|
|
2503
|
+ advice.UpdatedTime = time.Now().Unix()
|
|
2504
|
+ advice.Status = 0
|
|
2505
|
+ advice.GroupNo = groupno
|
2488
|
2506
|
|
2489
|
|
- var err error
|
2490
|
|
- if groupno > 0 {
|
2491
|
|
- err = service.DeleteDoctorAdviceByGroupNo(&advice)
|
2492
|
|
- } else {
|
2493
|
|
- err = service.BatchDeleteDoctorAdvice(ids)
|
2494
|
|
- }
|
|
2507
|
+ var err error
|
|
2508
|
+ if groupno > 0 {
|
|
2509
|
+ err = service.DeleteDoctorAdviceByGroupNo(&advice)
|
|
2510
|
+ } else {
|
|
2511
|
+ err = service.BatchDeleteDoctorAdvice(ids)
|
|
2512
|
+ }
|
2495
|
2513
|
|
2496
|
|
- if err != nil {
|
2497
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteAdviceFail)
|
|
2514
|
+ if err != nil {
|
|
2515
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeleteAdviceFail)
|
|
2516
|
+ return
|
|
2517
|
+ }
|
|
2518
|
+
|
|
2519
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
2520
|
+ "msg": "ok",
|
|
2521
|
+ })
|
2498
|
2522
|
return
|
|
2523
|
+
|
2499
|
2524
|
}
|
2500
|
2525
|
|
2501
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
2502
|
|
- "msg": "ok",
|
2503
|
|
- })
|
2504
|
|
- return
|
2505
|
2526
|
}
|
2506
|
2527
|
|
2507
|
2528
|
// /m/api/advice/group/modify_starttime [post]
|