Browse Source

修改问题

张保健 3 years ago
parent
commit
98a8b54c58

+ 9 - 16
controllers/data_api_controller.go View File

@@ -71,27 +71,20 @@ func (c *DataApiController) CreateConfig() {
71 71
 	var dataconfig models.Dataconfig
72 72
 	var resultConfig models.ConfigViewModel
73 73
 	code := configFormData(&dataconfig, c.Ctx.Input.RequestBody)
74
-	fmt.Println("code----------", code)
75 74
 	if code > 0 {
76 75
 		c.ServeFailJSONWithSGJErrorCode(code)
77 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 89
 	dataBody := make(map[string]interface{}, 0)
97 90
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)

+ 1 - 2
controllers/patient_api_controller.go View File

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

+ 4 - 3
service/mobile_dialysis_service.go View File

@@ -89,9 +89,9 @@ type MDialysisScheduleVM struct {
89 89
 	DeviceZone               *models.DeviceZone                `gorm:"ForeignKey:PartitionId" json:"device_zone"`
90 90
 	TreatmentMode            *models.TreatmentMode             `gorm:"ForeignKey:ModeId" json:"treatment_mode"`
91 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 95
 	Advices                  []*models.DoctorAdvice            `gorm:"ForeignKey:AdviceDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId" json:"doctor_advice"`
96 96
 }
97 97
 
@@ -114,6 +114,7 @@ type MSchedualPatientVMList struct {
114 114
 	UserOrgId          int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
115 115
 	UserId             int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
116 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 118
 	Avatar             string `gorm:"column:avatar" json:"avatar" form:"avatar"`
118 119
 	Gender             int64  `gorm:"column:gender" json:"gender" form:"gender"`
119 120
 	Birthday           int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`

+ 18 - 1
service/patient_service.go View File

@@ -328,7 +328,7 @@ func UpdatePatient(patient *models.Patients, contagions []int64, diseases []int6
328 328
 		utx.Rollback()
329 329
 		return
330 330
 	}
331
-	if len(contagions) > 0 {
331
+	if len(contagions) > 0 &&  patient.IsInfectious == 2{
332 332
 		thisSQL := "INSERT INTO xt_patients_infectious_diseases (patient_id, disease_id, status, created_time, updated_time) VALUES "
333 333
 		insertParams := make([]string, 0)
334 334
 		insertData := make([]interface{}, 0)
@@ -1328,3 +1328,20 @@ func UpdateDoctorEditAdvice(advice models.XtDoctorAdvice, orgid int64, groupno i
1328 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 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,7 +1044,7 @@ func GetInspectionDetail(patientid int64, date int64, orgid int64, projectid int
1044 1044
 	if projectid > 0 {
1045 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 1048
 	return inspection, err
1049 1049
 }
1050 1050
 

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

@@ -11,7 +11,7 @@ INSERT INTO `sgj_xt`.`xt_data_config`(`parent_id`,`module`,`org_id`,`name`,`fiel
11 11
 --显示配置里添加体液过程症状--
12 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 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 17
 --2020-06-19 author 张保健 --