Browse Source

体积小

XMLWAN 3 years ago
parent
commit
e894668ab8

+ 140 - 11
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

@@ -113,10 +113,42 @@ func (this *XcxApiController) GetUserRegister() {
113 113
 			err := service.CreateXcxAdminUser(role)
114 114
 			if err == nil {
115 115
 				mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
116
+				template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
117
+				//处方
118
+				prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
119
+
120
+				//接诊评估
121
+				receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
122
+
123
+				//透前评估
124
+				dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
125
+
126
+				//透析上机
127
+				dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
128
+
129
+				//透析监测
130
+				monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
131
+
132
+				//透后评估
133
+				dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
134
+
135
+				treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
136
+				var configList interface{}
137
+				configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
116 138
 				this.ServeSuccessJSON(map[string]interface{}{
117
-					"role":    role,
118
-					"is_bind": true,
119
-					"patient": mobilePatient,
139
+					"role":                      role,
140
+					"is_bind":                   true,
141
+					"patient":                   mobilePatient,
142
+					"template_id":               template_id,
143
+					"user_org_id":               mobilePatient.UserOrgId,
144
+					"prescripition_config":      prescripition_config,
145
+					"receive_treatement_config": receive_treatement_config,
146
+					"dialysis_befor":            dialysis_befor,
147
+					"dialysis_order":            dialysis_order,
148
+					"monitor_record":            monitor_record,
149
+					"dialysis_after":            dialysis_after,
150
+					"treate_ment":               treate_ment,
151
+					"configList":                configList,
120 152
 				})
121 153
 			} else {
122 154
 				this.ServeSuccessJSON(map[string]interface{}{
@@ -126,9 +158,41 @@ func (this *XcxApiController) GetUserRegister() {
126 158
 			}
127 159
 		} else if errcode == nil {
128 160
 			mobilePatient, _ := service.GetMobilePatient(mobile, id_card_no)
161
+			template_id, _ := service.GetTemplateMode(mobilePatient.UserOrgId)
162
+			//处方
163
+			prescripition_config, _ := service.GetPrescripionFieldConfig(mobilePatient.UserOrgId)
164
+
165
+			//接诊评估
166
+			receive_treatement_config, _ := service.GetReceiveTreatmentAssess(mobilePatient.UserOrgId)
167
+
168
+			//透前评估
169
+			dialysis_befor, _ := service.GetDialysisBefor(mobilePatient.UserOrgId)
170
+
171
+			//透析上机
172
+			dialysis_order, _ := service.GetDialysisOrderConfig(mobilePatient.UserOrgId)
173
+
174
+			//透析监测
175
+			monitor_record, _ := service.GetMonitorRecordConfig(mobilePatient.UserOrgId)
176
+
177
+			//透后评估
178
+			dialysis_after, _ := service.GetDialysisAfeterConfig(mobilePatient.UserOrgId)
179
+
180
+			treate_ment, _ := service.GetTreatMentConfig(mobilePatient.UserOrgId)
181
+			var configList interface{}
182
+			configList, _ = service.GetConfigList(mobilePatient.UserOrgId)
129 183
 			this.ServeSuccessJSON(map[string]interface{}{
130
-				"is_bind": true,
131
-				"patient": mobilePatient,
184
+				"is_bind":                   true,
185
+				"patient":                   mobilePatient,
186
+				"template_id":               template_id,
187
+				"user_org_id":               mobilePatient.UserOrgId,
188
+				"prescripition_config":      prescripition_config,
189
+				"receive_treatement_config": receive_treatement_config,
190
+				"dialysis_befor":            dialysis_befor,
191
+				"dialysis_order":            dialysis_order,
192
+				"monitor_record":            monitor_record,
193
+				"dialysis_after":            dialysis_after,
194
+				"treate_ment":               treate_ment,
195
+				"list":                      configList,
132 196
 			})
133 197
 		}
134 198
 
@@ -173,17 +237,81 @@ func (this *XcxApiController) GetLoginInfor() {
173 237
 	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
174 238
 	if errcodes == gorm.ErrRecordNotFound {
175 239
 		info, _ := service.GetMobilePatientInfo(mobile)
240
+		template_id, _ := service.GetTemplateMode(info.UserOrgId)
241
+		//处方
242
+		prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
243
+
244
+		//接诊评估
245
+		receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
246
+
247
+		//透前评估
248
+		dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
249
+
250
+		//透析上机
251
+		dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
252
+
253
+		//透析监测
254
+		monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
255
+
256
+		//透后评估
257
+		dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
258
+
259
+		treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
260
+		var configList interface{}
261
+		configList, _ = service.GetConfigList(info.UserOrgId)
176 262
 		this.ServeSuccessJSON(map[string]interface{}{
177
-			"patient": info,
178
-			"role":    user_admin,
179
-			"is_bind": false,
263
+			"patient":                   info,
264
+			"template_id":               template_id,
265
+			"user_org_id":               info.UserOrgId,
266
+			"prescripition_config":      prescripition_config,
267
+			"receive_treatement_config": receive_treatement_config,
268
+			"dialysis_befor":            dialysis_befor,
269
+			"dialysis_order":            dialysis_order,
270
+			"monitor_record":            monitor_record,
271
+			"dialysis_after":            dialysis_after,
272
+			"treate_ment":               treate_ment,
273
+			"role":                      user_admin,
274
+			"is_bind":                   false,
275
+			"list":                      configList,
180 276
 		})
181 277
 	} else if errcodes == nil {
182 278
 		info, _ := service.GetPatientListByPatientId(user_admin.PatientId)
279
+		template_id, _ := service.GetTemplateMode(info.UserOrgId)
280
+		//处方
281
+		prescripition_config, _ := service.GetPrescripionFieldConfig(info.UserOrgId)
282
+
283
+		//接诊评估
284
+		receive_treatement_config, _ := service.GetReceiveTreatmentAssess(info.UserOrgId)
285
+
286
+		//透前评估
287
+		dialysis_befor, _ := service.GetDialysisBefor(info.UserOrgId)
288
+
289
+		//透析上机
290
+		dialysis_order, _ := service.GetDialysisOrderConfig(info.UserOrgId)
291
+
292
+		//透析监测
293
+		monitor_record, _ := service.GetMonitorRecordConfig(info.UserOrgId)
294
+
295
+		//透后评估
296
+		dialysis_after, _ := service.GetDialysisAfeterConfig(info.UserOrgId)
297
+
298
+		treate_ment, _ := service.GetTreatMentConfig(info.UserOrgId)
299
+		var configList interface{}
300
+		configList, _ = service.GetConfigList(info.UserOrgId)
183 301
 		this.ServeSuccessJSON(map[string]interface{}{
184
-			"patient": info,
185
-			"role":    user_admin,
186
-			"is_bind": true,
302
+			"patient":                   info,
303
+			"role":                      user_admin,
304
+			"is_bind":                   true,
305
+			"template_id":               template_id,
306
+			"user_org_id":               info.UserOrgId,
307
+			"prescripition_config":      prescripition_config,
308
+			"receive_treatement_config": receive_treatement_config,
309
+			"dialysis_befor":            dialysis_befor,
310
+			"dialysis_order":            dialysis_order,
311
+			"monitor_record":            monitor_record,
312
+			"dialysis_after":            dialysis_after,
313
+			"treate_ment":               treate_ment,
314
+			"list":                      configList,
187 315
 		})
188 316
 	}
189 317
 
@@ -380,6 +508,7 @@ func (this *XcxApiController) GetMobileSchedule() {
380 508
 	time_now := time.Now().Format("2006-01-02")
381 509
 	timeNowUnix, _ := time.ParseInLocation(timeLayout+"15:04:05", time_now+"00:00:00", loc)
382 510
 	fmt.Println("timeNowUnix", timeNowUnix.Unix())
511
+
383 512
 	patient, getPatientErr := service.MobileGetPatientDetail(info.UserOrgId, patientID)
384 513
 	if getPatientErr != nil {
385 514
 		this.ErrorLog("获取患者信息失败:%v", getPatientErr)

+ 9 - 0
models/xcx_user_models.go View File

@@ -527,3 +527,12 @@ type XcxXtDialysisPrescription struct {
527 527
 func (XcxXtDialysisPrescription) TableName() string {
528 528
 	return "xt_dialysis_prescription"
529 529
 }
530
+
531
+type XcxGobalTemplate struct {
532
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
533
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
534
+	TemplateId int64 `gorm:"column:template_id" json:"template_id" form:"template_id"`
535
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
536
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
537
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
538
+}

+ 8 - 1
service/xcx_mobile_api_service.go View File

@@ -143,6 +143,13 @@ func GetMobilePatient(mobile string, idcard string) (*models.XcxPatients, error)
143 143
 
144 144
 }
145 145
 
146
+func GetTemplateMode(orgid int64) (models.XcxGobalTemplate, error) {
147
+
148
+	template := models.XcxGobalTemplate{}
149
+	err := XTReadDB().Model(&template).Where("org_id = ? and status = 1", orgid).Find(&template).Error
150
+	return template, err
151
+}
152
+
146 153
 func GetMobilePatientOne(mobile string) (*models.XcxAdminUserRole, error) {
147 154
 
148 155
 	patient := models.XcxAdminUserRole{}
@@ -263,7 +270,7 @@ func GetNextPatientSchedule(patient_id int64, dialysis_date int64) (models.Blood
263 270
 func GetXcxPatientInfo(patient_id int64) (models.XcxPatients, error) {
264 271
 
265 272
 	patients := models.XcxPatients{}
266
-	err := XTReadDB().Model(&patients).Where("id = ? and status = 1", patient_id).Find(&patients).Error
273
+	err := XTReadDB().Model(&patients).Where("id = ? and status = 1 ", patient_id).Find(&patients).Error
267 274
 	return patients, err
268 275
 }
269 276