Ver código fonte

搜索接口更新

XMLWAN 4 anos atrás
pai
commit
13374852e7

+ 60 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Ver arquivo

@@ -1113,14 +1113,14 @@ func (this *NewDialysisApiController) GetDoctorAdviceDetail() {
1113 1113
 	appid := adminUser.App.Id
1114 1114
 	id, _ := this.GetInt64("id")
1115 1115
 	doctorAdvicedetail, err := service.GetDoctorAdviceDetail(id, orgid)
1116
-	doctor, err := service.GetAllDoctorTwo(orgid, appid)
1116
+	doctorDetail, err := service.GetAllDoctorTwo(orgid, appid)
1117 1117
 	if err != nil {
1118 1118
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1119 1119
 		return
1120 1120
 	}
1121 1121
 	this.ServeSuccessJSON(map[string]interface{}{
1122 1122
 		"doctorAdvicedetail": doctorAdvicedetail,
1123
-		"doctor":             doctor,
1123
+		"doctorDetail":       doctorDetail,
1124 1124
 	})
1125 1125
 }
1126 1126
 
@@ -1396,3 +1396,61 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1396 1396
 		})
1397 1397
 	}
1398 1398
 }
1399
+
1400
+func (this *NewDialysisApiController) GetAllDoctor() {
1401
+	orgid := this.GetMobileAdminUserInfo().Org.Id
1402
+	id := this.GetMobileAdminUserInfo().App.Id
1403
+	doctor, err := service.GetAllDoctorTwo(orgid, id)
1404
+	if err != nil {
1405
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1406
+		return
1407
+	}
1408
+	this.ServeSuccessJSON(map[string]interface{}{
1409
+		"doctor": doctor,
1410
+	})
1411
+}
1412
+
1413
+func (this *NewDialysisApiController) GetAllInspection() {
1414
+
1415
+	inspection, err := service.GetAllInspection(0)
1416
+	if err != nil {
1417
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1418
+		return
1419
+	}
1420
+	this.ServeSuccessJSON(map[string]interface{}{
1421
+		"inspection": inspection,
1422
+	})
1423
+}
1424
+
1425
+func (this *NewDialysisApiController) GetInspection() {
1426
+	timeLayout := "2006-01-02"
1427
+	loc, _ := time.LoadLocation("Local")
1428
+	id, _ := this.GetInt64("id")
1429
+	fmt.Print("id", id)
1430
+	patient, _ := service.GetPatientDetailTwo(id)
1431
+	start := this.GetString("startime")
1432
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
1433
+	startime := startTimes.Unix()
1434
+	fmt.Print("startime", startime)
1435
+	end := this.GetString("endtime")
1436
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
1437
+	endtime := endTimes.Unix()
1438
+	fmt.Print("endtime", endtime)
1439
+	limit, _ := this.GetInt64("limit")
1440
+	fmt.Print("limit", limit)
1441
+	page, _ := this.GetInt64("page")
1442
+	fmt.Print("page", page)
1443
+	adminInfo := this.GetMobileAdminUserInfo()
1444
+	orgid := adminInfo.Org.Id
1445
+	fmt.Print("patient", patient)
1446
+	fmt.Print("orgid", orgid)
1447
+	inspection, total, err := service.GetInspection(patient.BloodId, startime, endtime, limit, page, orgid)
1448
+	if err != nil {
1449
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1450
+		return
1451
+	}
1452
+	this.ServeSuccessJSON(map[string]interface{}{
1453
+		"inspection": inspection,
1454
+		"total":      total,
1455
+	})
1456
+}

+ 3 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Ver arquivo

@@ -71,5 +71,8 @@ func NewMobileAPIControllersRegisterRouters() {
71 71
 	beego.Router("/m/api/patient/getdoctoradvicedetail", &NewDialysisApiController{}, "Get:GetDoctorAdviceDetail")
72 72
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
73 73
 	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
74
+	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
75
+	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
76
+	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
74 77
 
75 78
 }

+ 20 - 0
models/dialysis.go Ver arquivo

@@ -800,3 +800,23 @@ type GobalTemplate struct {
800 800
 func (GobalTemplate) TableName() string {
801 801
 	return "xt_gobal_template"
802 802
 }
803
+
804
+type SgjUserAdminRole struct {
805
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
806
+	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
807
+	OrgId       int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
808
+	AppId       int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
809
+	RoleId      int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
810
+	UserName    string `gorm:"column:user_name" json:"user_name" form:"user_name"`
811
+	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
812
+	UserType    int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
813
+	UserTitle   int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
814
+	Intro       string `gorm:"column:intro" json:"intro" form:"intro"`
815
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
816
+	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
817
+	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
818
+}
819
+
820
+func (SgjUserAdminRole) TableName() string {
821
+	return "sgj_user_admin_role"
822
+}

+ 47 - 0
models/patient_models.go Ver arquivo

@@ -663,3 +663,50 @@ func (XtPatientsInfectiousDiseases) TableName() string {
663 663
 
664 664
 	return "xt_patients_infectious_diseases"
665 665
 }
666
+
667
+type XtInspectionReference struct {
668
+	ID               int64  `gorm:"column:id" json:"id" form:"id"`
669
+	OrgId            int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
670
+	ProjectName      string `gorm:"column:project_name" json:"project_name" form:"project_name"`
671
+	Project          string `gorm:"column:project" json:"project" form:"project"`
672
+	ProjectId        int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
673
+	ItemName         string `gorm:"column:item_name" json:"item_name" form:"item_name"`
674
+	ItemNameAddition string `gorm:"column:item_name_addition" json:"item_name_addition" form:"item_name_addition"`
675
+	ItemId           int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
676
+	Item             string `gorm:"column:item" json:"item" form:"item"`
677
+	RangeType        int64  `gorm:"column:range_type" json:"range_type" form:"range_type"`
678
+	RangeMin         string `gorm:"column:range_min" json:"range_min" form:"range_min"`
679
+	RangeMax         string `gorm:"column:range_max" json:"range_max" form:"range_max"`
680
+	RangeValue       string `gorm:"column:range_value" json:"range_value" form:"range_value"`
681
+	RangeOptions     string `gorm:"column:range_options" json:"range_options" form:"range_options"`
682
+	Unit             string `gorm:"column:unit" json:"unit" form:"unit"`
683
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
684
+	CreatedTime      int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
685
+	UpdatedTime      int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
686
+}
687
+
688
+func (XtInspectionReference) TableName() string {
689
+
690
+	return "xt_inspection_reference"
691
+}
692
+
693
+type XtInspection struct {
694
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
695
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
696
+	OrgId        int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
697
+	ProjectId    int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
698
+	ItemId       int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
699
+	ItemName     string `gorm:"column:item_name" json:"item_name" form:"item_name"`
700
+	ProjectName  string `gorm:"column:project_name" json:"project_name" form:"project_name"`
701
+	InspectType  int64  `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
702
+	InspectValue string `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
703
+	InspectDate  int64  `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
704
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
705
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
706
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
707
+}
708
+
709
+func (XtInspection) TableName() string {
710
+
711
+	return "xt_inspection"
712
+}

+ 28 - 2
service/patientmanage_service.go Ver arquivo

@@ -824,9 +824,9 @@ func GetDialysisrecord(patientID int64, start int64, end int64, limit int64, pag
824 824
 	return orders, total, err
825 825
 }
826 826
 
827
-func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.App_Role, err error) {
827
+func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.SgjUserAdminRole, err error) {
828 828
 
829
-	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = ? ", orgid, appid, 1).Find(&appRole).Error
829
+	err = UserReadDB().Where("org_id = ? and app_id = ? and status = ? ", orgid, appid, 1).Find(&appRole).Error
830 830
 	return appRole, err
831 831
 }
832 832
 
@@ -875,3 +875,29 @@ func UpdatedCustomer(customer models.SgjUserCustomer, id int64) error {
875 875
 	err := UserWriteDB().Model(&customer).Where("id = ?", id).Update(map[string]interface{}{"name": customer.Name, "mobile": customer.Mobile, "gender": customer.Gender, "birthday": customer.Birthday, "ill_date": customer.IllDate, "avatar": customer.Avatar, "illness_id": customer.IllnessId, "treat_type": customer.TreatType}).Error
876 876
 	return err
877 877
 }
878
+
879
+func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
880
+
881
+	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
882
+	return inspection, err
883
+}
884
+
885
+func GetInspection(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (inspection []*models.Inspection, total int64, err error) {
886
+	fmt.Print(limit, page)
887
+	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
888
+	if patientid > 0 {
889
+		db = db.Where("x.patient_id = ?", patientid)
890
+	}
891
+	if startime > 0 {
892
+		db = db.Where("x.inspect_date >= ?", startime)
893
+	}
894
+	if endtime > 0 {
895
+		db = db.Where("x.inspect_date<=?", endtime)
896
+	}
897
+	if orgid > 0 {
898
+		db = db.Where("x.org_id = ?", orgid)
899
+	}
900
+	err = db.Count(&total).Order("x.inspect_date").Group("x.id").
901
+		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.created_time").Find(&inspection).Error
902
+	return inspection, total, err
903
+}