Ver código fonte

更新数据414

XMLWAN 4 anos atrás
pai
commit
cd5cf4f0a9

+ 11 - 0
conf/app.conf Ver arquivo

@@ -100,6 +100,17 @@ writesgjpatientmysqlpass = xhPECP2nFObR8aUK
100 100
 writesgjpatientmysqlname = sgj_patient
101 101
 
102 102
 
103
+readpatienthost = shengws1.mysql.rds.aliyuncs.com
104
+readpatientport = 3306
105
+readpatientuser = syh
106
+readpatientpass = xhPECP2nFObR8aUK
107
+readpatientname = sgj_cdm
108
+
109
+writepatienthost = shengws1.mysql.rds.aliyuncs.com
110
+writepatientport = 3306
111
+writepatientuser = syh
112
+writepatientpass = xhPECP2nFObR8aUK
113
+writepatientname = sgj_cdm
103 114
 
104 115
 redishost = 349e580b2a524290.redis.rds.aliyuncs.com
105 116
 redisport = 6379

+ 27 - 7
controllers/manage_api_controller.go Ver arquivo

@@ -194,7 +194,7 @@ func (this *MachineApiController) SaveManageInfo() {
194 194
 	//查询机位号是否绑定设备
195 195
 	thisAddmacher, err := service.GetEquitmentByBedID(bed_number, orgid)
196 196
 	if thisAddmacher.ID > 0 {
197
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisNoExist)
197
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEquitNoExist)
198 198
 		return
199 199
 	}
200 200
 
@@ -360,6 +360,11 @@ func (this *MachineApiController) UpdateMachineInfo() {
360 360
 	}
361 361
 	fmt.Println("ids", ids)
362 362
 	//service.GetModeName(unit_type)
363
+	thisAddmacher, err := service.GetEquitmentByBedID(bed_number, orgid)
364
+	if thisAddmacher.ID > 0 && thisAddmacher.ID != id {
365
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDialysisNoExist)
366
+		return
367
+	}
363 368
 	addmacher := models.DeviceAddmacher{
364 369
 		ID:                  id,
365 370
 		SerialNumber:        serial_number,
@@ -850,7 +855,7 @@ func (this *MachineApiController) UpdatePlanInfo() {
850 855
 	//fmt.Println("基表消毒液", machinedisinfectant)
851 856
 
852 857
 	disinfectantway := int64(dataBody["disinfectant_way"].(float64))
853
-	//	fmt.Println("液路消毒方式", disinfectantway)
858
+	fmt.Println("液路消毒方式", disinfectantway)
854 859
 
855 860
 	disinfectant := int64(dataBody["disinfectant"].(float64))
856 861
 	//fmt.Println("液路消毒液", disinfectant)
@@ -1149,13 +1154,13 @@ func (this *MachineApiController) SaveInformation() {
1149 1154
 	//fmt.Println("签名", sign_name)
1150 1155
 
1151 1156
 	information, errinfor := service.GetInformation(eid, startdate, orgid)
1152
-	fmt.Print("errinfor---------------------", errinfor)
1157
+	fmt.Print("errinfor", errinfor)
1153 1158
 	fmt.Print("information", information)
1154 1159
 	if errinfor == gorm.ErrRecordNotFound {
1155 1160
 		infor := models.DeviceInformation{
1156
-			Date:                  startdate,
1157
-			Class:                 classtype,
1158
-			Zone:                  zone,
1161
+			Date:  startdate,
1162
+			Class: classtype,
1163
+			//	Zone:                  zone,
1159 1164
 			BedNumber:             bednumber,
1160 1165
 			PatientId:             patient_time,
1161 1166
 			Contagion:             contagion,
@@ -2372,7 +2377,21 @@ func (this *MachineApiController) UpdateForm() {
2372 2377
 	fmt.Println("清洁", clean)
2373 2378
 	sign_name := int64(dataBody["sign_name"].(float64))
2374 2379
 	fmt.Println("签名", sign_name)
2380
+	equitment_id := int64(dataBody["equiment_id"].(float64))
2381
+	fmt.Println("设备ID", equitment_id)
2375 2382
 
2383
+	addmacher := models.DeviceAddmacher{
2384
+		BedId: bednumber,
2385
+	}
2386
+	//更新床位号
2387
+	err = service.UpdateAddMacherBedID(equitment_id, orgid, &addmacher)
2388
+	fmt.Println("更新设备失败", err)
2389
+	//更新区号
2390
+	deviceNumber := models.DeviceNumber{
2391
+		ZoneID: zone,
2392
+	}
2393
+	err = service.UpdatedZoneID(bednumber, orgid, &deviceNumber)
2394
+	fmt.Println("更新区号失败---", err)
2376 2395
 	information := models.DeviceInformation{
2377 2396
 		Date:                  startdate,
2378 2397
 		Class:                 classtype,
@@ -2534,6 +2553,7 @@ func (this *MachineApiController) GetBedForm() {
2534 2553
 	fmt.Println("id", id)
2535 2554
 	addmacher, err := service.GetZoneForm(id)
2536 2555
 	bed, err := service.GetZoneId(addmacher.BedId, orgId)
2556
+
2537 2557
 	number, err := service.GetBedForm(bed.ZoneID)
2538 2558
 	if err != nil {
2539 2559
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "查询:("+err.Error()+")")
@@ -3047,7 +3067,7 @@ func (this *MachineApiController) GetTimeData() {
3047 3067
 func (this *MachineApiController) DeleteImages() {
3048 3068
 	id, _ := this.GetInt64("id")
3049 3069
 	err := service.DeleteImages(id)
3050
-	fmt.Print("err", err)
3070
+	fmt.Print("err========", err)
3051 3071
 	if err != nil {
3052 3072
 		this.ServeFailJsonSend(enums.ErrorCodeDBDelete, "删除失败")
3053 3073
 		return

+ 18 - 19
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Ver arquivo

@@ -241,26 +241,25 @@ func (this *NewDialysisApiController) SavePatient() {
241 241
 	treatmentmethod := int64(dataBody["treatmentMethod"].(float64))
242 242
 	fmt.Print("治疗方式", treatmentmethod)
243 243
 
244
+	//查询身份证号码是否存在
245
+	thisPatientOne, _ := service.FindPatientByIdCardNoOne(orgid, idCard)
246
+	if thisPatientOne.ID > 0 {
247
+		returnData := make(map[string]interface{}, 0)
248
+		returnData["msg"] = "身份证号码已存在"
249
+		this.ServeSuccessJSON(returnData)
250
+		return
251
+	}
252
+
253
+	//查询手机号码是否存在
254
+	thisPatient, err := service.FindPatientByMobileOne(phone, orgid)
255
+	if thisPatient.ID > 0 {
256
+		returnData := make(map[string]interface{}, 0)
257
+		returnData["msg"] = "手机号码已存在"
258
+		this.ServeSuccessJSON(returnData)
259
+		return
260
+	}
244 261
 	//如果是血透病人
245 262
 	if bloodPatient == 1 {
246
-		//查询身份证号码是否存在
247
-		thisPatientOne, _ := service.FindPatientByIdCardNoOne(orgid, idCard)
248
-		if thisPatientOne.ID > 0 {
249
-			returnData := make(map[string]interface{}, 0)
250
-			returnData["msg"] = "身份证号码已存在"
251
-			this.ServeSuccessJSON(returnData)
252
-			return
253
-		}
254
-
255
-		//查询手机号码是否存在
256
-		thisPatient, err := service.FindPatientByMobileOne(phone, orgid)
257
-		if thisPatient.ID > 0 {
258
-			returnData := make(map[string]interface{}, 0)
259
-			returnData["msg"] = "手机号码已存在"
260
-			this.ServeSuccessJSON(returnData)
261
-			return
262
-		}
263
-
264 263
 		//查询透析号是否存在
265 264
 		thisPatientTwo, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
266 265
 		if thisPatientTwo.ID > 0 {
@@ -1466,7 +1465,7 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1466 1465
 			MemberPatienttype: patient_type,
1467 1466
 			MemberTreatement:  treatmentmethod,
1468 1467
 		}
1469
-		err = service.UpdateXtPatientNew(patientsNew, id)
1468
+		err = service.UpdateXtPatientNewOne(patientsNew, id)
1470 1469
 		if err != nil {
1471 1470
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1472 1471
 			return

+ 1 - 0
enums/error_code.go Ver arquivo

@@ -89,6 +89,7 @@ const ( // ErrorCode
89 89
 	ErrorCodeDelScheduleFailByDialysis      = 1041
90 90
 	ErrorCodeNotSelectLapsetoType           = 1042
91 91
 	ErrorCodeNotSelectLapsetoTime           = 1043
92
+	ErrorCodeEquitNoExist                   = 1045
92 93
 
93 94
 	ErrorCodeInspectionDateExit    = 1201
94 95
 	ErrorCodeInspectionAddFail     = 1202

+ 12 - 20
service/manage_service.go Ver arquivo

@@ -732,6 +732,18 @@ func GetLastInformationdata(eid int64, startdate int64, orgid int64) (models.Dev
732 732
 	return information, err
733 733
 }
734 734
 
735
+func UpdateAddMacherBedID(id int64, orgid int64, addmacher *models.DeviceAddmacher) error {
736
+
737
+	err := UserWriteDB().Model(&addmacher).Where("id=? and user_org_id = ? and status =1", id, orgid).Update(map[string]interface{}{"bed_id": addmacher.BedId, "mtime": addmacher.Mtime}).Error
738
+	return err
739
+}
740
+
741
+func UpdatedZoneID(bedid int64, orgid int64, number *models.DeviceNumber) error {
742
+
743
+	err := XTWriteDB().Model(&number).Where("id=? and org_id = ?", bedid, orgid).Update(map[string]interface{}{"zone_id": number.ZoneID, "mtime": time.Now().Unix()}).Error
744
+	return err
745
+}
746
+
735 747
 func UpadateForm(id int64, orgid int64, infor *models.DeviceInformation) error {
736 748
 
737 749
 	err := UserWriteDB().Model(&infor).Where("id = ? AND user_org_id = ? AND status = 1", id, orgid).Updates(map[string]interface{}{"date": infor.Date, "class": infor.Class, "zone": infor.Zone, "bed_number": infor.BedNumber, "contagion": infor.Contagion, "dialysis_mode": infor.DialysisMode, "start_time": infor.StartTime, "end_time": infor.EndTime, "dialysis_hour": infor.DialysisHour, "hyperfiltratio": infor.Hyperfiltratio, "weight_loss": infor.WeightLoss, "warning_value": infor.WarningValue, "user_total": infor.UserTotal, "move": infor.Move, "failure_stage": infor.FailureStage, "fault_description": infor.FaultDescription, "code_information": infor.CodeInformation, "disinfect_type": infor.DisinfectType, "disinfectant_type": infor.DisinfectType, "disinfection": infor.Disinfection, "machine_run": infor.MachineRun, "fluid_path": infor.FluidPath, "disinfectant": infor.Disinfectant, "disinfection_status": infor.DisinfectionStatus, "disinfection_residue": infor.DisinfectionResidue, "long_time": infor.LongTime, "disinfec_startime": infor.DisinfecStartime, "disinfec_endtime": infor.DisinfecEndtime, "dialysis_checked": infor.DialysisChecked, "dialysis_name": infor.DialysisName, "norms": infor.Norms, "dialysis_concentration": infor.DialysisConcentration,
@@ -1050,23 +1062,3 @@ func DeleteImages(id int64) error {
1050 1062
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1051 1063
 	return err
1052 1064
 }
1053
-
1054
-func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error) {
1055
-
1056
-	role := models.Roles{}
1057
-	err := UserReadDB().Model(&role).Where("creator = ? and org_id = ? and app_id = ? and status =1", adminid, orgid, appid).Find(&role).Error
1058
-	return role, err
1059
-}
1060
-
1061
-func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role, error) {
1062
-
1063
-	role := models.App_Role{}
1064
-	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and app_id = ?", adminid, orgid, appid).Find(&role).Error
1065
-	return role, err
1066
-}
1067
-
1068
-func GetPosition(id int64) (models.SgjUserAdminRole, error) {
1069
-	roles := models.SgjUserAdminRole{}
1070
-	err = UserReadDB().Model(&roles).Where("id=? and status = 1", id).Find(&roles).Error
1071
-	return roles, err
1072
-}

+ 28 - 2
service/patientmanage_service.go Ver arquivo

@@ -406,7 +406,7 @@ func CreatePatientTwo(patient *models.Patients, contagions []int64, diseases []i
406 406
 	return
407 407
 }
408 408
 
409
-func FindPatientByIdCardNoOne(orgID int64, idCardNo string) (patient models.Patients, err error) {
409
+func FindPatientByIdCardNoOne(orgID int64, idCardNo string) (patient models.XtPatientsNew, err error) {
410 410
 	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and id_card_no=?", orgID, idCardNo).First(&patient).Error
411 411
 	return
412 412
 }
@@ -416,7 +416,7 @@ func FindPatientByDialysisNoOne(orgID int64, dialysisNo string) (patient models.
416 416
 	return
417 417
 }
418 418
 
419
-func FindPatientByMobileOne(mobile string, orgID int64) (patient models.Patients, err error) {
419
+func FindPatientByMobileOne(mobile string, orgID int64) (patient models.XtPatientsNew, err error) {
420 420
 	err = readDb.Model(&models.Patients{}).Where("phone=? and user_org_id=? and status=1", mobile, orgID).First(&patient).Error
421 421
 	return
422 422
 }
@@ -925,6 +925,12 @@ func UpdateXtPatientNew(patients models.XtPatientsNew, id int64) error {
925 925
 	return err
926 926
 }
927 927
 
928
+func UpdateXtPatientNewOne(patients models.XtPatientsNew, id int64) error {
929
+
930
+	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, "adminssion_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, "member_patienttype": patients.MemberPatienttype, "member_treatement": patients.MemberTreatement}).Error
931
+	return err
932
+}
933
+
928 934
 func UpdateContagions(patientid int64) (models.XtPatientsInfectiousDiseases, error) {
929 935
 	diseases := models.XtPatientsInfectiousDiseases{}
930 936
 	err := XTWriteDB().Model(&diseases).Where("patient_id = ?", patientid).Update(map[string]interface{}{"status": 2, "updated_time": time.Now().Unix()}).Error
@@ -1271,3 +1277,23 @@ func CreateLoginLod(log *models.SgjUserAdminLoginLog) error {
1271 1277
 	err := UserWriteDB().Model(&log).Create(&log).Error
1272 1278
 	return err
1273 1279
 }
1280
+
1281
+func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error) {
1282
+
1283
+	role := models.Roles{}
1284
+	err := UserReadDB().Model(&role).Where("creator = ? and org_id = ? and app_id = ? and status =1", adminid, orgid, appid).Find(&role).Error
1285
+	return role, err
1286
+}
1287
+
1288
+func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role, error) {
1289
+
1290
+	role := models.App_Role{}
1291
+	err := UserReadDB().Model(&role).Where("admin_user_id = ? and org_id = ? and app_id = ?", adminid, orgid, appid).Find(&role).Error
1292
+	return role, err
1293
+}
1294
+
1295
+func GetPosition(id int64) (models.SgjUserAdminRole, error) {
1296
+	roles := models.SgjUserAdminRole{}
1297
+	err = UserReadDB().Model(&roles).Where("id=? and status = 1", id).Find(&roles).Error
1298
+	return roles, err
1299
+}