瀏覽代碼

搜索接口更新

XMLWAN 4 年之前
父節點
當前提交
309c142d14

+ 35 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go 查看文件

@@ -1468,3 +1468,38 @@ func (this *NewDialysisApiController) GetMyInformation() {
1468 1468
 	})
1469 1469
 	return
1470 1470
 }
1471
+
1472
+func (this *NewDialysisApiController) GetPatientName() {
1473
+	id, _ := this.GetInt64("id")
1474
+	patients, _ := service.GetPatientDetailTwo(id)
1475
+	fmt.Print("paitents", patients.ID)
1476
+	patientName, err := service.GetPatientName(patients.BloodId)
1477
+	fmt.Print("err", err)
1478
+	if err != nil {
1479
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1480
+		return
1481
+	}
1482
+	this.ServeSuccessJSON(map[string]interface{}{
1483
+		"patientName": patientName,
1484
+	})
1485
+}
1486
+
1487
+func (this *NewDialysisApiController) GetInspectionDetail() {
1488
+
1489
+	patientid, _ := this.GetInt64("patientid")
1490
+	fmt.Print("patientid", patientid)
1491
+	patients, _ := service.GetPatientDetailTwo(patientid)
1492
+	date, _ := this.GetInt64("date")
1493
+	fmt.Print("date", date)
1494
+	projectid, _ := this.GetInt64("projectid")
1495
+	adminUser := this.GetMobileAdminUserInfo()
1496
+	orgid := adminUser.Org.Id
1497
+	InspectionDetail, err := service.GetInspectionDetail(patients.BloodId, date, orgid, projectid)
1498
+	if err != nil {
1499
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1500
+		return
1501
+	}
1502
+	this.ServeSuccessJSON(map[string]interface{}{
1503
+		"InspectionDetail": InspectionDetail,
1504
+	})
1505
+}

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go 查看文件

@@ -91,4 +91,6 @@ func NewMobileAPIControllersRegisterRouters() {
91 91
 	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
92 92
 	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
93 93
 	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
94
+	beego.Router("/m/api/patient/getpatientname", &NewDialysisApiController{}, "Get:GetPatientName")
95
+	beego.Router("/m/api/patient/getinspectiondetail", &NewDialysisApiController{}, "Get:GetInspectionDetail")
94 96
 }

+ 23 - 1
service/patientmanage_service.go 查看文件

@@ -883,7 +883,7 @@ func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference,
883 883
 }
884 884
 
885 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)
886
+
887 887
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
888 888
 	if patientid > 0 {
889 889
 		db = db.Where("x.patient_id = ?", patientid)
@@ -901,3 +901,25 @@ func GetInspection(patientid int64, startime int64, endtime int64, limit int64,
901 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 902
 	return inspection, total, err
903 903
 }
904
+
905
+func GetInspectionDetail(patientid int64, date int64, orgid int64, projectid int64) (inspection []*models.Inspection, err error) {
906
+
907
+	db := XTReadDB().Table("xt_inspection as x").Where("x.status =1")
908
+
909
+	if patientid > 0 {
910
+		db = db.Where("x.patient_id = ?", patientid)
911
+	}
912
+
913
+	if date > 0 {
914
+		db = db.Where("x.inspect_date = ?", date)
915
+	}
916
+	if orgid > 0 {
917
+
918
+		db = db.Where("x.org_id = ?", orgid)
919
+	}
920
+	if projectid > 0 {
921
+		db = db.Where("x.project_id = ?", projectid)
922
+	}
923
+	err = db.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").Scan(&inspection).Error
924
+	return inspection, err
925
+}