XMLWAN пре 4 година
родитељ
комит
625e64bf7d
1 измењених фајлова са 12 додато и 0 уклоњено
  1. 12 0
      controllers/his_project_api_controller.go

+ 12 - 0
controllers/his_project_api_controller.go Прегледај датотеку

@@ -732,6 +732,7 @@ func (this *HisProjectApiController) SaveHisPatient() {
732 732
 	recordDateStr := time.Now().Format("2006-01-02")
733 733
 	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
734 734
 	nowtime := recordDate.Unix()
735
+	fmt.Println("nowtime0000000000", nowtime)
735 736
 	phone := this.GetString("phone")
736 737
 	social_type, _ := this.GetInt64("social_type")
737 738
 	bloodPatient, errcode := service.GetBloodPatientByIdCard(idcard, orgId)
@@ -805,8 +806,19 @@ func (this *HisProjectApiController) SaveHisPatient() {
805 806
 			Ctime:                  time.Now().Unix(),
806 807
 			Phone:                  phone,
807 808
 			SocialType:             social_type,
809
+			RecordDate:             nowtime,
808 810
 		}
809 811
 		err := service.CreateHisPatient(&patient)
812
+		lastPatient, err := service.GetLastPatient(orgId)
813
+		timeStr := time.Now().Format("2006-01-02")
814
+		timeArr := strings.Split(timeStr, "-")
815
+		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(lastPatient.ID, 10)
816
+
817
+		hisPatient := models.HisPatient{
818
+			Number: str,
819
+		}
820
+		err = service.UpdateHisPatient(lastPatient.ID, hisPatient)
821
+		fmt.Println("errr", err)
810 822
 		if err != nil {
811 823
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
812 824
 			return