소스 검색

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx 4 년 전
부모
커밋
01461f321d

+ 2 - 2
controllers/his_project_api_controller.go 파일 보기

@@ -155,9 +155,9 @@ func (this *HisProjectApiController) GetProjectList() {
155 155
 	limit, _ := this.GetInt64("limit")
156 156
 	page, _ := this.GetInt64("page")
157 157
 	is_charge, _ := this.GetInt64("is_charge")
158
-	fmt.Println("is_charge====================", is_charge)
158
+
159 159
 	is_start, _ := this.GetInt64("is_start")
160
-	fmt.Println("is_start--------------------", is_start)
160
+
161 161
 	keyword := this.GetString("keyword")
162 162
 	projecList, total, err := service.GetHisProjectList(orgId, limit, page, is_charge, is_start, keyword)
163 163
 	fmt.Println("err", err)

+ 37 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go 파일 보기

@@ -745,6 +745,43 @@ func (c *CheckWeightApiController) GetPatientListForSchedules() {
745 745
 	})
746 746
 }
747 747
 
748
+func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
749
+	patient_name := c.GetString("patient_name")                   //脉率
750
+	thisTime := time.Now()
751
+	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
752
+	timeLayout := "2006-01-02 15:04:05"
753
+	loc, _ := time.LoadLocation("Local")
754
+	theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
755
+	syncTime := theStartTime.Unix()
756
+	adminUserInfo := c.GetMobileAdminUserInfo()
757
+	if len(patient_name) == 0 {
758
+		patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
759
+	} else {
760
+		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
761
+	}
762
+	patientSchedule := make([]map[string]interface{},0)
763
+	for _, item := range patientList {
764
+		patientTemp := make(map[string]interface{})
765
+		patientTemp["patient_id"] = item.PatientId
766
+		patientTemp["patient_name"] = item.Patient.Name
767
+		patientTemp["schedule_type"] = item.ScheduleType
768
+		patientSchedule = append(patientSchedule, patientTemp)
769
+	}
770
+
771
+	if error != nil {
772
+		c.ErrorLog("获取病人列表失败:%v", error)
773
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
774
+		return
775
+	}
776
+	serviceTime := time.Now().Unix()
777
+	c.ServeSuccessJSON(map[string]interface{}{
778
+		"patientlist": patientSchedule,
779
+		"total":       total,
780
+		"servicetime": serviceTime,
781
+	})
782
+}
783
+
784
+
748 785
 
749 786
 func (c *CheckWeightApiController) GetPatientListById() {
750 787
 	patientId, _ := c.GetInt64("patient_id", 0)

+ 3 - 3
service/his_project_service.go 파일 보기

@@ -28,7 +28,7 @@ func CreateHisProject(project *models.XtHisProject) error {
28 28
 	return err
29 29
 }
30 30
 
31
-func GetHisProjectList(orgid int64, limit int64, page int64, start int64, charge int64, keyword string) (hisproject []*models.XtHisProject, total int64, err error) {
31
+func GetHisProjectList(orgid int64, limit int64, page int64, charge int64, start int64, keyword string) (hisproject []*models.XtHisProject, total int64, err error) {
32 32
 	offset := (page - 1) * limit
33 33
 	likeKey := "%" + keyword + "%"
34 34
 	db := XTReadDB().Table("xt_his_project as x").Where("x.status = 1")
@@ -36,10 +36,10 @@ func GetHisProjectList(orgid int64, limit int64, page int64, start int64, charge
36 36
 		db = db.Where("x.user_org_id = ?", orgid)
37 37
 	}
38 38
 	if start > 0 {
39
-		db = db.Where("x.medical_status = ?", charge)
39
+		db = db.Where("x.medical_status = ?", start)
40 40
 	}
41 41
 	if charge > 0 {
42
-		db = db.Where("x.is_charge = ? ", start)
42
+		db = db.Where("x.is_estimate = ? ", charge)
43 43
 	}
44 44
 	if len(keyword) > 0 {
45 45
 		db = db.Where("x.project_name like ?", likeKey)

+ 6 - 0
service/patient_service.go 파일 보기

@@ -95,6 +95,12 @@ func GetPatientListBySchedules(orgID int64, syncTime int64) (patients []*models.
95 95
 	return
96 96
 }
97 97
 
98
+func GetPatientListBySchedulesFind(orgID int64, syncTime int64,patient_name string) (patients []*models.SchedulePatients, total int64, err error) {
99
+	db := readDb.Model(&models.SchedulePatients{}).Where("user_org_id=?  AND  status=1  AND  schedule_date = ?", orgID,syncTime).Preload("Patient", "status = 1 AND user_org_id = ? and name like '%?%' ", orgID,patient_name)
100
+	err = db.Count(&total).Find(&patients).Error
101
+	return
102
+}
103
+
98 104
 func GetPatientListById(orgID int64, patientId int64) (patients models.PatientListForFace, err error) {
99 105
 	err = readDb.Model(&models.PatientListForFaceList{}).Where("user_org_id=? and id = ? and status=1", orgID, patientId).First(&patients).Error
100 106
 	return