XMLWAN 4 lat temu
rodzic
commit
273406020f

+ 7 - 8
controllers/mobile_api_controllers/mobile_api_base_controller.go Wyświetl plik

@@ -4,7 +4,6 @@ import (
4 4
 	"XT_New/controllers"
5 5
 	"XT_New/enums"
6 6
 	"XT_New/models"
7
-	"XT_New/service"
8 7
 	"fmt"
9 8
 )
10 9
 
@@ -54,11 +53,11 @@ func (this *MobileBaseAPIAuthController) Prepare() {
54 53
 		this.StopRun()
55 54
 	}
56 55
 
57
-	if this.Ctx.Request.Method != "GET" {
58
-		err := service.GetOrgSubscibeState(adminUserInfo.Subscibe)
59
-		if err != nil || adminUserInfo.Subscibe.State == 3 {
60
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotSubscibe)
61
-			this.StopRun()
62
-		}
63
-	}
56
+	//if this.Ctx.Request.Method != "GET" {
57
+	//	err := service.GetOrgSubscibeState(adminUserInfo.Subscibe)
58
+	//	if err != nil || adminUserInfo.Subscibe.State == 3 {
59
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotSubscibe)
60
+	//		this.StopRun()
61
+	//	}
62
+	//}
64 63
 }

+ 36 - 6
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Wyświetl plik

@@ -187,13 +187,20 @@ func (this *NewDialysisApiController) SavePatient() {
187 187
 		ids = append(ids, id)
188 188
 	}
189 189
 	fmt.Print("传染病2", contagions)
190
+	is_infectious := int64(dataBody["is_infectious"].(float64))
191
+	fmt.Print("传染病", is_infectious)
190 192
 	adminssionNumber := dataBody["admissionNumber"].(string)
191 193
 	fmt.Print("住院号", adminssionNumber)
194
+
192 195
 	fistdate := dataBody["fistDate"].(string)
193 196
 	fmt.Print("首次透析日期", fistdate)
194
-	times, err := utils.ParseTimeStringToTime(timeLayout, fistdate+"00:00:00")
197
+	timeLayouts := "2006-01-02"
198
+	loc, _ := time.LoadLocation("Local")
199
+	times, err := time.ParseInLocation(timeLayouts+" 15:04:05", fistdate+" 00:00:00", loc)
200
+	//times, err := utils.ParseTimeStringToTime(timeLayout, fistdate+"00:00:00")
195 201
 	fisttime := times.Unix()
196 202
 	fmt.Print(fisttime)
203
+
197 204
 	diagonse := dataBody["diagnose"].(string)
198 205
 	fmt.Print("诊断", diagonse)
199 206
 	avatar := dataBody["avatar"].(string)
@@ -225,9 +232,10 @@ func (this *NewDialysisApiController) SavePatient() {
225 232
 	//会员
226 233
 	memberFistDate := dataBody["memberFistDate"].(string)
227 234
 	fmt.Print("首次透析日期", memberFistDate)
228
-	membertimes, err := utils.ParseTimeStringToTime(timeLayout, memberFistDate+"00:00:00")
235
+	//membertimes, err := utils.ParseTimeStringToTime(timeLayout, memberFistDate+"00:00:00")
236
+	membertimes, _ := time.ParseInLocation(timeLayouts+" 15:04:05", memberFistDate+" 00:00:00", loc)
229 237
 	memtime := membertimes.Unix()
230
-	fmt.Print(memtime)
238
+	fmt.Print("会员透析日期", memtime)
231 239
 	patient_type := int64(dataBody["patientType"].(float64))
232 240
 	fmt.Print("病种", patient_type)
233 241
 	treatmentmethod := int64(dataBody["treatmentMethod"].(float64))
@@ -254,6 +262,7 @@ func (this *NewDialysisApiController) SavePatient() {
254 262
 				CreatedTime:       time.Now().Unix(),
255 263
 				Avatar:            avatar,
256 264
 				IdCardNo:          idCard,
265
+				IsInfectious:      is_infectious,
257 266
 			}
258 267
 			err := service.CreateOldPatient(&patients)
259 268
 			fmt.Print("报错", err)
@@ -282,6 +291,8 @@ func (this *NewDialysisApiController) SavePatient() {
282 291
 				BloodPatients:     bloodPatient,
283 292
 				SlowPatients:      slowpatient,
284 293
 				BloodId:           patient.ID,
294
+				IsInfectious:      is_infectious,
295
+				IdCardNo:          idCard,
285 296
 			}
286 297
 			err = service.CreateNewPatient(&patientsNew)
287 298
 			fmt.Print("报错", err)
@@ -300,7 +311,7 @@ func (this *NewDialysisApiController) SavePatient() {
300 311
 		}
301 312
 	}
302 313
 
303
-	fmt.Print("slowpatient----------------", slowpatient)
314
+	fmt.Print("slowpatient", slowpatient)
304 315
 	//如果是慢病病人
305 316
 	if slowpatient == 1 {
306 317
 		_, errcodetwo := service.GetSlowPatientData(phone, orgid)
@@ -349,6 +360,9 @@ func (this *NewDialysisApiController) SavePatient() {
349 360
 					BloodPatients:     bloodPatient,
350 361
 					SlowPatients:      slowpatient,
351 362
 					SlowId:            slowPatient.ID,
363
+					IsInfectious:      is_infectious,
364
+					IdCardNo:          idCard,
365
+					EquitmentId:       requipmentId,
352 366
 				}
353 367
 				err = service.CreateNewPatient(&patientsNew)
354 368
 				if err != nil {
@@ -404,6 +418,11 @@ func (this *NewDialysisApiController) SavePatient() {
404 418
 								BloodPatients:     bloodPatient,
405 419
 								SlowPatients:      slowpatient,
406 420
 								MemberId:          memberPatient.ID,
421
+								IsInfectious:      is_infectious,
422
+								IdCardNo:          idCard,
423
+								MemberFistdate:    memtime,
424
+								MemberPatienttype: patient_type,
425
+								MemberTreatement:  treatmentmethod,
407 426
 							}
408 427
 							err = service.CreateNewPatient(&patientsNew)
409 428
 							fmt.Print("报错-----------------------", err)
@@ -485,6 +504,11 @@ func (this *NewDialysisApiController) SavePatient() {
485 504
 					BloodPatients:     bloodPatient,
486 505
 					SlowPatients:      slowpatient,
487 506
 					MemberId:          memberPatient.ID,
507
+					IsInfectious:      is_infectious,
508
+					IdCardNo:          idCard,
509
+					MemberFistdate:    memtime,
510
+					MemberPatienttype: patient_type,
511
+					MemberTreatement:  treatmentmethod,
488 512
 				}
489 513
 				err = service.CreateNewPatient(&patientsNew)
490 514
 				fmt.Print("报错-----------------------", err)
@@ -517,14 +541,20 @@ func (this *NewDialysisApiController) GetPatientDetail() {
517 541
 	detail, err := service.GetPatientDetailTwo(id)
518 542
 	//获取传染病详情
519 543
 	diseases := service.GetPatientDiseasesTwo(detail.BloodId)
544
+	//获取慢病传染病
545
+	slowDiseases, err := service.GetSlowPatientDiseases(detail.SlowId)
546
+	//获取慢病慢性病
547
+	cronicDiseases, err := service.GetCronicDiseases(detail.SlowId)
520 548
 	//获取血透医嘱管理
521 549
 	if err != nil {
522 550
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
523 551
 		return
524 552
 	}
525 553
 	this.ServeSuccessJSON(map[string]interface{}{
526
-		"patientDetail": detail,
527
-		"diseases":      diseases,
554
+		"patientDetail":  detail,
555
+		"diseases":       diseases,
556
+		"slowDiseases":   slowDiseases,
557
+		"cronicDiseases": cronicDiseases,
528 558
 	})
529 559
 }
530 560
 

+ 34 - 0
models/patient_models.go Wyświetl plik

@@ -479,6 +479,10 @@ type XtPatientsNew struct {
479 479
 	BloodId                      int64   `gorm:"column:blood_id" json:"blood_id" form:"blood_id"`
480 480
 	SlowId                       int64   `gorm:"column:slow_id" json:"slow_id" form:"slow_id"`
481 481
 	MemberId                     int64   `gorm:"column:member_id" json:"member_id" form:"member_id"`
482
+	MemberFistdate               int64   `gorm:"column:member_fistdate" json:"member_fistdate" form:"member_fistdate"`
483
+	MemberPatienttype            int64   `gorm:"column:member_patienttype" json:"member_patienttype" form:"member_patienttype"`
484
+	MemberTreatement             int64   `gorm:"column:member_treatement" json:"member_treatement" form:"member_treatement"`
485
+	EquitmentId                  string  `gorm:"column:equitment_id" json:"equitment_id" form:"equitment_id"`
482 486
 }
483 487
 
484 488
 func (XtPatientsNew) TableName() string {
@@ -535,6 +539,36 @@ func (CdmPatients) TableName() string {
535 539
 	return "xt_patients"
536 540
 }
537 541
 
542
+type CdmPatientsInfectiousDiseases struct {
543
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
544
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
545
+	DiseaseId   int64 `gorm:"column:disease_id" json:"disease_id" form:"disease_id"`
546
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
547
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
548
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
549
+	UserOrgId   int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
550
+}
551
+
552
+func (CdmPatientsInfectiousDiseases) TableName() string {
553
+
554
+	return "xt_patients_infectious_diseases"
555
+}
556
+
557
+type CdmPatientsChronicDiseases struct {
558
+	ID          int64 `gorm:"column:id" json:"id" form:"id"`
559
+	PatientId   int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
560
+	DiseaseId   int64 `gorm:"column:disease_id" json:"disease_id" form:"disease_id"`
561
+	Status      int64 `gorm:"column:status" json:"status" form:"status"`
562
+	CreatedTime int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
563
+	UpdatedTime int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
564
+	UserOrgId   int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
565
+}
566
+
567
+func (CdmPatientsChronicDiseases) TableName() string {
568
+
569
+	return "xt_patients_chronic_diseases"
570
+}
571
+
538 572
 type SgjUserCustomer struct {
539 573
 	ID              int64  `gorm:"column:id" json:"id" form:"id"`
540 574
 	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 31 - 0
service/patientmanage_service.go Wyświetl plik

@@ -249,6 +249,37 @@ func GetPatientDiseasesTwo(id int64) []int64 {
249 249
 	return ids
250 250
 }
251 251
 
252
+func GetSlowPatientDiseases(id int64) (infeciousdisease []*models.CdmPatientsInfectiousDiseases, err error) {
253
+	//var dis  []models.CdmPatientsInfectiousDiseases
254
+	//diseases := models.CdmPatientsChronicDiseases{}
255
+	//ids := make([]int64, 0)
256
+	//err := PatientReadDB().Model(&diseases).Where("patient_id = ? and status =1", id).Find(&ids).Error
257
+	//if err != nil || len(dis) == 0 {
258
+	//  return ids
259
+	//}
260
+	//for _, item := range dis {
261
+	//  ids = append(ids, item.DiseaseId)
262
+	//}
263
+	//return ids
264
+	err = PatientReadDB().Model(&infeciousdisease).Where("patient_id = ? and status =1", id).Find(&infeciousdisease).Error
265
+	return infeciousdisease, err
266
+}
267
+
268
+func GetCronicDiseases(id int64) (chronic []*models.CdmPatientsChronicDiseases, err error) {
269
+	//var dis  []models.CdmPatientsChronicDiseases
270
+	//ids := make([]int64, 0)
271
+	//err := PatientReadDB().Model(&models.CdmPatientsChronicDiseases{}).Where("patient_id = ? and status =1", id).Find(&ids).Error
272
+	//if err != nil || len(dis) == 0 {
273
+	//  return ids
274
+	//}
275
+	//for _, item := range dis {
276
+	//  ids = append(ids, item.DiseaseId)
277
+	//}
278
+	//return ids
279
+	err = PatientReadDB().Model(&chronic).Where("patient_id = ? and status =1", id).Find(&chronic).Error
280
+	return chronic, err
281
+}
282
+
252 283
 func CreatePatientTwo(patient *models.Patients, contagions []int64, diseases []int64) (err error) {
253 284
 
254 285
 	user, _ := GetSgjUserByMobild(patient.Phone)