|
@@ -13,11 +13,10 @@ import (
|
13
|
13
|
"net/http"
|
14
|
14
|
"net/url"
|
15
|
15
|
"strconv"
|
16
|
|
- _ "strings"
|
|
16
|
+ _"strings"
|
17
|
17
|
|
18
|
18
|
// "fmt"
|
19
|
19
|
_ "reflect"
|
20
|
|
- _ "strconv"
|
21
|
20
|
"time"
|
22
|
21
|
)
|
23
|
22
|
|
|
@@ -696,11 +695,44 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
|
696
|
695
|
}
|
697
|
696
|
}
|
698
|
697
|
}
|
|
698
|
+
|
|
699
|
+func (c *CheckWeightApiController) SetSyncTime(){
|
|
700
|
+ sn := c.GetString("sn")
|
|
701
|
+ if len(sn) > 0 {
|
|
702
|
+ redis := service.RedisClient()
|
|
703
|
+ defer redis.Close()
|
|
704
|
+ redis.Set(sn, 0,0)
|
|
705
|
+ }
|
|
706
|
+ serviceTime := time.Now().Unix()
|
|
707
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
708
|
+ "status": 1,
|
|
709
|
+ "servicetime": serviceTime,
|
|
710
|
+ })
|
|
711
|
+}
|
|
712
|
+
|
699
|
713
|
func (c *CheckWeightApiController) GetPatientList() {
|
700
|
|
- syncTime, _ := c.GetInt64("synctime", 0)
|
701
|
|
- force, _ := c.GetInt64("force", 0)
|
|
714
|
+ ftype,_ := c.GetInt64("type",0)
|
|
715
|
+ sn := c.GetString("sn")
|
|
716
|
+ syncTime := int64(0)
|
|
717
|
+
|
|
718
|
+ redis := service.RedisClient()
|
|
719
|
+ defer redis.Close()
|
|
720
|
+ if len(sn) > 0 {
|
|
721
|
+ syncTimeStr, _ := redis.Get(sn).Result()
|
|
722
|
+ syncTime,_ = strconv.ParseInt(syncTimeStr, 10, 64)
|
|
723
|
+ }
|
|
724
|
+
|
|
725
|
+ if ftype == 1 {
|
|
726
|
+ timeNow := time.Now().Unix()
|
|
727
|
+ redis.Set(sn, timeNow,0)
|
|
728
|
+ }
|
|
729
|
+
|
702
|
730
|
adminUserInfo := c.GetMobileAdminUserInfo()
|
703
|
|
- patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id, syncTime, force)
|
|
731
|
+ need_update := 0
|
|
732
|
+ patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id, int64(syncTime))
|
|
733
|
+ if len(patientList) > 0 {
|
|
734
|
+ need_update = 1
|
|
735
|
+ }
|
704
|
736
|
if error != nil {
|
705
|
737
|
c.ErrorLog("获取病人列表失败:%v", error)
|
706
|
738
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -708,6 +740,7 @@ func (c *CheckWeightApiController) GetPatientList() {
|
708
|
740
|
}
|
709
|
741
|
serviceTime := time.Now().Unix()
|
710
|
742
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
743
|
+ "need_update" : need_update,
|
711
|
744
|
"patientlist": patientList,
|
712
|
745
|
"total": total,
|
713
|
746
|
"servicetime": serviceTime,
|