소스 검색

提交代码

陈少旭 1 년 전
부모
커밋
48a129e45c
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 7
      service/his_service.go

+ 9 - 7
service/his_service.go 파일 보기

@@ -2137,16 +2137,16 @@ func (NewTempPatients) TableName() string {
2137 2137
 
2138 2138
 func GetNewAllUnChargeHisPatientList(org_id int64, keywords string, record_date int64, sch_type int64) (patients []*NewTempPatients, err error) {
2139 2139
 	db := readDb.Model(&NewTempPatients{})
2140
-	//if sch_type > 0 {
2141
-	//	db = db.Joins("join xt_schedule as sch on sch.patient_id = xt_patients.id and sch.schedule_date = ? and sch.schedule_type = ?", record_date, sch_type)
2142
-	//}
2140
+	if sch_type > 0 {
2141
+		db = db.Joins("join xt_schedule as sch on sch.patient_id = xt_patients.id and sch.schedule_date = ? and sch.schedule_type = ? and sch.status = 1", record_date, sch_type)
2142
+	}
2143 2143
 	db = db.Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
2144 2144
 	db = db.Preload("Schedule", "status = 1")
2145 2145
 	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
2146 2146
 		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ?", org_id, record_date)
2147 2147
 	})
2148 2148
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND order_status <> 2 AND order_status <> 3", org_id, record_date)
2149
-	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Error
2149
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Group("xt_patients.id").Error
2150 2150
 
2151 2151
 	for _, item := range patients {
2152 2152
 		for _, sumItem := range item.HisPatient {
@@ -2163,9 +2163,11 @@ func GetNewAllUnChargeHisPatientList(org_id int64, keywords string, record_date
2163 2163
 func GetNewAllChargeHisPatientList(org_id int64, keywords string, record_date int64, sch_type int64) (patients []*NewTempPatients, err error) {
2164 2164
 	db := readDb.Model(&NewTempPatients{})
2165 2165
 
2166
-	//if sch_type > 0 {
2167
-	//	db = db.Joins("join xt_schedule as sch on sch.patient_id = xt_patients.id and sch.schedule_date = ? and sch.schedule_type = ?", record_date, sch_type)
2168
-	//}
2166
+	fmt.Println("sch_type")
2167
+	fmt.Println(sch_type)
2168
+	if sch_type > 0 {
2169
+		db = db.Joins("join xt_schedule as sch on sch.patient_id = xt_patients.id and sch.schedule_date = ? and sch.schedule_type = ?  and sch.status = 1", record_date, sch_type)
2170
+	}
2169 2171
 	db = db.Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
2170 2172
 	db = db.Preload("Schedule", "status = 1")
2171 2173
 	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {