csx пре 3 година
родитељ
комит
c5dc76dc60
1 измењених фајлова са 4 додато и 4 уклоњено
  1. 4 4
      service/his_service.go

+ 4 - 4
service/his_service.go Прегледај датотеку

2
 
2
 
3
 import (
3
 import (
4
 	"XT_New/models"
4
 	"XT_New/models"
5
+	"encoding/json"
5
 	"fmt"
6
 	"fmt"
6
 	"github.com/jinzhu/gorm"
7
 	"github.com/jinzhu/gorm"
8
+	"strconv"
7
 	"strings"
9
 	"strings"
8
 	"time"
10
 	"time"
9
-	"encoding/json"
10
-	"strconv"
11
 )
11
 )
12
 
12
 
13
 type VMSchedule struct {
13
 type VMSchedule struct {
721
 }
721
 }
722
 
722
 
723
 func GetAllDrugLibList(org_id int64) (list []*BaseDrugLib, err error) {
723
 func GetAllDrugLibList(org_id int64) (list []*BaseDrugLib, err error) {
724
-	err = readDb.Model(&BaseDrugLib{}).Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Find(&list).Error
724
+	err = readDb.Model(&BaseDrugLib{}).Preload("OtherDrugWarehouseInfo", "status = 1").Where("org_id = ?  AND status = 1 AND  find_in_set('停用',drug_status) = 0", org_id).Find(&list).Error
725
 	return
725
 	return
726
 }
726
 }
727
 
727
 
1990
 	defer redis.Close()
1990
 	defer redis.Close()
1991
 
1991
 
1992
 	// cur_date := time.Now().Format("2006-01-02")
1992
 	// cur_date := time.Now().Format("2006-01-02")
1993
-	key := strconv.FormatInt(user_org_id, 10) + ":"+ strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(record_time, 10) + ":his_prescription_project"
1993
+	key := strconv.FormatInt(user_org_id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(record_time, 10) + ":his_prescription_project"
1994
 	his_prescription_project_str, _ := redis.Get(key).Result()
1994
 	his_prescription_project_str, _ := redis.Get(key).Result()
1995
 
1995
 
1996
 	if len(his_prescription_project_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
1996
 	if len(his_prescription_project_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis