|
@@ -1739,8 +1739,8 @@ func (this *NewDialysisApiController) SaveBirthday() {
|
1739
|
1739
|
|
1740
|
1740
|
func (this *NewDialysisApiController) GetOrgName() {
|
1741
|
1741
|
|
1742
|
|
- orgid := this.GetMobileAdminUserInfo().Org.Id
|
1743
|
|
- name, err := service.GetOrgName(orgid)
|
|
1742
|
+ id, _ := this.GetInt64("id")
|
|
1743
|
+ name, err := service.GetOrgName(id)
|
1744
|
1744
|
if err != nil {
|
1745
|
1745
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
1746
|
1746
|
return
|
|
@@ -1938,12 +1938,29 @@ func (this *NewDialysisApiController) GetAllNumber() {
|
1938
|
1938
|
func (this *NewDialysisApiController) DeleteBed() {
|
1939
|
1939
|
id, _ := this.GetInt64("id")
|
1940
|
1940
|
fmt.Println("id", id)
|
1941
|
|
- err := service.DeleteBed(id)
|
1942
|
|
- fmt.Println("删除失败", err)
|
1943
|
|
- returnData := make(map[string]interface{}, 0)
|
1944
|
|
- returnData["msg"] = "删除失败"
|
1945
|
|
- this.ServeSuccessJSON(returnData)
|
1946
|
|
- return
|
|
1941
|
+ nowDateTime := time.Now()
|
|
1942
|
+ nowDate := nowDateTime.Format("2006-01-02")
|
|
1943
|
+ nowDate += " 00:00:00"
|
|
1944
|
+ timeLayout := "2006-01-02"
|
|
1945
|
+ loc, _ := time.LoadLocation("Local")
|
|
1946
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", nowDate, loc)
|
|
1947
|
+ fmt.Println(theTime.Unix())
|
|
1948
|
+ adminInfo := this.GetMobileAdminUserInfo()
|
|
1949
|
+ orgid := adminInfo.Org.Id
|
|
1950
|
+ _, errcode := service.GetSchedu(id, theTime.Unix(), orgid)
|
|
1951
|
+ fmt.Println("errcode ----------------", errcode)
|
|
1952
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1953
|
+ err := service.DeleteBed(id)
|
|
1954
|
+ fmt.Println("删除失败", err)
|
|
1955
|
+ returnData := make(map[string]interface{}, 0)
|
|
1956
|
+ returnData["msg"] = "删除失败"
|
|
1957
|
+ this.ServeSuccessJSON(returnData)
|
|
1958
|
+ return
|
|
1959
|
+ } else if errcode == nil {
|
|
1960
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1961
|
+ return
|
|
1962
|
+ }
|
|
1963
|
+
|
1947
|
1964
|
}
|
1948
|
1965
|
|
1949
|
1966
|
func (this *NewDialysisApiController) LoginOut() {
|
|
@@ -2036,9 +2053,7 @@ func (this *NewDialysisApiController) GetMyOrganazition() {
|
2036
|
2053
|
}
|
2037
|
2054
|
|
2038
|
2055
|
func (this *NewDialysisApiController) GetOrgInformation() {
|
2039
|
|
-
|
2040
|
|
- adminUser := this.GetMobileAdminUserInfo()
|
2041
|
|
- id := adminUser.Org.Id
|
|
2056
|
+ id, _ := this.GetInt64("id")
|
2042
|
2057
|
information, err := service.GetOrgInformation(id)
|
2043
|
2058
|
name, err := service.GetShortName(information.OrgType)
|
2044
|
2059
|
typeName, err := service.GetTypeName(name.Pid)
|
|
@@ -2158,3 +2173,103 @@ func (this *NewDialysisApiController) GetMyInforName() {
|
2158
|
2173
|
"Username": Username,
|
2159
|
2174
|
})
|
2160
|
2175
|
}
|
|
2176
|
+
|
|
2177
|
+func (this *NewDialysisApiController) GetPartionDetail() {
|
|
2178
|
+ id, _ := this.GetInt64("id")
|
|
2179
|
+ partionDetail, err := service.GetPartionDetail(id)
|
|
2180
|
+ if err != nil {
|
|
2181
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2182
|
+ return
|
|
2183
|
+ }
|
|
2184
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2185
|
+ "partionDetail": partionDetail,
|
|
2186
|
+ })
|
|
2187
|
+}
|
|
2188
|
+
|
|
2189
|
+func (this *NewDialysisApiController) UpdatePartition() {
|
|
2190
|
+ id, _ := this.GetInt64("id")
|
|
2191
|
+ name := this.GetString("name")
|
|
2192
|
+ zoneType, _ := this.GetInt64("type")
|
|
2193
|
+ strInt64 := strconv.FormatInt(zoneType, 10)
|
|
2194
|
+ typeid, _ := strconv.Atoi(strInt64)
|
|
2195
|
+ zone := models.DeviceZone{
|
|
2196
|
+ Name: name,
|
|
2197
|
+ Type: typeid,
|
|
2198
|
+ }
|
|
2199
|
+ err := service.UpdatePartition(id, &zone)
|
|
2200
|
+ if err != nil {
|
|
2201
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2202
|
+ return
|
|
2203
|
+ }
|
|
2204
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2205
|
+ "zone": zone,
|
|
2206
|
+ })
|
|
2207
|
+}
|
|
2208
|
+
|
|
2209
|
+func (this *NewDialysisApiController) GetGroupDetail() {
|
|
2210
|
+ id, _ := this.GetInt64("id")
|
|
2211
|
+ groupDetail, err := service.GetGroupDetail(id)
|
|
2212
|
+ if err != nil {
|
|
2213
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2214
|
+ return
|
|
2215
|
+ }
|
|
2216
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2217
|
+ "groupDetail": groupDetail,
|
|
2218
|
+ })
|
|
2219
|
+
|
|
2220
|
+}
|
|
2221
|
+
|
|
2222
|
+func (this *NewDialysisApiController) UpdateGroup() {
|
|
2223
|
+ id, _ := this.GetInt64("id")
|
|
2224
|
+ name := this.GetString("name")
|
|
2225
|
+ group := models.DeviceGroup{Name: name}
|
|
2226
|
+ err := service.UpdateGroup(id, &group)
|
|
2227
|
+ if err != nil {
|
|
2228
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2229
|
+ return
|
|
2230
|
+ }
|
|
2231
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2232
|
+ "group": group,
|
|
2233
|
+ })
|
|
2234
|
+}
|
|
2235
|
+
|
|
2236
|
+func (this *NewDialysisApiController) GetBedDetail() {
|
|
2237
|
+ adminUser := this.GetMobileAdminUserInfo()
|
|
2238
|
+ orgid := adminUser.Org.Id
|
|
2239
|
+ id, _ := this.GetInt64("id")
|
|
2240
|
+ zone, _ := service.GetAllZoneOne(orgid)
|
|
2241
|
+ group, err := service.GetAllGroupOne(orgid)
|
|
2242
|
+ bedDetail, err := service.GetBedDetail(id)
|
|
2243
|
+ if err != nil {
|
|
2244
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2245
|
+ return
|
|
2246
|
+ }
|
|
2247
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2248
|
+ "zone": zone,
|
|
2249
|
+ "group": group,
|
|
2250
|
+ "bedDetail": bedDetail,
|
|
2251
|
+ })
|
|
2252
|
+}
|
|
2253
|
+
|
|
2254
|
+func (this *NewDialysisApiController) UpdatedBed() {
|
|
2255
|
+ id, _ := this.GetInt64("id")
|
|
2256
|
+ name := this.GetString("name")
|
|
2257
|
+ fmt.Println("name", name)
|
|
2258
|
+ zone, _ := this.GetInt64("zone")
|
|
2259
|
+ fmt.Println("zone", zone)
|
|
2260
|
+ group, _ := this.GetInt64("group")
|
|
2261
|
+ fmt.Println("group", group)
|
|
2262
|
+ number := models.DeviceNumber{
|
|
2263
|
+ Number: name,
|
|
2264
|
+ ZoneID: zone,
|
|
2265
|
+ GroupID: group,
|
|
2266
|
+ }
|
|
2267
|
+ err := service.UpdatedBed(id, &number)
|
|
2268
|
+ if err != nil {
|
|
2269
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
2270
|
+ return
|
|
2271
|
+ }
|
|
2272
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
2273
|
+ "number": number,
|
|
2274
|
+ })
|
|
2275
|
+}
|