|
@@ -1713,7 +1713,6 @@ func (this *NewDialysisApiController) SaveBirthday() {
|
1713
|
1713
|
timeLayout := "2006-01-02 15:04:05"
|
1714
|
1714
|
theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
|
1715
|
1715
|
birth := theTime.Unix()
|
1716
|
|
- fmt.Print("-----======", birth)
|
1717
|
1716
|
role := models.App_Role{
|
1718
|
1717
|
Birthday: birth,
|
1719
|
1718
|
}
|
|
@@ -1758,3 +1757,180 @@ func (this *NewDialysisApiController) GetRoleName() {
|
1758
|
1757
|
"positionName": positionName,
|
1759
|
1758
|
})
|
1760
|
1759
|
}
|
|
1760
|
+
|
|
1761
|
+func (this *NewDialysisApiController) SavePartition() {
|
|
1762
|
+ adminInfo := this.GetMobileAdminUserInfo()
|
|
1763
|
+ name := this.GetString("name")
|
|
1764
|
+ fmt.Println("分区名称", name)
|
|
1765
|
+ zonetype, _ := this.GetInt64("type")
|
|
1766
|
+ fmt.Println("分区型号", zonetype)
|
|
1767
|
+ strInt64 := strconv.FormatInt(zonetype, 10)
|
|
1768
|
+ typeid, _ := strconv.Atoi(strInt64)
|
|
1769
|
+ zone := models.DeviceZone{
|
|
1770
|
+ Name: name,
|
|
1771
|
+ Type: typeid,
|
|
1772
|
+ OrgID: adminInfo.Org.Id,
|
|
1773
|
+ Status: 1,
|
|
1774
|
+ CreateTime: time.Now().Unix(),
|
|
1775
|
+ }
|
|
1776
|
+ err := service.CreatedZone(&zone)
|
|
1777
|
+ if err != nil {
|
|
1778
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1779
|
+ return
|
|
1780
|
+ }
|
|
1781
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1782
|
+ "zone": zone,
|
|
1783
|
+ })
|
|
1784
|
+}
|
|
1785
|
+
|
|
1786
|
+func (this *NewDialysisApiController) GetAllZone() {
|
|
1787
|
+
|
|
1788
|
+ adminUser := this.GetMobileAdminUserInfo()
|
|
1789
|
+ orgid := adminUser.Org.Id
|
|
1790
|
+ page, _ := this.GetInt64("page")
|
|
1791
|
+ limit, _ := this.GetInt64("limit")
|
|
1792
|
+ zone, total, err := service.GetAllZone(orgid, page, limit)
|
|
1793
|
+ if err != nil {
|
|
1794
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1795
|
+ return
|
|
1796
|
+ }
|
|
1797
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1798
|
+ "zone": zone,
|
|
1799
|
+ "total": total,
|
|
1800
|
+ })
|
|
1801
|
+}
|
|
1802
|
+
|
|
1803
|
+func (this *NewDialysisApiController) DeleteZone() {
|
|
1804
|
+ id, _ := this.GetInt64("id")
|
|
1805
|
+ err := service.DeleteZoneById(id)
|
|
1806
|
+ fmt.Println("删除失败", err)
|
|
1807
|
+ returnData := make(map[string]interface{}, 0)
|
|
1808
|
+ returnData["msg"] = "删除失败"
|
|
1809
|
+ this.ServeSuccessJSON(returnData)
|
|
1810
|
+ return
|
|
1811
|
+}
|
|
1812
|
+
|
|
1813
|
+func (this *NewDialysisApiController) SaveGroup() {
|
|
1814
|
+ adminUser := this.GetMobileAdminUserInfo()
|
|
1815
|
+ orgid := adminUser.Org.Id
|
|
1816
|
+ name := this.GetString("name")
|
|
1817
|
+ fmt.Println("name", name)
|
|
1818
|
+ group := models.DeviceGroup{
|
|
1819
|
+ Name: name,
|
|
1820
|
+ Status: 1,
|
|
1821
|
+ CreateTime: time.Now().Unix(),
|
|
1822
|
+ OrgID: orgid,
|
|
1823
|
+ }
|
|
1824
|
+ err := service.SaveGroup(&group)
|
|
1825
|
+ if err != nil {
|
|
1826
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1827
|
+ return
|
|
1828
|
+ }
|
|
1829
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1830
|
+ "group": group,
|
|
1831
|
+ })
|
|
1832
|
+}
|
|
1833
|
+
|
|
1834
|
+func (this *NewDialysisApiController) GetAllGroup() {
|
|
1835
|
+ adminUser := this.GetMobileAdminUserInfo()
|
|
1836
|
+ orgid := adminUser.Org.Id
|
|
1837
|
+ page, _ := this.GetInt64("page")
|
|
1838
|
+ fmt.Println("page", page)
|
|
1839
|
+ limit, _ := this.GetInt64("limit")
|
|
1840
|
+ fmt.Println("limit", limit)
|
|
1841
|
+ group, total, err := service.GetAllGroup(orgid, page, limit)
|
|
1842
|
+ if err != nil {
|
|
1843
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1844
|
+ return
|
|
1845
|
+ }
|
|
1846
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1847
|
+ "group": group,
|
|
1848
|
+ "total": total,
|
|
1849
|
+ })
|
|
1850
|
+}
|
|
1851
|
+
|
|
1852
|
+func (this *NewDialysisApiController) DeleteGroup() {
|
|
1853
|
+ id, _ := this.GetInt64("id")
|
|
1854
|
+ fmt.Println("id", id)
|
|
1855
|
+ err := service.DeleteGroup(id)
|
|
1856
|
+ fmt.Println("删除失败", err)
|
|
1857
|
+ returnData := make(map[string]interface{}, 0)
|
|
1858
|
+ returnData["msg"] = "删除失败"
|
|
1859
|
+ this.ServeSuccessJSON(returnData)
|
|
1860
|
+ return
|
|
1861
|
+}
|
|
1862
|
+
|
|
1863
|
+func (this *NewDialysisApiController) GetAllGroupOne() {
|
|
1864
|
+ admininfo := this.GetMobileAdminUserInfo()
|
|
1865
|
+ orgid := admininfo.Org.Id
|
|
1866
|
+ zone, _ := service.GetAllZoneOne(orgid)
|
|
1867
|
+ group, err := service.GetAllGroupOne(orgid)
|
|
1868
|
+ if err != nil {
|
|
1869
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1870
|
+ return
|
|
1871
|
+ }
|
|
1872
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1873
|
+ "zone": zone,
|
|
1874
|
+ "group": group,
|
|
1875
|
+ })
|
|
1876
|
+}
|
|
1877
|
+
|
|
1878
|
+func (this *NewDialysisApiController) SaveBed() {
|
|
1879
|
+ adminuser := this.GetMobileAdminUserInfo()
|
|
1880
|
+ orgid := adminuser.Org.Id
|
|
1881
|
+ name := this.GetString("name")
|
|
1882
|
+ fmt.Println("name", name)
|
|
1883
|
+ zone, _ := this.GetInt64("zone")
|
|
1884
|
+ fmt.Print("zone", zone)
|
|
1885
|
+ group, _ := this.GetInt64("group")
|
|
1886
|
+ fmt.Println("group", group)
|
|
1887
|
+ number := models.DeviceNumber{
|
|
1888
|
+ Number: name,
|
|
1889
|
+ ZoneID: zone,
|
|
1890
|
+ GroupID: group,
|
|
1891
|
+ OrgID: orgid,
|
|
1892
|
+ Status: 1,
|
|
1893
|
+ CreateTime: time.Now().Unix(),
|
|
1894
|
+ }
|
|
1895
|
+ err := service.CreateNumber(&number)
|
|
1896
|
+ if err != nil {
|
|
1897
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1898
|
+ return
|
|
1899
|
+ }
|
|
1900
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1901
|
+ "number": number,
|
|
1902
|
+ })
|
|
1903
|
+}
|
|
1904
|
+
|
|
1905
|
+func (this *NewDialysisApiController) GetAllNumber() {
|
|
1906
|
+ admininfo := this.GetMobileAdminUserInfo()
|
|
1907
|
+ orgid := admininfo.Org.Id
|
|
1908
|
+ page, _ := this.GetInt64("page")
|
|
1909
|
+ fmt.Print("page", page)
|
|
1910
|
+ limit, _ := this.GetInt64("limit")
|
|
1911
|
+ fmt.Println("limit", limit)
|
|
1912
|
+ number, total, err := service.GetAllNumber(page, limit, orgid)
|
|
1913
|
+ zone, _ := service.GetAllZoneOne(orgid)
|
|
1914
|
+ group, _ := service.GetAllGroupOne(orgid)
|
|
1915
|
+ if err != nil {
|
|
1916
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
1917
|
+ return
|
|
1918
|
+ }
|
|
1919
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1920
|
+ "number": number,
|
|
1921
|
+ "total": total,
|
|
1922
|
+ "zone": zone,
|
|
1923
|
+ "group": group,
|
|
1924
|
+ })
|
|
1925
|
+}
|
|
1926
|
+
|
|
1927
|
+func (this *NewDialysisApiController) DeleteBed() {
|
|
1928
|
+ id, _ := this.GetInt64("id")
|
|
1929
|
+ fmt.Println("id", id)
|
|
1930
|
+ err := service.DeleteBed(id)
|
|
1931
|
+ fmt.Println("删除失败", err)
|
|
1932
|
+ returnData := make(map[string]interface{}, 0)
|
|
1933
|
+ returnData["msg"] = "删除失败"
|
|
1934
|
+ this.ServeSuccessJSON(returnData)
|
|
1935
|
+ return
|
|
1936
|
+}
|