XMLWAN 2 лет назад
Родитель
Сommit
d750eff6b1

+ 63 - 15
controllers/mobile_api_controllers/dialysis_api_controller.go Просмотреть файл

@@ -88,7 +88,7 @@ func (this *DialysisAPIController) Scheduals() {
88 88
 
89 89
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
90 90
 	scheduals_json_str, _ := redis.Get(key).Result()
91
-	redis.Set(scheduals_json_str, "", time.Second)
91
+	redis.Set(key, "", time.Second)
92 92
 	patients, _ := service.GetAllPatientListSix(orgID)
93 93
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
94 94
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
@@ -782,20 +782,27 @@ func (c *DialysisAPIController) PostDoubleCheck() {
782 782
 	if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10340 {
783 783
 
784 784
 		list, _ := service.GetRoleList(adminUserInfo.Org.Id, modifier)
785
-		if employee_number != list.JobNumber {
786
-			_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
787
-			c.ServeSuccessJSON(map[string]interface{}{
788
-				"doubleCheck": check,
789
-				"msg":         "2",
790
-			})
791
-			return
785
+		_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
786
+		if check.ID == 0 {
787
+			if employee_number != list.JobNumber {
788
+				c.ServeSuccessJSON(map[string]interface{}{
789
+					"doubleCheck": check,
790
+					"msg":         "2",
791
+				})
792
+				return
793
+			}
794
+		}
795
+		if check.ID > 0 {
796
+			if employee_number != list.JobNumber {
797
+				c.ServeSuccessJSON(map[string]interface{}{
798
+					"doubleCheck": check,
799
+					"msg":         "2",
800
+				})
801
+				return
802
+			}
792 803
 		}
793
-	}
794 804
 
795
-	//now := time.Now()
796
-	//year, month, day := now.Date()
797
-	//today_time := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
798
-	//todayTimeStamp := today_time.Unix()
805
+	}
799 806
 
800 807
 	doubleCheck := models.DoubleCheck{
801 808
 		UserOrgId:                  adminUserInfo.Org.Id,
@@ -7020,13 +7027,13 @@ func (this *DialysisAPIController) GetDialysisRecordOrder() {
7020 7027
 func (this *DialysisAPIController) GetScheduleTypeByIdList() {
7021 7028
 
7022 7029
 	org_id := this.GetMobileAdminUserInfo().Org.Id
7023
-	fmt.Println("org_id23323322332323233232", org_id)
7030
+
7024 7031
 	schedule_date := this.GetString("schedule_date")
7025 7032
 	schedule_type, _ := this.GetInt64("schedule_type")
7026 7033
 	timeLayout := "2006-01-02"
7027 7034
 	loc, _ := time.LoadLocation("Local")
7028 7035
 	var startdateunix int64
7029
-	fmt.Println("schedule_date23323232233232323232", schedule_date)
7036
+
7030 7037
 	if len(schedule_date) > 0 {
7031 7038
 		theTime, err := time.ParseInLocation(timeLayout+"15:04:05", schedule_date+"00:00:00", loc)
7032 7039
 		if err != nil {
@@ -7054,3 +7061,44 @@ func (this *DialysisAPIController) GetScheduleTypeByIdList() {
7054 7061
 		"scheduals": scheduals,
7055 7062
 	})
7056 7063
 }
7064
+
7065
+func (this *DialysisAPIController) SavePatientPicture() {
7066
+
7067
+	patient_id, _ := this.GetInt64("patient_id")
7068
+	dialysis_date, _ := this.GetInt64("schedule_date")
7069
+	avatar := this.GetString("avatar")
7070
+	fmt.Println("patient_id", patient_id)
7071
+	orgId := this.GetMobileAdminUserInfo().Org.Id
7072
+
7073
+	order := models.DialysisOrder{
7074
+		Url: avatar,
7075
+	}
7076
+	err := service.UpdatePatientSign(patient_id, dialysis_date, order, orgId)
7077
+	redis := service.RedisClient()
7078
+
7079
+	key := strconv.FormatInt(orgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(dialysis_date, 10) + ":dialysis_order"
7080
+	redis.Set(key, "", time.Second)
7081
+	keyOne := strconv.FormatInt(orgId, 10) + ":" + strconv.FormatInt(dialysis_date, 10) + ":dialysis_orders_list_all"
7082
+	//清空key 值
7083
+	redis.Set(keyOne, "", time.Second)
7084
+	keyThree := strconv.FormatInt(orgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(dialysis_date, 10) + ":doctor_advices"
7085
+	redis.Set(keyThree, "", time.Second)
7086
+	keyFour := strconv.FormatInt(orgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(dialysis_date, 10) + ":monitor_records"
7087
+	redis.Set(keyFour, "", time.Second)
7088
+
7089
+	keyFive := strconv.FormatInt(orgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":patient_info"
7090
+	redis.Set(keyFive, "", time.Second)
7091
+
7092
+	keySix := strconv.FormatInt(orgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(dialysis_date, 10) + ":his_doctor_advice"
7093
+	redis.Set(keySix, "", time.Second)
7094
+
7095
+	keySeven := strconv.FormatInt(orgId, 10) + ":" + ":device_list_all"
7096
+	redis.Set(keySeven, "", time.Second)
7097
+	if err != nil {
7098
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
7099
+		return
7100
+	}
7101
+	this.ServeSuccessJSON(map[string]interface{}{
7102
+		"order": order,
7103
+	})
7104
+}

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Просмотреть файл

@@ -175,4 +175,6 @@ func MobileAPIControllersRegisterRouters() {
175 175
 	beego.Router("/m/api/getdialysisrecordeorder", &DialysisAPIController{}, "Get:GetDialysisRecordOrder")
176 176
 
177 177
 	beego.Router("/m/api/getscheduletypebyidlist", &DialysisAPIController{}, "Get:GetScheduleTypeByIdList")
178
+
179
+	beego.Router("/m/api/savepatientpicture", &DialysisAPIController{}, "Get:SavePatientPicture")
178 180
 }

+ 1 - 0
models/patient_models.go Просмотреть файл

@@ -1604,6 +1604,7 @@ type XtScheduleList struct {
1604 1604
 	ScheduleType     int64              `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
1605 1605
 	ScheduleWeek     int64              `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
1606 1606
 	ModeId           int64              `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
1607
+	IsExport         int64              `gorm:"column:is_export" json:"is_export" form:"is_export"`
1607 1608
 	DialysisSolution VmDialysisSolution `gorm:"ForeignKey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId" json:"vmsolution"`
1608 1609
 }
1609 1610
 

+ 1 - 1
service/doctor_schedule_service.go Просмотреть файл

@@ -600,7 +600,7 @@ func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int
600 600
 	err = db.Preload("DeviceZone", " status= 1").Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
601 601
 		return XTReadDB().Model(&models.DeviceNumber{}).Where("status = 1 AND org_id = ?", orgid).Order("sort asc")
602 602
 	}).Preload("DialysisOrderTwenty", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id and p.lapseto = 1 and p.user_org_id =?", orgid).Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
603
-		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id,p.name as patient").Find(&schedule).Error
603
+		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id,s.is_export,p.name as patient").Find(&schedule).Error
604 604
 	return schedule, err
605 605
 }
606 606