Parcourir la source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx il y a 4 ans
Parent
révision
cc30ce40f9

+ 11 - 0
conf/app.conf Voir le fichier

100
 writesgjpatientmysqlname = sgj_patient
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
 redishost = 349e580b2a524290.redis.rds.aliyuncs.com
115
 redishost = 349e580b2a524290.redis.rds.aliyuncs.com
105
 redisport = 6379
116
 redisport = 6379

+ 27 - 7
controllers/manage_api_controller.go Voir le fichier

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

+ 18 - 19
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Voir le fichier

241
 	treatmentmethod := int64(dataBody["treatmentMethod"].(float64))
241
 	treatmentmethod := int64(dataBody["treatmentMethod"].(float64))
242
 	fmt.Print("治疗方式", treatmentmethod)
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
 	if bloodPatient == 1 {
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
 		thisPatientTwo, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
264
 		thisPatientTwo, _ := service.FindPatientByDialysisNoOne(orgid, dialysis)
266
 		if thisPatientTwo.ID > 0 {
265
 		if thisPatientTwo.ID > 0 {
1466
 			MemberPatienttype: patient_type,
1465
 			MemberPatienttype: patient_type,
1467
 			MemberTreatement:  treatmentmethod,
1466
 			MemberTreatement:  treatmentmethod,
1468
 		}
1467
 		}
1469
-		err = service.UpdateXtPatientNew(patientsNew, id)
1468
+		err = service.UpdateXtPatientNewOne(patientsNew, id)
1470
 		if err != nil {
1469
 		if err != nil {
1471
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1470
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1472
 			return
1471
 			return

+ 1 - 0
enums/error_code.go Voir le fichier

89
 	ErrorCodeDelScheduleFailByDialysis      = 1041
89
 	ErrorCodeDelScheduleFailByDialysis      = 1041
90
 	ErrorCodeNotSelectLapsetoType           = 1042
90
 	ErrorCodeNotSelectLapsetoType           = 1042
91
 	ErrorCodeNotSelectLapsetoTime           = 1043
91
 	ErrorCodeNotSelectLapsetoTime           = 1043
92
+	ErrorCodeEquitNoExist                   = 1045
92
 
93
 
93
 	ErrorCodeInspectionDateExit    = 1201
94
 	ErrorCodeInspectionDateExit    = 1201
94
 	ErrorCodeInspectionAddFail     = 1202
95
 	ErrorCodeInspectionAddFail     = 1202

+ 12 - 20
service/manage_service.go Voir le fichier

732
 	return information, err
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
 func UpadateForm(id int64, orgid int64, infor *models.DeviceInformation) error {
747
 func UpadateForm(id int64, orgid int64, infor *models.DeviceInformation) error {
736
 
748
 
737
 	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,
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
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1062
 	err := UserWriteDB().Model(&repair).Where("id=?", id).Update(map[string]interface{}{"images": "", "image_name": ""}).Error
1051
 	return err
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 Voir le fichier

406
 	return
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
 	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and id_card_no=?", orgID, idCardNo).First(&patient).Error
410
 	err = readDb.Model(&models.Patients{}).Where("status=1 and user_org_id=? and id_card_no=?", orgID, idCardNo).First(&patient).Error
411
 	return
411
 	return
412
 }
412
 }
416
 	return
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
 	err = readDb.Model(&models.Patients{}).Where("phone=? and user_org_id=? and status=1", mobile, orgID).First(&patient).Error
420
 	err = readDb.Model(&models.Patients{}).Where("phone=? and user_org_id=? and status=1", mobile, orgID).First(&patient).Error
421
 	return
421
 	return
422
 }
422
 }
925
 	return err
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
 func UpdateContagions(patientid int64) (models.XtPatientsInfectiousDiseases, error) {
934
 func UpdateContagions(patientid int64) (models.XtPatientsInfectiousDiseases, error) {
929
 	diseases := models.XtPatientsInfectiousDiseases{}
935
 	diseases := models.XtPatientsInfectiousDiseases{}
930
 	err := XTWriteDB().Model(&diseases).Where("patient_id = ?", patientid).Update(map[string]interface{}{"status": 2, "updated_time": time.Now().Unix()}).Error
936
 	err := XTWriteDB().Model(&diseases).Where("patient_id = ?", patientid).Update(map[string]interface{}{"status": 2, "updated_time": time.Now().Unix()}).Error
1271
 	err := UserWriteDB().Model(&log).Create(&log).Error
1277
 	err := UserWriteDB().Model(&log).Create(&log).Error
1272
 	return err
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
+}