Ver código fonte

合并代码

csx 4 anos atrás
pai
commit
30d3e5ac1f
1 arquivos alterados com 28 adições e 11 exclusões
  1. 28 11
      controllers/patient_api_controller.go

+ 28 - 11
controllers/patient_api_controller.go Ver arquivo

3383
 
3383
 
3384
 func (c *PatientApiController) ExportPatients() {
3384
 func (c *PatientApiController) ExportPatients() {
3385
 	dataBody := make(map[string]interface{}, 0)
3385
 	dataBody := make(map[string]interface{}, 0)
3386
+	dialysisNo := service.ChechLastDialysisNo(c.GetAdminUserInfo().CurrentOrgId)
3387
+	if dialysisNo == 0 {
3388
+		dialysisNo = 1
3389
+	} else {
3390
+		dialysisNo++
3391
+	}
3392
+
3386
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
3393
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
3387
 	if err != nil {
3394
 	if err != nil {
3388
 		utils.ErrorLog(err.Error())
3395
 		utils.ErrorLog(err.Error())
3409
 				err_log := models.ExportErrLog{
3416
 				err_log := models.ExportErrLog{
3410
 					LogType:    1,
3417
 					LogType:    1,
3411
 					UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3418
 					UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3412
-					ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的姓名不能为空",
3419
+					ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的姓名不能为空",
3413
 					Status:     1,
3420
 					Status:     1,
3414
 					CreateTime: time.Now().Unix(),
3421
 					CreateTime: time.Now().Unix(),
3415
 					UpdateTime: time.Now().Unix(),
3422
 					UpdateTime: time.Now().Unix(),
3426
 					err_log := models.ExportErrLog{
3433
 					err_log := models.ExportErrLog{
3427
 						LogType:    1,
3434
 						LogType:    1,
3428
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3435
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3429
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的性别不符合要求",
3436
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的性别不符合要求",
3430
 						Status:     1,
3437
 						Status:     1,
3431
 						CreateTime: time.Now().Unix(),
3438
 						CreateTime: time.Now().Unix(),
3432
 						UpdateTime: time.Now().Unix(),
3439
 						UpdateTime: time.Now().Unix(),
3445
 					err_log := models.ExportErrLog{
3452
 					err_log := models.ExportErrLog{
3446
 						LogType:    1,
3453
 						LogType:    1,
3447
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3454
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3448
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的手机号码格式不符合要求",
3455
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的手机号码格式不符合要求",
3449
 						Status:     1,
3456
 						Status:     1,
3450
 						CreateTime: time.Now().Unix(),
3457
 						CreateTime: time.Now().Unix(),
3451
 						UpdateTime: time.Now().Unix(),
3458
 						UpdateTime: time.Now().Unix(),
3460
 						err_log := models.ExportErrLog{
3467
 						err_log := models.ExportErrLog{
3461
 							LogType:    1,
3468
 							LogType:    1,
3462
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3469
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3463
-							ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的手机号码在系统中已经存在",
3470
+							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的手机号码在系统中已经存在",
3464
 							Status:     1,
3471
 							Status:     1,
3465
 							CreateTime: time.Now().Unix(),
3472
 							CreateTime: time.Now().Unix(),
3466
 							UpdateTime: time.Now().Unix(),
3473
 							UpdateTime: time.Now().Unix(),
3481
 					err_log := models.ExportErrLog{
3488
 					err_log := models.ExportErrLog{
3482
 						LogType:    1,
3489
 						LogType:    1,
3483
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3490
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3484
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的身份证号码格式不符合要求",
3491
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码格式不符合要求",
3485
 						Status:     1,
3492
 						Status:     1,
3486
 						CreateTime: time.Now().Unix(),
3493
 						CreateTime: time.Now().Unix(),
3487
 						UpdateTime: time.Now().Unix(),
3494
 						UpdateTime: time.Now().Unix(),
3495
 						err_log := models.ExportErrLog{
3502
 						err_log := models.ExportErrLog{
3496
 							LogType:    1,
3503
 							LogType:    1,
3497
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3504
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3498
-							ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的身份证号码在系统中已经存在",
3505
+							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的身份证号码在系统中已经存在",
3499
 							Status:     1,
3506
 							Status:     1,
3500
 							CreateTime: time.Now().Unix(),
3507
 							CreateTime: time.Now().Unix(),
3501
 							UpdateTime: time.Now().Unix(),
3508
 							UpdateTime: time.Now().Unix(),
3519
 					err_log := models.ExportErrLog{
3526
 					err_log := models.ExportErrLog{
3520
 						LogType:    1,
3527
 						LogType:    1,
3521
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3528
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3522
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的首次肾脏治疗时间格式不符合要求",
3529
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的首次肾脏治疗时间格式不符合要求",
3523
 						Status:     1,
3530
 						Status:     1,
3524
 						CreateTime: time.Now().Unix(),
3531
 						CreateTime: time.Now().Unix(),
3525
 						UpdateTime: time.Now().Unix(),
3532
 						UpdateTime: time.Now().Unix(),
3533
 						err_log := models.ExportErrLog{
3540
 						err_log := models.ExportErrLog{
3534
 							LogType:    1,
3541
 							LogType:    1,
3535
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3542
 							UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3536
-							ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的首次肾脏治疗时间格式不符合要求",
3543
+							ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的首次肾脏治疗时间格式不符合要求",
3537
 							Status:     1,
3544
 							Status:     1,
3538
 							CreateTime: time.Now().Unix(),
3545
 							CreateTime: time.Now().Unix(),
3539
 							UpdateTime: time.Now().Unix(),
3546
 							UpdateTime: time.Now().Unix(),
3553
 					err_log := models.ExportErrLog{
3560
 					err_log := models.ExportErrLog{
3554
 						LogType:    1,
3561
 						LogType:    1,
3555
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3562
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3556
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的患者来源不符合要求",
3563
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的患者来源不符合要求",
3557
 						Status:     1,
3564
 						Status:     1,
3558
 						CreateTime: time.Now().Unix(),
3565
 						CreateTime: time.Now().Unix(),
3559
 						UpdateTime: time.Now().Unix(),
3566
 						UpdateTime: time.Now().Unix(),
3572
 					err_log := models.ExportErrLog{
3579
 					err_log := models.ExportErrLog{
3573
 						LogType:    1,
3580
 						LogType:    1,
3574
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3581
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3575
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的治疗状态不符合要求",
3582
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的治疗状态不符合要求",
3576
 						Status:     1,
3583
 						Status:     1,
3577
 						CreateTime: time.Now().Unix(),
3584
 						CreateTime: time.Now().Unix(),
3578
 						UpdateTime: time.Now().Unix(),
3585
 						UpdateTime: time.Now().Unix(),
3591
 					err_log := models.ExportErrLog{
3598
 					err_log := models.ExportErrLog{
3592
 						LogType:    1,
3599
 						LogType:    1,
3593
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3600
 						UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
3594
-						ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的传染病状态不符合要求",
3601
+						ErrMsg:     "第" + strconv.Itoa(index+3) + "行" + "的传染病状态不符合要求",
3595
 						Status:     1,
3602
 						Status:     1,
3596
 						CreateTime: time.Now().Unix(),
3603
 						CreateTime: time.Now().Unix(),
3597
 						UpdateTime: time.Now().Unix(),
3604
 						UpdateTime: time.Now().Unix(),
3626
 				patient.Diagnose = diagnose
3633
 				patient.Diagnose = diagnose
3627
 
3634
 
3628
 			}
3635
 			}
3636
+			dialysisNo = dialysisNo + int64(index)
3637
+
3638
+			no := strconv.FormatInt(dialysisNo, 10)
3639
+			rep := 3 - len(no)
3640
+
3641
+			if rep > 0 {
3642
+				no = strings.Repeat("0", rep) + no
3643
+			}
3644
+
3645
+			patient.DialysisNo = no
3629
 			patient.CreatedTime = time.Now().Unix()
3646
 			patient.CreatedTime = time.Now().Unix()
3630
 			patient.UpdatedTime = time.Now().Unix()
3647
 			patient.UpdatedTime = time.Now().Unix()
3631
 			patient.Status = 1
3648
 			patient.Status = 1