소스 검색

搜索接口更新

XMLWAN 4 년 전
부모
커밋
19be2ad6b1

+ 1 - 1
conf/app.conf 파일 보기

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 

+ 14 - 0
controllers/new_mobile_api_controllers/mobile_regist_controller.go 파일 보기

@@ -513,6 +513,20 @@ func InitPatientAndSchedule(org *models.Org) {
513 513
 		ids = append(ids, item.ID)
514 514
 	}
515 515
 
516
+	//创建两个血透的虚拟病人到新表
517
+	fmt.Print("patients", patients)
518
+	for _, it := range patients {
519
+		patientsNew := models.XtPatientsNew{
520
+			UserOrgId:     org.Id,
521
+			CreatedTime:   time.Now().Unix(),
522
+			UpdatedTime:   time.Now().Unix(),
523
+			Status:        1,
524
+			BloodId:       it.ID,
525
+			BloodPatients: 1,
526
+		}
527
+		service.CreateVMOrgNewPatient(&patientsNew)
528
+		ids = append(ids, it.ID)
529
+	}
516 530
 	//创建1个分组
517 531
 	vmGroup := &models.VMDeviceGroup{
518 532
 		OrgId:  org.Id,

+ 168 - 6
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go 파일 보기

@@ -92,7 +92,7 @@ func (this *NewDialysisApiController) GetBloodPatientInfo() {
92 92
 	fmt.Print("机构ID", orgId)
93 93
 	phone := this.GetString("phone")
94 94
 	_, errcode := service.GetBloodPatientInfo(orgId, phone)
95
-	fmt.Print("errcode-----------------", errcode)
95
+	fmt.Print("errcode", errcode)
96 96
 	if errcode == gorm.ErrRecordNotFound {
97 97
 		returnData := make(map[string]interface{}, 0)
98 98
 		returnData["msg"] = "ok"
@@ -112,7 +112,7 @@ func (this *NewDialysisApiController) GetSlowPatientInfo() {
112 112
 	phone := this.GetString("phone")
113 113
 	fmt.Print("phone", phone)
114 114
 	_, errcode := service.GetSlowPatientInfo(orgId, phone)
115
-	fmt.Print("errcode -----------------------", errcode)
115
+	fmt.Print("errcode", errcode)
116 116
 	if errcode == gorm.ErrRecordNotFound {
117 117
 		returnData := make(map[string]interface{}, 0)
118 118
 		returnData["msg"] = "ok"
@@ -133,7 +133,7 @@ func (this *NewDialysisApiController) GetMemberpatientInfo() {
133 133
 	phone := this.GetString("phone")
134 134
 	fmt.Print("phone", phone)
135 135
 	_, errcode := service.GetMemberPatientInfo(orgId, phone)
136
-	fmt.Print("errcode --------------", errcode)
136
+	fmt.Print("errcode", errcode)
137 137
 	if errcode == gorm.ErrRecordNotFound {
138 138
 		returnData := make(map[string]interface{}, 0)
139 139
 		returnData["msg"] = "ok"
@@ -425,7 +425,7 @@ func (this *NewDialysisApiController) SavePatient() {
425 425
 								MemberTreatement:  treatmentmethod,
426 426
 							}
427 427
 							err = service.CreateNewPatient(&patientsNew)
428
-							fmt.Print("报错-----------------------", err)
428
+							fmt.Print("报错", err)
429 429
 							if err != nil {
430 430
 								this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
431 431
 								return
@@ -926,7 +926,7 @@ func (this *NewDialysisApiController) DeleteScheduling() {
926 926
 
927 927
 func (this *NewDialysisApiController) GetEducationDetail() {
928 928
 	id, _ := this.GetInt64("id")
929
-	fmt.Print("id----------", id)
929
+	fmt.Print("id", id)
930 930
 	education, err := service.GetEducationDetailOne(id)
931 931
 	if err != nil {
932 932
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -950,7 +950,6 @@ func (this *NewDialysisApiController) DeleteEducation() {
950 950
 
951 951
 func (this *NewDialysisApiController) GetRescueRecordDetail() {
952 952
 	id, _ := this.GetInt64("id")
953
-	fmt.Print("id========", id)
954 953
 	recordDetail, err := service.GetRescueRecordDetail(id)
955 954
 	if err != nil {
956 955
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -1108,6 +1107,7 @@ func (this *NewDialysisApiController) GetDialysisrecord() {
1108 1107
 }
1109 1108
 
1110 1109
 func (this *NewDialysisApiController) GetDoctorAdviceDetail() {
1110
+
1111 1111
 	adminUser := this.GetMobileAdminUserInfo()
1112 1112
 	orgid := adminUser.Org.Id
1113 1113
 	appid := adminUser.App.Id
@@ -1138,12 +1138,15 @@ func (this *NewDialysisApiController) DeleteManagement() {
1138 1138
 }
1139 1139
 
1140 1140
 func (this *NewDialysisApiController) UpdatedPatient() {
1141
+
1141 1142
 	adminInfo := this.GetMobileAdminUserInfo()
1142 1143
 	orgid := adminInfo.Org.Id
1143 1144
 	fmt.Print("机构ID", orgid)
1144 1145
 	dataBody := make(map[string]interface{}, 0)
1145 1146
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
1146 1147
 	fmt.Print("err", err)
1148
+	id := int64(dataBody["id"].(float64))
1149
+	fmt.Print("id", id)
1147 1150
 	name := dataBody["name"].(string)
1148 1151
 	fmt.Println("姓名", name)
1149 1152
 	sex := int64(dataBody["sex"].(float64))
@@ -1233,4 +1236,163 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1233 1236
 	fmt.Print("病种", patient_type)
1234 1237
 	treatmentmethod := int64(dataBody["treatmentMethod"].(float64))
1235 1238
 	fmt.Print("治疗方式", treatmentmethod)
1239
+
1240
+	//如果是血透病人
1241
+	if bloodPatient == 1 {
1242
+		//根据新表ID获取老表病人ID
1243
+		patient, _ := service.GetNewPatient(id)
1244
+		patients := models.Patients{
1245
+			Name:              name,
1246
+			Gender:            sex,
1247
+			Birthday:          birth,
1248
+			Age:               ages,
1249
+			Phone:             phone,
1250
+			Lapseto:           lapseto,
1251
+			AdmissionNumber:   adminssionNumber,
1252
+			FirstDialysisDate: fisttime,
1253
+			Diagnose:          diagonse,
1254
+			Source:            patientsoure,
1255
+			DialysisNo:        dialysis,
1256
+			UserOrgId:         orgid,
1257
+			Status:            1,
1258
+			CreatedTime:       time.Now().Unix(),
1259
+			Avatar:            avatar,
1260
+			IdCardNo:          idCard,
1261
+			IsInfectious:      is_infectious,
1262
+		}
1263
+		err := service.UpdatedPatient(patients, patient.BloodId)
1264
+		patientsNew := models.XtPatientsNew{
1265
+			ID:                id,
1266
+			Name:              name,
1267
+			Gender:            sex,
1268
+			Birthday:          birth,
1269
+			Age:               ages,
1270
+			Phone:             phone,
1271
+			Lapseto:           lapseto,
1272
+			AdmissionNumber:   adminssionNumber,
1273
+			FirstDialysisDate: fisttime,
1274
+			Diagnose:          diagonse,
1275
+			Source:            patientsoure,
1276
+			DialysisNo:        dialysis,
1277
+			UserOrgId:         orgid,
1278
+			Status:            1,
1279
+			CreatedTime:       time.Now().Unix(),
1280
+			Avatar:            avatar,
1281
+			IdCardNo:          idCard,
1282
+			IsInfectious:      is_infectious,
1283
+		}
1284
+		err = service.UpdateXtPatientNew(patientsNew, id)
1285
+		if err != nil {
1286
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1287
+			return
1288
+		}
1289
+		this.ServeSuccessJSON(map[string]interface{}{
1290
+			"patients": patientsNew,
1291
+		})
1292
+	}
1293
+	if slowpatient == 1 {
1294
+		patient, _ := service.GetNewPatient(id)
1295
+		patients := models.CdmPatients{
1296
+			Name:        name,
1297
+			Gender:      sex,
1298
+			Birthday:    birth,
1299
+			Phone:       phone,
1300
+			Diagnose:    diagonse,
1301
+			Source:      patientsoure,
1302
+			UserOrgId:   orgid,
1303
+			Status:      1,
1304
+			CreatedTime: time.Now().Unix(),
1305
+			Avatar:      avatar,
1306
+			IdCardNo:    idCard,
1307
+		}
1308
+		err := service.UpdateCustomer(patients, patient.SlowId)
1309
+		fmt.Print("更新慢病患者失败", err)
1310
+		xtPatientsNew := models.XtPatientsNew{
1311
+			ID:                id,
1312
+			Name:              name,
1313
+			Gender:            sex,
1314
+			Birthday:          birth,
1315
+			Age:               ages,
1316
+			Phone:             phone,
1317
+			Lapseto:           lapseto,
1318
+			AdmissionNumber:   adminssionNumber,
1319
+			FirstDialysisDate: fisttime,
1320
+			Diagnose:          diagonse,
1321
+			Source:            patientsoure,
1322
+			DialysisNo:        dialysis,
1323
+			UserOrgId:         orgid,
1324
+			Status:            1,
1325
+			CreatedTime:       time.Now().Unix(),
1326
+			Avatar:            avatar,
1327
+			MemberPatients:    memberpatient,
1328
+			BloodPatients:     bloodPatient,
1329
+			SlowPatients:      slowpatient,
1330
+			IsInfectious:      is_infectious,
1331
+			IdCardNo:          idCard,
1332
+			EquitmentId:       requipmentId,
1333
+		}
1334
+		err = service.UpdateXtPatientNew(xtPatientsNew, id)
1335
+		fmt.Print("更新失败", err)
1336
+		if err != nil {
1337
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1338
+			return
1339
+		}
1340
+		this.ServeSuccessJSON(map[string]interface{}{
1341
+			"patients": xtPatientsNew,
1342
+		})
1343
+	}
1344
+
1345
+	if memberpatient == 1 {
1346
+		patient, _ := service.GetNewPatient(id)
1347
+		customer := models.SgjUserCustomer{
1348
+			Name:        name,
1349
+			UserOrgId:   orgid,
1350
+			Mobile:      phone,
1351
+			Gender:      sex,
1352
+			Birthday:    birth,
1353
+			IllDate:     memtime,
1354
+			Status:      1,
1355
+			CreatedTime: time.Now().Unix(),
1356
+			Avatar:      avatar,
1357
+			IllnessId:   patient_type,
1358
+			TreatType:   treatmentmethod,
1359
+		}
1360
+		err := service.UpdatedCustomer(customer, patient.MemberId)
1361
+
1362
+		fmt.Print("更新失败", err)
1363
+		patientsNew := models.XtPatientsNew{
1364
+			ID:                id,
1365
+			Name:              name,
1366
+			Gender:            sex,
1367
+			Birthday:          birth,
1368
+			Age:               ages,
1369
+			Phone:             phone,
1370
+			Lapseto:           lapseto,
1371
+			AdmissionNumber:   adminssionNumber,
1372
+			FirstDialysisDate: fisttime,
1373
+			Diagnose:          diagonse,
1374
+			Source:            patientsoure,
1375
+			DialysisNo:        dialysis,
1376
+			UserOrgId:         orgid,
1377
+			Status:            1,
1378
+			CreatedTime:       time.Now().Unix(),
1379
+			Avatar:            avatar,
1380
+			MemberPatients:    memberpatient,
1381
+			BloodPatients:     bloodPatient,
1382
+			SlowPatients:      slowpatient,
1383
+			IsInfectious:      is_infectious,
1384
+			IdCardNo:          idCard,
1385
+			MemberFistdate:    memtime,
1386
+			MemberPatienttype: patient_type,
1387
+			MemberTreatement:  treatmentmethod,
1388
+		}
1389
+		err = service.UpdateXtPatientNew(patientsNew, id)
1390
+		if err != nil {
1391
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1392
+			return
1393
+		}
1394
+		this.ServeSuccessJSON(map[string]interface{}{
1395
+			"patients": patientsNew,
1396
+		})
1397
+	}
1236 1398
 }

+ 1 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go 파일 보기

@@ -70,5 +70,6 @@ func NewMobileAPIControllersRegisterRouters() {
70 70
 	beego.Router("/m/api/patient/getdialysisrecord", &NewDialysisApiController{}, "Get:GetDialysisrecord")
71 71
 	beego.Router("/m/api/patient/getdoctoradvicedetail", &NewDialysisApiController{}, "Get:GetDoctorAdviceDetail")
72 72
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
73
+	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
73 74
 
74 75
 }

+ 70 - 8
service/patientmanage_service.go 파일 보기

@@ -689,26 +689,56 @@ func ToSearchePatient(keyword string, orgId int64) (paitents []*models.XtPatient
689 689
 }
690 690
 
691 691
 func SearchallPatient(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
692
-	likeKey := "%" + keyword + "%"
693
-	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ?", likeKey, keyword, orgid).Find(&patients).Error
692
+	db := XTReadDB().Table("xt_patients_new as x").Where("x.status = 1")
693
+	if len(keyword) > 0 {
694
+		likeKey := "%" + keyword + "%"
695
+		db = db.Where("x.name LIKE ? OR x.dialysis_no LIKE ?", likeKey, likeKey)
696
+	}
697
+	if orgid > 0 {
698
+		db = db.Where("x.user_org_id = ?", orgid)
699
+	}
700
+	err = db.Select("x.id,x.user_org_id,x.user_id,x.avatar,x.patient_type,x.dialysis_no,x.admission_number,x.source,x.lapseto,x.partition_id,x.bed_id,x.name,x.alias,x.gender,x.marital_status,x.id_card_no,x.birthday,x.reimbursement_way_id,x.health_care_type,x.health_care_no,x.health_care_due_date,x.height,x.blood_type,x.rh,x.health_care_due_alert_date,x.education_level,x.profession,x.phone,x.home_telephone,x.relative_phone,x.relative_relations,x.home_address,x.work_unit,x.unit_address,x.children,x.receiving_date,x.is_hospital_first_dialysis,x.first_dialysis_date,x.first_dialysis_hospital,x.predialysis_condition,x.pre_hospital_dialysis_frequency,x.pre_hospital_dialysis_times,x.hospital_first_dialysis_date,x.induction_period,x.initial_dialysis,x.total_dialysis,x.attending_doctor_id,x.head_nurse_id,x.evaluate,x.diagnose,x.remark,x.registrars_id,x.registrars,x.qr_code,x.binding_state,x.patient_complains,x.present_history,x.past_history,x.temperature,x.pulse,x.respiratory,x.sbp,x.dbp,x.status,x.created_time,x.updated_time,x.nation,x.native_place,x.age,x.infectious_next_record_time,x.is_infectious,x.remind_cycle,x.response_result,x.is_open_remind,x.first_treatment_date,x.dialysis_age,x.expense_kind,x.tell_phone,x.contact_name,x.blood_patients,x.slow_patients,x.member_patients,x.ecommer_patients,x.blood_id,x.slow_id,x.member_id,x.member_fistdate,x.member_patienttype,x.member_treatement,x.equitment_id").Find(&patients).Error
694 701
 	return patients, err
695 702
 }
696 703
 
697 704
 func GetSearchallBlood(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
698
-	likeKey := "%" + keyword + "%"
699
-	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ? and blood_patients = 1", likeKey, keyword, orgid).Find(&patients).Error
705
+
706
+	db := XTReadDB().Table("xt_patients_new as x").Where("x.status = 1 and x.blood_patients = 1")
707
+	if len(keyword) > 0 {
708
+		likeKey := "%" + keyword + "%"
709
+		db = db.Where("x.name LIKE ? OR x.dialysis_no LIKE ?", likeKey, likeKey)
710
+	}
711
+	if orgid > 0 {
712
+		db = db.Where("x.user_org_id = ?", orgid)
713
+	}
714
+	err = db.Select("x.id,x.user_org_id,x.user_id,x.avatar,x.patient_type,x.dialysis_no,x.admission_number,x.source,x.lapseto,x.partition_id,x.bed_id,x.name,x.alias,x.gender,x.marital_status,x.id_card_no,x.birthday,x.reimbursement_way_id,x.health_care_type,x.health_care_no,x.health_care_due_date,x.height,x.blood_type,x.rh,x.health_care_due_alert_date,x.education_level,x.profession,x.phone,x.home_telephone,x.relative_phone,x.relative_relations,x.home_address,x.work_unit,x.unit_address,x.children,x.receiving_date,x.is_hospital_first_dialysis,x.first_dialysis_date,x.first_dialysis_hospital,x.predialysis_condition,x.pre_hospital_dialysis_frequency,x.pre_hospital_dialysis_times,x.hospital_first_dialysis_date,x.induction_period,x.initial_dialysis,x.total_dialysis,x.attending_doctor_id,x.head_nurse_id,x.evaluate,x.diagnose,x.remark,x.registrars_id,x.registrars,x.qr_code,x.binding_state,x.patient_complains,x.present_history,x.past_history,x.temperature,x.pulse,x.respiratory,x.sbp,x.dbp,x.status,x.created_time,x.updated_time,x.nation,x.native_place,x.age,x.infectious_next_record_time,x.is_infectious,x.remind_cycle,x.response_result,x.is_open_remind,x.first_treatment_date,x.dialysis_age,x.expense_kind,x.tell_phone,x.contact_name,x.blood_patients,x.slow_patients,x.member_patients,x.ecommer_patients,x.blood_id,x.slow_id,x.member_id,x.member_fistdate,x.member_patienttype,x.member_treatement,x.equitment_id").Find(&patients).Error
700 715
 	return patients, err
701 716
 }
702 717
 
703 718
 func GetSlowSearchePatient(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
704
-	likeKey := "%" + keyword + "%"
705
-	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ? and slow_patients = 1", likeKey, keyword, orgid).Find(&patients).Error
719
+
720
+	db := XTReadDB().Table("xt_patients_new as x").Where("x.status = 1 and x.slow_patients = 1")
721
+	if len(keyword) > 0 {
722
+		likeKey := "%" + keyword + "%"
723
+		db = db.Where("x.name LIKE ? OR x.dialysis_no LIKE ?", likeKey, likeKey)
724
+	}
725
+	if orgid > 0 {
726
+		db = db.Where("x.user_org_id = ?", orgid)
727
+	}
728
+	err = db.Select("x.id,x.user_org_id,x.user_id,x.avatar,x.patient_type,x.dialysis_no,x.admission_number,x.source,x.lapseto,x.partition_id,x.bed_id,x.name,x.alias,x.gender,x.marital_status,x.id_card_no,x.birthday,x.reimbursement_way_id,x.health_care_type,x.health_care_no,x.health_care_due_date,x.height,x.blood_type,x.rh,x.health_care_due_alert_date,x.education_level,x.profession,x.phone,x.home_telephone,x.relative_phone,x.relative_relations,x.home_address,x.work_unit,x.unit_address,x.children,x.receiving_date,x.is_hospital_first_dialysis,x.first_dialysis_date,x.first_dialysis_hospital,x.predialysis_condition,x.pre_hospital_dialysis_frequency,x.pre_hospital_dialysis_times,x.hospital_first_dialysis_date,x.induction_period,x.initial_dialysis,x.total_dialysis,x.attending_doctor_id,x.head_nurse_id,x.evaluate,x.diagnose,x.remark,x.registrars_id,x.registrars,x.qr_code,x.binding_state,x.patient_complains,x.present_history,x.past_history,x.temperature,x.pulse,x.respiratory,x.sbp,x.dbp,x.status,x.created_time,x.updated_time,x.nation,x.native_place,x.age,x.infectious_next_record_time,x.is_infectious,x.remind_cycle,x.response_result,x.is_open_remind,x.first_treatment_date,x.dialysis_age,x.expense_kind,x.tell_phone,x.contact_name,x.blood_patients,x.slow_patients,x.member_patients,x.ecommer_patients,x.blood_id,x.slow_id,x.member_id,x.member_fistdate,x.member_patienttype,x.member_treatement,x.equitment_id").Find(&patients).Error
706 729
 	return patients, err
707 730
 }
708 731
 
709 732
 func GetMemberSearchPatient(keyword string, orgid int64) (patients []*models.XtPatientsNew, err error) {
710
-	likeKey := "%" + keyword + "%"
711
-	err = XTReadDB().Where("name like ? or dialysis_no = ? and user_org_id = ? and member_patients = 1", likeKey, keyword, orgid).Find(&patients).Error
733
+	db := XTReadDB().Table("xt_patients_new as x").Where("x.status = 1 and x.member_patients = 1")
734
+	if len(keyword) > 0 {
735
+		likeKey := "%" + keyword + "%"
736
+		db = db.Where("x.name LIKE ? OR x.dialysis_no LIKE ?", likeKey, likeKey)
737
+	}
738
+	if orgid > 0 {
739
+		db = db.Where("x.user_org_id = ?", orgid)
740
+	}
741
+	err = db.Select("x.id,x.user_org_id,x.user_id,x.avatar,x.patient_type,x.dialysis_no,x.admission_number,x.source,x.lapseto,x.partition_id,x.bed_id,x.name,x.alias,x.gender,x.marital_status,x.id_card_no,x.birthday,x.reimbursement_way_id,x.health_care_type,x.health_care_no,x.health_care_due_date,x.height,x.blood_type,x.rh,x.health_care_due_alert_date,x.education_level,x.profession,x.phone,x.home_telephone,x.relative_phone,x.relative_relations,x.home_address,x.work_unit,x.unit_address,x.children,x.receiving_date,x.is_hospital_first_dialysis,x.first_dialysis_date,x.first_dialysis_hospital,x.predialysis_condition,x.pre_hospital_dialysis_frequency,x.pre_hospital_dialysis_times,x.hospital_first_dialysis_date,x.induction_period,x.initial_dialysis,x.total_dialysis,x.attending_doctor_id,x.head_nurse_id,x.evaluate,x.diagnose,x.remark,x.registrars_id,x.registrars,x.qr_code,x.binding_state,x.patient_complains,x.present_history,x.past_history,x.temperature,x.pulse,x.respiratory,x.sbp,x.dbp,x.status,x.created_time,x.updated_time,x.nation,x.native_place,x.age,x.infectious_next_record_time,x.is_infectious,x.remind_cycle,x.response_result,x.is_open_remind,x.first_treatment_date,x.dialysis_age,x.expense_kind,x.tell_phone,x.contact_name,x.blood_patients,x.slow_patients,x.member_patients,x.ecommer_patients,x.blood_id,x.slow_id,x.member_id,x.member_fistdate,x.member_patienttype,x.member_treatement,x.equitment_id").Find(&patients).Error
712 742
 	return patients, err
713 743
 }
714 744
 
@@ -813,3 +843,35 @@ func DeleteManagement(groupid int64, orgid int64) error {
813 843
 	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("groupno=? and user_org_id = ?", groupid, orgid).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
814 844
 	return err
815 845
 }
846
+
847
+func GetNewPatient(id int64) (models.XtPatientsNew, error) {
848
+	patientsNew := models.XtPatientsNew{}
849
+	err := XTReadDB().Model(&patientsNew).Where("id=?", id).Find(&patientsNew).Error
850
+	return patientsNew, err
851
+}
852
+
853
+func UpdatedPatient(patients models.Patients, id int64) error {
854
+
855
+	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious}).Error
856
+
857
+	return err
858
+}
859
+
860
+func UpdateXtPatientNew(patients models.XtPatientsNew, id int64) error {
861
+
862
+	err := XTWriteDB().Model(&patients).Where("id=?", id).Update(map[string]interface{}{"name": patients.Name, "gender": patients.Gender, "birthday": patients.Birthday, "age": patients.Age, "phone": patients.Phone, "lapseto": patients.Lapseto, "admission_number": patients.AdmissionNumber, "first_dialysis_date": patients.FirstDialysisDate, "diagnose": patients.Diagnose, "source": patients.Source, "dialysis_no": patients.DialysisNo, "avatar": patients.Avatar, "id_card_no": patients.IdCardNo, "is_infectious": patients.IsInfectious}).Error
863
+
864
+	return err
865
+}
866
+
867
+func UpdateCustomer(cdmpatient models.CdmPatients, id int64) error {
868
+
869
+	err := PatientWriteDB().Model(&cdmpatient).Where("id=?", id).Update(map[string]interface{}{"name": cdmpatient.Name, "phone": cdmpatient.Phone, "gender": cdmpatient.Gender, "birthday": cdmpatient.Birthday, "diagnose": cdmpatient.Diagnose, "source": cdmpatient.Source, "avatar": cdmpatient.Avatar, "id_card_no": cdmpatient.IdCardNo, "updated_time": cdmpatient.UpdatedTime}).Error
870
+	return err
871
+}
872
+
873
+func UpdatedCustomer(customer models.SgjUserCustomer, id int64) error {
874
+
875
+	err := UserWriteDB().Model(&customer).Where("id = ?", id).Update(map[string]interface{}{"name": customer.Name, "mobile": customer.Mobile, "gender": customer.Gender, "birthday": customer.Birthday, "ill_date": customer.IllDate, "avatar": customer.Avatar, "illness_id": customer.IllnessId, "treat_type": customer.TreatType}).Error
876
+	return err
877
+}

+ 4 - 0
service/vm_service.go 파일 보기

@@ -8,6 +8,10 @@ func CreateVMOrgPatient(patients *models.VMOrgPatients) {
8 8
 	writeDb.Model(&models.VMOrgPatients{}).Create(&patients)
9 9
 }
10 10
 
11
+func CreateVMOrgNewPatient(patientsNew *models.XtPatientsNew) {
12
+	writeDb.Model(&models.XtPatientsNew{}).Create(&patientsNew)
13
+}
14
+
11 15
 func CreateVMZone(zone *models.VMDeviceZone) {
12 16
 	writeDb.Model(&models.VMDeviceZone{}).Create(&zone)
13 17
 }