|
@@ -30,6 +30,14 @@ func DoctorApiRegistRouters() {
|
30
|
30
|
beego.Router("/api/schedule/getdoctoradvicecount", &DoctorsApiController{}, "Get:GetDoctorAdviceCount")
|
31
|
31
|
beego.Router("/api/patient/savevasularaccess", &DoctorsApiController{}, "Get:SaveVasularAccess")
|
32
|
32
|
beego.Router("/api/patient/getallvascualraccesslist", &DoctorsApiController{}, "Get:GetAllVacualAccessList")
|
|
33
|
+ beego.Router("/api/patient/getvascularaccessbydetial", &DoctorsApiController{}, "Get:GetVascularAccessByDetail")
|
|
34
|
+ beego.Router("/api/patient/updatevasularaccess", &DoctorsApiController{}, "Get:UpdateVasularAccess")
|
|
35
|
+ beego.Router("/api/patient/deletevascularaccess", &DoctorsApiController{}, "Get:DeleteVasularAccess")
|
|
36
|
+ beego.Router("/api/patient/savepasswayassessment", &DoctorsApiController{}, "Get:SavePassWayAssessment")
|
|
37
|
+ beego.Router("/api/patient/getallpasswayassessment", &DoctorsApiController{}, "Get:GetAllPassWayAssessment")
|
|
38
|
+ beego.Router("/api/patient/getpasswayassmentbyid", &DoctorsApiController{}, "Get:GetPasswayAssesmentById")
|
|
39
|
+ beego.Router("/api/patient/updatepasswayassesment", &DoctorsApiController{}, "Get:UpdatePassWayAssesment")
|
|
40
|
+ beego.Router("/api/patient/deletepasswayassessment", &DoctorsApiController{}, "Get:DeleteWayAssessment")
|
33
|
41
|
}
|
34
|
42
|
|
35
|
43
|
func (c *DoctorsApiController) ScheduleAdvices() {
|
|
@@ -329,9 +337,105 @@ func (this *DoctorsApiController) SaveVasularAccess() {
|
329
|
337
|
startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
330
|
338
|
stop_reason := this.GetString("stop_reason")
|
331
|
339
|
user_status, _ := this.GetInt64("user_status")
|
|
340
|
+ stop_time := this.GetString("stop_time")
|
|
341
|
+ stopTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", stop_time+" 00:00:00", loc)
|
|
342
|
+ patient_id, _ := this.GetInt64("patient_id")
|
332
|
343
|
adminUserInfo := this.GetAdminUserInfo()
|
333
|
344
|
orgId := adminUserInfo.CurrentOrgId
|
334
|
345
|
creator := adminUserInfo.AdminUser.Id
|
|
346
|
+
|
|
347
|
+ //查询改日期是否存在
|
|
348
|
+ _, errcode := service.GetDialysisDateByDate(startTime.Unix(), patient_id, orgId)
|
|
349
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
350
|
+ access := models.XtPatientVascularAccess{
|
|
351
|
+ AccessProject: access_project,
|
|
352
|
+ BloodAccessPartId: blood_access_part_id,
|
|
353
|
+ BloodAccessPartOperaId: blood_access_part_opera_id,
|
|
354
|
+ FirstStartTime: firstStartTime.Unix(),
|
|
355
|
+ InflowPass: inflow_pass,
|
|
356
|
+ Remark: remark,
|
|
357
|
+ StartTime: startTime.Unix(),
|
|
358
|
+ StopReason: stop_reason,
|
|
359
|
+ UserStatus: user_status,
|
|
360
|
+ Creator: creator,
|
|
361
|
+ UserOrgId: orgId,
|
|
362
|
+ Status: 1,
|
|
363
|
+ Ctime: time.Now().Unix(),
|
|
364
|
+ StopTime: stopTime.Unix(),
|
|
365
|
+ PatientId: patient_id,
|
|
366
|
+ }
|
|
367
|
+ err := service.SaveVascularAccess(&access)
|
|
368
|
+ if err == nil {
|
|
369
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
370
|
+ "access": access,
|
|
371
|
+ })
|
|
372
|
+ return
|
|
373
|
+ }
|
|
374
|
+ } else if errcode == nil {
|
|
375
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
|
|
376
|
+ return
|
|
377
|
+ }
|
|
378
|
+
|
|
379
|
+}
|
|
380
|
+
|
|
381
|
+func (this *DoctorsApiController) GetAllVacualAccessList() {
|
|
382
|
+
|
|
383
|
+ limit, _ := this.GetInt64("limit")
|
|
384
|
+ page, _ := this.GetInt64("page")
|
|
385
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
386
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
387
|
+ appId := this.GetAdminUserInfo().CurrentAppId
|
|
388
|
+ list, total, err := service.GetAllVacualAccessList(orgId, limit, page, patient_id)
|
|
389
|
+ doctor, err := service.GetAllDoctor(orgId, appId)
|
|
390
|
+ if err == nil {
|
|
391
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
392
|
+ "list": list,
|
|
393
|
+ "total": total,
|
|
394
|
+ "doctor": doctor,
|
|
395
|
+ })
|
|
396
|
+ return
|
|
397
|
+ }
|
|
398
|
+}
|
|
399
|
+
|
|
400
|
+func (this *DoctorsApiController) GetVascularAccessByDetail() {
|
|
401
|
+
|
|
402
|
+ id, _ := this.GetInt64("id")
|
|
403
|
+
|
|
404
|
+ accessDetail, err := service.GetVasularAccessByDetail(id)
|
|
405
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
406
|
+ appId := this.GetAdminUserInfo().CurrentAppId
|
|
407
|
+ doctor, err := service.GetAllDoctor(orgId, appId)
|
|
408
|
+ if err == nil {
|
|
409
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
410
|
+ "accessDetail": accessDetail,
|
|
411
|
+ "doctor": doctor,
|
|
412
|
+ })
|
|
413
|
+ return
|
|
414
|
+ }
|
|
415
|
+}
|
|
416
|
+
|
|
417
|
+func (this *DoctorsApiController) UpdateVasularAccess() {
|
|
418
|
+ id, _ := this.GetInt64("id")
|
|
419
|
+ access_project, _ := this.GetInt64("access_project")
|
|
420
|
+ blood_access_part_id := this.GetString("blood_access_part_id")
|
|
421
|
+ blood_access_part_opera_id := this.GetString("blood_access_part_opera_id")
|
|
422
|
+ first_start_time := this.GetString("first_start_time")
|
|
423
|
+ timeLayout := "2006-01-02"
|
|
424
|
+ loc, _ := time.LoadLocation("Local")
|
|
425
|
+ firstStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", first_start_time+" 00:00:00", loc)
|
|
426
|
+ inflow_pass := this.GetString("inflow_pass")
|
|
427
|
+ remark := this.GetString("remark")
|
|
428
|
+ start_time := this.GetString("start_time")
|
|
429
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
430
|
+ stop_reason := this.GetString("stop_reason")
|
|
431
|
+ user_status, _ := this.GetInt64("user_status")
|
|
432
|
+ stop_time := this.GetString("stop_time")
|
|
433
|
+ stopTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", stop_time+" 00:00:00", loc)
|
|
434
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
435
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
436
|
+ creator := adminUserInfo.AdminUser.Id
|
|
437
|
+ patientId, _ := this.GetInt64("patient_id")
|
|
438
|
+ fmt.Println("patient_id222222222222222222", patientId)
|
335
|
439
|
access := models.XtPatientVascularAccess{
|
336
|
440
|
AccessProject: access_project,
|
337
|
441
|
BloodAccessPartId: blood_access_part_id,
|
|
@@ -342,26 +446,82 @@ func (this *DoctorsApiController) SaveVasularAccess() {
|
342
|
446
|
StartTime: startTime.Unix(),
|
343
|
447
|
StopReason: stop_reason,
|
344
|
448
|
UserStatus: user_status,
|
345
|
|
- Creator: creator,
|
|
449
|
+ Modify: creator,
|
346
|
450
|
UserOrgId: orgId,
|
347
|
451
|
Status: 1,
|
348
|
|
- Ctime: time.Now().Unix(),
|
|
452
|
+ StopTime: stopTime.Unix(),
|
|
453
|
+ }
|
|
454
|
+ _, errcode := service.GetDialysisDateByDateOne(startTime.Unix(), patientId, orgId, id)
|
|
455
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
456
|
+ err := service.UpdateVascularAccess(&access, id)
|
|
457
|
+ if err == nil {
|
|
458
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
459
|
+ "access": access,
|
|
460
|
+ })
|
|
461
|
+ return
|
|
462
|
+ }
|
|
463
|
+ } else if errcode == nil {
|
|
464
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
|
|
465
|
+ return
|
349
|
466
|
}
|
350
|
|
- err := service.SaveVascularAccess(&access)
|
|
467
|
+
|
|
468
|
+}
|
|
469
|
+
|
|
470
|
+func (this *DoctorsApiController) DeleteVasularAccess() {
|
|
471
|
+ id, _ := this.GetInt64("id")
|
|
472
|
+ err := service.DeleteVasularAccess(id)
|
|
473
|
+ fmt.Println(err)
|
|
474
|
+ returnData := make(map[string]interface{}, 0)
|
|
475
|
+ returnData["msg"] = "ok"
|
|
476
|
+ this.ServeSuccessJSON(returnData)
|
|
477
|
+ return
|
|
478
|
+}
|
|
479
|
+
|
|
480
|
+func (this *DoctorsApiController) SavePassWayAssessment() {
|
|
481
|
+
|
|
482
|
+ blood_dealwidth := this.GetString("blood_dealwith")
|
|
483
|
+ blood_project := this.GetString("blood_project")
|
|
484
|
+ blood_result := this.GetString("blood_result")
|
|
485
|
+ creator, _ := this.GetInt64("creator")
|
|
486
|
+ parent_id, _ := this.GetInt64("parent_id")
|
|
487
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
488
|
+ start_time := this.GetString("start_time")
|
|
489
|
+ timeLayout := "2006-01-02"
|
|
490
|
+ loc, _ := time.LoadLocation("Local")
|
|
491
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
492
|
+ modify := this.GetAdminUserInfo().AdminUser.Id
|
|
493
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
494
|
+ assessment := models.XtPatientPasswayAssessment{
|
|
495
|
+ StartTime: startTime.Unix(),
|
|
496
|
+ BloodDealwith: blood_dealwidth,
|
|
497
|
+ BloodProject: blood_project,
|
|
498
|
+ BloodResult: blood_result,
|
|
499
|
+ Creator: creator,
|
|
500
|
+ PatientId: patient_id,
|
|
501
|
+ ParentId: parent_id,
|
|
502
|
+ Modify: modify,
|
|
503
|
+ UserOrgId: orgId,
|
|
504
|
+ Status: 1,
|
|
505
|
+ Ctime: time.Now().Unix(),
|
|
506
|
+ }
|
|
507
|
+
|
|
508
|
+ err := service.CreatePatientWayAssessment(&assessment)
|
351
|
509
|
if err == nil {
|
352
|
510
|
this.ServeSuccessJSON(map[string]interface{}{
|
353
|
|
- "access": access,
|
|
511
|
+ "assessment": assessment,
|
354
|
512
|
})
|
355
|
513
|
return
|
356
|
514
|
}
|
357
|
515
|
}
|
358
|
516
|
|
359
|
|
-func (this *DoctorsApiController) GetAllVacualAccessList() {
|
|
517
|
+func (this *DoctorsApiController) GetAllPassWayAssessment() {
|
360
|
518
|
|
361
|
|
- limit, _ := this.GetInt64("limit")
|
|
519
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
520
|
+ parent_id, _ := this.GetInt64("parent_id")
|
362
|
521
|
page, _ := this.GetInt64("page")
|
363
|
|
- orgId := this.GetAdminUserInfo().CurrentOrgId
|
364
|
|
- list, total, err := service.GetAllVacualAccessList(orgId, limit, page)
|
|
522
|
+ limit, _ := this.GetInt64("limit")
|
|
523
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
524
|
+ list, total, err := service.GetAllPassWayAssessment(parent_id, patient_id, page, limit, adminUserInfo.CurrentOrgId)
|
365
|
525
|
if err == nil {
|
366
|
526
|
this.ServeSuccessJSON(map[string]interface{}{
|
367
|
527
|
"list": list,
|
|
@@ -370,3 +530,54 @@ func (this *DoctorsApiController) GetAllVacualAccessList() {
|
370
|
530
|
return
|
371
|
531
|
}
|
372
|
532
|
}
|
|
533
|
+
|
|
534
|
+func (this *DoctorsApiController) GetPasswayAssesmentById() {
|
|
535
|
+
|
|
536
|
+ id, _ := this.GetInt64("id")
|
|
537
|
+ assessment, err := service.GetPasswayAssesmentById(id)
|
|
538
|
+ if err == nil {
|
|
539
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
540
|
+ "assessment": assessment,
|
|
541
|
+ })
|
|
542
|
+ return
|
|
543
|
+ }
|
|
544
|
+}
|
|
545
|
+
|
|
546
|
+func (this *DoctorsApiController) UpdatePassWayAssesment() {
|
|
547
|
+ id, _ := this.GetInt64("id")
|
|
548
|
+ blood_dealwidth := this.GetString("blood_dealwith")
|
|
549
|
+ blood_project := this.GetString("blood_project")
|
|
550
|
+ blood_result := this.GetString("blood_result")
|
|
551
|
+ creator, _ := this.GetInt64("creator")
|
|
552
|
+ start_time := this.GetString("start_time")
|
|
553
|
+ timeLayout := "2006-01-02"
|
|
554
|
+ loc, _ := time.LoadLocation("Local")
|
|
555
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
556
|
+ modify := this.GetAdminUserInfo().AdminUser.Id
|
|
557
|
+ assessment := models.XtPatientPasswayAssessment{
|
|
558
|
+ BloodResult: blood_result,
|
|
559
|
+ BloodDealwith: blood_dealwidth,
|
|
560
|
+ BloodProject: blood_project,
|
|
561
|
+ Creator: creator,
|
|
562
|
+ StartTime: startTime.Unix(),
|
|
563
|
+ Modify: modify,
|
|
564
|
+ }
|
|
565
|
+ err := service.UpdatePassWayAssesment(&assessment, id)
|
|
566
|
+ if err == nil {
|
|
567
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
568
|
+ "assessment": assessment,
|
|
569
|
+ })
|
|
570
|
+ return
|
|
571
|
+ }
|
|
572
|
+}
|
|
573
|
+
|
|
574
|
+func (this *DoctorsApiController) DeleteWayAssessment() {
|
|
575
|
+
|
|
576
|
+ id, _ := this.GetInt64("id")
|
|
577
|
+ err := service.DeleteWayAssessment(id)
|
|
578
|
+ fmt.Println(err)
|
|
579
|
+ returnData := make(map[string]interface{}, 0)
|
|
580
|
+ returnData["msg"] = "ok"
|
|
581
|
+ this.ServeSuccessJSON(returnData)
|
|
582
|
+ return
|
|
583
|
+}
|