Browse Source

修改问题

张保健 4 years ago
parent
commit
98a8b54c58

+ 9 - 16
controllers/data_api_controller.go View File

71
 	var dataconfig models.Dataconfig
71
 	var dataconfig models.Dataconfig
72
 	var resultConfig models.ConfigViewModel
72
 	var resultConfig models.ConfigViewModel
73
 	code := configFormData(&dataconfig, c.Ctx.Input.RequestBody)
73
 	code := configFormData(&dataconfig, c.Ctx.Input.RequestBody)
74
-	fmt.Println("code----------", code)
75
 	if code > 0 {
74
 	if code > 0 {
76
 		c.ServeFailJSONWithSGJErrorCode(code)
75
 		c.ServeFailJSONWithSGJErrorCode(code)
77
 		return
76
 		return
78
 	}
77
 	}
79
 	// 验证关键字段的值是否重复
78
 	// 验证关键字段的值是否重复
80
-	// if (dataconfig.Module == "education" || dataconfig.Module == "summary") {
81
-	// 	thisConfig,_:=service.FindConfigByTitle(dataconfig.Module, dataconfig.FieldName,dataconfig.OrgId)
82
-	// 	if thisConfig.ID >0 {
83
-	// 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
84
-	// 		return
85
-	// 	}
86
-	// } else {
87
-	// 	thisConfig,_:=service.FindConfigByFieldname(dataconfig.Module, dataconfig.FieldName,dataconfig.OrgId)
88
-	// 	if thisConfig.ID >0 {
89
-	// 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
90
-	// 		return
91
-	// 	}
92
-	// }
93
-	// fieldValue:=service.GetChildValue(dataconfig.Module, dataconfig.ParentId)
94
-	// dataconfig.Value = fieldValue+1
79
+
80
+	thisConfig,_:=service.FindConfigByTitle(dataconfig.Module, dataconfig.FieldName,adminUserInfo.CurrentOrgId)
81
+	if thisConfig.ID >0 {
82
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFieldExist)
83
+		return
84
+	}
85
+	
86
+	fieldValue:=service.GetChildValue(dataconfig.Module, dataconfig.ParentId,adminUserInfo.CurrentOrgId)
87
+	dataconfig.Value = fieldValue+1
95
 
88
 
96
 	dataBody := make(map[string]interface{}, 0)
89
 	dataBody := make(map[string]interface{}, 0)
97
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
90
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)

+ 1 - 2
controllers/patient_api_controller.go View File

467
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdatePatient)
467
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdatePatient)
468
 		return
468
 		return
469
 	}
469
 	}
470
-	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
470
+
471
 	patientsNew := models.XtPatientsNew{
471
 	patientsNew := models.XtPatientsNew{
472
 		UserOrgId:          patient.UserOrgId,
472
 		UserOrgId:          patient.UserOrgId,
473
 		UserId:             patient.UserId,
473
 		UserId:             patient.UserId,
547
 	}
547
 	}
548
 	//	//更新病人ID获取新表病人ID
548
 	//	//更新病人ID获取新表病人ID
549
 	err = service.UpdatepatientTwo(&patientsNew, id)
549
 	err = service.UpdatepatientTwo(&patientsNew, id)
550
-	fmt.Println("更新病人失败---------------------------------------", err)
551
 
550
 
552
 	if len(record_date) > 0 {
551
 	if len(record_date) > 0 {
553
 		var recordTime int64
552
 		var recordTime int64

+ 4 - 3
service/mobile_dialysis_service.go View File

89
 	DeviceZone               *models.DeviceZone                `gorm:"ForeignKey:PartitionId" json:"device_zone"`
89
 	DeviceZone               *models.DeviceZone                `gorm:"ForeignKey:PartitionId" json:"device_zone"`
90
 	TreatmentMode            *models.TreatmentMode             `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
90
 	TreatmentMode            *models.TreatmentMode             `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
91
 	DialysisOrder            *MDialysisOrderVMList             `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
91
 	DialysisOrder            *MDialysisOrderVMList             `gorm:"ForeignKey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"dialysis_order"`
92
-	Prescription             *models.DialysisPrescriptionList  `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
93
-	AssessmentBeforeDislysis *models.PredialysisEvaluationList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"assessment_before_dislysis"`
94
-	TreatmentSummary 		 *models.TreatmentSummary 		   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"treatment_summary"`
92
+	Prescription             *models.DialysisPrescriptionList  `gorm:"ForeignKey:RecordDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"prescription"`
93
+	AssessmentBeforeDislysis *models.PredialysisEvaluationList `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"assessment_before_dislysis"`
94
+	TreatmentSummary 		 *models.TreatmentSummary 		   `gorm:"ForeignKey:AssessmentDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"treatment_summary"`
95
 	Advices                  []*models.DoctorAdvice            `gorm:"ForeignKey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"doctor_advice"`
95
 	Advices                  []*models.DoctorAdvice            `gorm:"ForeignKey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"doctor_advice"`
96
 }
96
 }
97
 
97
 
114
 	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
114
 	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
115
 	UserId             int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
115
 	UserId             int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
116
 	PatientType        int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
116
 	PatientType        int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
117
+	DialysisNo         string  `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
117
 	Avatar             string `gorm:"column:avatar" json:"avatar" form:"avatar"`
118
 	Avatar             string `gorm:"column:avatar" json:"avatar" form:"avatar"`
118
 	Gender             int64  `gorm:"column:gender" json:"gender" form:"gender"`
119
 	Gender             int64  `gorm:"column:gender" json:"gender" form:"gender"`
119
 	Birthday           int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
120
 	Birthday           int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`

+ 18 - 1
service/patient_service.go View File

328
 		utx.Rollback()
328
 		utx.Rollback()
329
 		return
329
 		return
330
 	}
330
 	}
331
-	if len(contagions) > 0 {
331
+	if len(contagions) > 0 &&  patient.IsInfectious == 2{
332
 		thisSQL := "INSERT INTO xt_patients_infectious_diseases (patient_id, disease_id, status, created_time, updated_time) VALUES "
332
 		thisSQL := "INSERT INTO xt_patients_infectious_diseases (patient_id, disease_id, status, created_time, updated_time) VALUES "
333
 		insertParams := make([]string, 0)
333
 		insertParams := make([]string, 0)
334
 		insertData := make([]interface{}, 0)
334
 		insertData := make([]interface{}, 0)
1328
 	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and groupno = ? and advice_date = ? and patient_id = ?", orgid, groupno, date, patientid).Update(map[string]interface{}{"start_time": advice.StartTime, "updated_time": advice.UpdatedTime}).Error
1328
 	err := XTWriteDB().Model(&advice).Where("user_org_id = ? and groupno = ? and advice_date = ? and patient_id = ?", orgid, groupno, date, patientid).Update(map[string]interface{}{"start_time": advice.StartTime, "updated_time": advice.UpdatedTime}).Error
1329
 	return err
1329
 	return err
1330
 }
1330
 }
1331
+
1332
+
1333
+func GetPatientsByKey(orgID int64, keywords string) (patient []*models.Patients, err error) {
1334
+	db := readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1 and lapseto = 1 ", orgID)
1335
+	if len(keywords) > 0 {
1336
+	 likekey := "%" + keywords + "%"
1337
+	 err = db.Where("(name LIKE ? OR dialysis_no LIKE ?)", likekey, likekey).Find(&patient).Error
1338
+	} else {
1339
+	 err = db.Find(&patient).Error
1340
+	}
1341
+	return
1342
+   }
1343
+
1344
+func UpdatePatientLapseto(patientid int64, lapseto models.PatientLapseto) error {
1345
+	err := XTWriteDB().Model(&lapseto).Where("patient_id = ?", patientid).Updates(map[string]interface{}{"lapseto_type": lapseto.LapsetoType, "lapseto_time": time.Now().Unix(), "updated_time": time.Now().Unix()}).Error
1346
+	return err
1347
+}

+ 1 - 1
service/patientmanage_service.go View File

1044
 	if projectid > 0 {
1044
 	if projectid > 0 {
1045
 		db = db.Where("x.project_id = ?", projectid)
1045
 		db = db.Where("x.project_id = ?", projectid)
1046
 	}
1046
 	}
1047
-	err = db.Group("x.id").Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,x.status,x.created_time,x.updated_time,r.range_type,r.range_min,r.range_max,r.range_value,r.range_options,r.unit").Joins("left join xt_inspection_reference as r on r.item_id = x.item_id ").Scan(&inspection).Error
1047
+	err = db.Group("x.id").Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,x.status,x.created_time,x.updated_time,r.range_type,r.range_min,r.range_max,r.range_value,r.range_options,r.unit").Joins("left join xt_inspection_reference as r on (r.item_id = x.item_id AND r.org_id > 0) OR ( x.item_id = r.id AND r.org_id = 0)   ").Scan(&inspection).Error
1048
 	return inspection, err
1048
 	return inspection, err
1049
 }
1049
 }
1050
 
1050
 

+ 1 - 1
数据变更脚本.sql View File

11
 --显示配置里添加体液过程症状--
11
 --显示配置里添加体液过程症状--
12
 INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '0','3','humor_excessive_symptom','体液过多症状','2',NULL,NULL,'0');
12
 INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '0','3','humor_excessive_symptom','体液过多症状','2',NULL,NULL,'0');
13
 --添加显示体液过程症状的机构 org_id为要显示的机构--
13
 --添加显示体液过程症状的机构 org_id为要显示的机构--
14
-INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '13','3','humor_excessive_symptom','体液过多症状','1',NULL,NULL,'0');
14
+INSERT INTO `sgj_xt`.`xt_filed_config`(`org_id`,`module`,`filed_name`,`filed_name_cn`,`is_show`,`create_time`,`update_time`,`sys_module`) VALUES ( '9883','3','humor_excessive_symptom','体液过多症状','1',NULL,NULL,'0');
15
 
15
 
16
 
16
 
17
 --2020-06-19 author 张保健 --
17
 --2020-06-19 author 张保健 --