Browse Source

合并代码

csx 4 years ago
parent
commit
30d3e5ac1f
1 changed files with 28 additions and 11 deletions
  1. 28 11
      controllers/patient_api_controller.go

+ 28 - 11
controllers/patient_api_controller.go View File

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