28169 1 год назад
Родитель
Сommit
de3f93e211
100 измененных файлов: 0 добавлений и 97126 удалений
  1. 0 2
      .gitignore
  2. 0 4
      .idea/.gitignore
  3. 0 9
      .idea/XT_New.iml
  4. 0 5
      .idea/codeStyles/codeStyleConfig.xml
  5. 0 12
      .idea/dataSources.xml
  6. 0 4
      .idea/encodings.xml
  7. 0 26
      .idea/misc.xml
  8. 0 8
      .idea/modules.xml
  9. 0 11
      .idea/vcs.xml
  10. 0 2
      README.md
  11. 0 243
      conf/app.conf
  12. 0 115
      conf/接口.txt
  13. 0 58
      controllers/admin_api_controllers/admin_api_base_controller.go
  14. 0 16
      controllers/admin_api_controllers/admin_api_router_register.go
  15. 0 466
      controllers/admin_api_controllers/analysis_api_controller.go
  16. 0 35
      controllers/admin_api_controllers/login_api_controller.go
  17. 0 2223
      controllers/advice_template.json
  18. 0 383
      controllers/base_api_controller.go
  19. 0 40
      controllers/base_controller.go
  20. 0 58
      controllers/base_view_controller.go
  21. 0 2162
      controllers/common_api_controller.go
  22. 0 67
      controllers/common_api_router.go
  23. 0 1164
      controllers/coordinate_controller.go
  24. 0 1832
      controllers/data_api_controller.go
  25. 0 15
      controllers/default.go
  26. 0 1261
      controllers/device_api_controller.go
  27. 0 6100
      controllers/dialysis_api_controller.go
  28. 0 58
      controllers/dialysis_board_api_controller.go
  29. 0 436
      controllers/dialysis_parameter_api_controller.go
  30. 0 1961
      controllers/dialysis_record_api_controller.go
  31. 0 25
      controllers/district_api_controller.go
  32. 0 658
      controllers/doctor_schedule_api_controller.go
  33. 0 1628
      controllers/doctors_api_controller.go
  34. 0 523
      controllers/drug_pharmacy_management_controller.go
  35. 0 4286
      controllers/drug_stock_api_contorller.go
  36. 0 158
      controllers/err_msg.json
  37. 0 472
      controllers/gdyb_controller.go
  38. 0 2644
      controllers/gobal_config_api_controller.go
  39. 0 10336
      controllers/his_api_controller.go
  40. 0 456
      controllers/his_charge_api_controller.go
  41. 0 1844
      controllers/his_config_api_controller.go
  42. 0 989
      controllers/his_deposit_controller.go
  43. 0 1086
      controllers/his_hospital_api_controller.go
  44. 0 88
      controllers/his_print_api_controller.go
  45. 0 1761
      controllers/his_project_api_controller.go
  46. 0 715
      controllers/his_summary_controller.go
  47. 0 812
      controllers/inspection_api_controller.go
  48. 0 437
      controllers/integration_config_api_controller.go
  49. 0 164
      controllers/invoice_api_controller.go
  50. 0 5410
      controllers/manage_api_controller.go
  51. 0 2316
      controllers/manager_center_api_controller.go
  52. 0 8493
      controllers/mobile_api_controllers/dialysis_api_controller.go
  53. 0 635
      controllers/mobile_api_controllers/dialysis_api_controller_extend.go
  54. 0 208
      controllers/mobile_api_controllers/doctor_advice_api_controller.go
  55. 0 29
      controllers/mobile_api_controllers/doctor_api_controller.go
  56. 0 158
      controllers/mobile_api_controllers/err_msg.json
  57. 0 230
      controllers/mobile_api_controllers/login_api_controller.go
  58. 0 304
      controllers/mobile_api_controllers/mobile_api_base_controller.go
  59. 0 193
      controllers/mobile_api_controllers/mobile_api_router_register.go
  60. 0 4613
      controllers/mobile_api_controllers/patient_api_controller.go
  61. 0 28
      controllers/mobile_api_controllers/qiniiu_api_controller.go
  62. 0 73
      controllers/mobile_api_controllers/stock_api_controller.go
  63. 0 252
      controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go
  64. 0 15
      controllers/new_mobile_api_controllers/dialysis_parameter_api_router.go
  65. 0 7
      controllers/new_mobile_api_controllers/dialysis_process_api_controller.go
  66. 0 260
      controllers/new_mobile_api_controllers/forget_password_controller.go
  67. 0 197
      controllers/new_mobile_api_controllers/good_types.json
  68. 0 844
      controllers/new_mobile_api_controllers/home_api_controller.go
  69. 0 925
      controllers/new_mobile_api_controllers/index_evaluation_api_controller.go
  70. 0 139
      controllers/new_mobile_api_controllers/management_analyse_api_controller.go
  71. 0 1283
      controllers/new_mobile_api_controllers/mobile_his_api_controller.go
  72. 0 1280
      controllers/new_mobile_api_controllers/mobile_regist_controller.go
  73. 0 2164
      controllers/new_mobile_api_controllers/new_common_api_controller.go
  74. 0 48
      controllers/new_mobile_api_controllers/new_common_api_router.go
  75. 0 2897
      controllers/new_mobile_api_controllers/new_dialysis_api_controller.go
  76. 0 599
      controllers/new_mobile_api_controllers/new_login_api_controller.go
  77. 0 263
      controllers/new_mobile_api_controllers/new_manage_api_controller.go
  78. 0 11
      controllers/new_mobile_api_controllers/new_manage_api_router.go
  79. 0 13
      controllers/new_mobile_api_controllers/new_mobile_api_base_controller.go
  80. 0 186
      controllers/new_mobile_api_controllers/new_mobile_api_router_register.go
  81. 0 747
      controllers/new_mobile_api_controllers/new_role_api_controller.go
  82. 0 50
      controllers/new_mobile_api_controllers/new_self_drug_api_controller.go
  83. 0 170
      controllers/new_mobile_api_controllers/patient.json
  84. 0 73
      controllers/new_mobile_api_controllers/role.json
  85. 0 86
      controllers/new_mobile_api_controllers/schedule_template.json
  86. 0 1172
      controllers/new_mobile_api_controllers/staff_schedule_api_controller.go
  87. 0 38
      controllers/new_mobile_api_controllers/staff_schedule_api_router.go
  88. 0 44
      controllers/new_mobile_api_controllers/statistics_api_controllers.go
  89. 0 57
      controllers/new_mobile_api_controllers/system_dialysis_prescription.json
  90. 0 1
      controllers/new_schedule_api_controller.go
  91. 0 296
      controllers/orginfo_api_controller.go
  92. 0 5449
      controllers/patient_api_controller.go
  93. 0 1040
      controllers/patient_dataconfig_api_controller.go
  94. 0 620
      controllers/pay_api_controller.go
  95. 0 922
      controllers/pc_index_evaluation_api_controller.go
  96. 0 789
      controllers/pharmacy_controller.go
  97. 0 363
      controllers/print_data_api_controller.go
  98. 0 2414
      controllers/public_api_controller.go
  99. 0 864
      controllers/qcd_api_controller.go
  100. 0 0
      controllers/qiniiu_api_controller.go

+ 0 - 2
.gitignore Просмотреть файл

@@ -1,2 +0,0 @@
1
-.DS_Store
2
-*/.DS_Store

+ 0 - 4
.idea/.gitignore Просмотреть файл

@@ -1,4 +0,0 @@
1
-# Default ignored files
2
-/workspace.xml
3
-# Datasource local storage ignored files
4
-/dataSources.local.xml

+ 0 - 9
.idea/XT_New.iml Просмотреть файл

@@ -1,9 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module type="WEB_MODULE" version="4">
3
-  <component name="Go" enabled="true" />
4
-  <component name="NewModuleRootManager">
5
-    <content url="file://$MODULE_DIR$" />
6
-    <orderEntry type="inheritedJdk" />
7
-    <orderEntry type="sourceFolder" forTests="false" />
8
-  </component>
9
-</module>

+ 0 - 5
.idea/codeStyles/codeStyleConfig.xml Просмотреть файл

@@ -1,5 +0,0 @@
1
-<component name="ProjectCodeStyleConfiguration">
2
-  <state>
3
-    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
-  </state>
5
-</component>

+ 0 - 12
.idea/dataSources.xml Просмотреть файл

@@ -1,12 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
4
-    <data-source source="LOCAL" name="@rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com" uuid="a5e97996-c706-42df-9eba-66746647237e">
5
-      <driver-ref>mysql.8</driver-ref>
6
-      <synchronize>true</synchronize>
7
-      <remarks>lijc de database</remarks>
8
-      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
9
-      <jdbc-url>jdbc:mysql://rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com:3306</jdbc-url>
10
-    </data-source>
11
-  </component>
12
-</project>

+ 0 - 4
.idea/encodings.xml Просмотреть файл

@@ -1,4 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
-</project>

+ 0 - 26
.idea/misc.xml Просмотреть файл

@@ -1,26 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="JavaScriptSettings">
4
-    <option name="languageLevel" value="ES6" />
5
-  </component>
6
-  <component name="SvnBranchConfigurationManager">
7
-    <option name="myConfigurationMap">
8
-      <map>
9
-        <entry key="$PROJECT_DIR$/../CDM">
10
-          <value>
11
-            <SvnBranchConfiguration>
12
-              <option name="trunkUrl" value="svn://112.74.16.180/Product/SGJ/SGJ1.0/Project/SGJ1.0/Application/MBGL" />
13
-            </SvnBranchConfiguration>
14
-          </value>
15
-        </entry>
16
-        <entry key="$PROJECT_DIR$/../SYB_Admin">
17
-          <value>
18
-            <SvnBranchConfiguration>
19
-              <option name="trunkUrl" value="svn://112.74.16.180/Product/SYB/SYB1.0/Application/SYB_Admin" />
20
-            </SvnBranchConfiguration>
21
-          </value>
22
-        </entry>
23
-      </map>
24
-    </option>
25
-  </component>
26
-</project>

+ 0 - 8
.idea/modules.xml Просмотреть файл

@@ -1,8 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="ProjectModuleManager">
4
-    <modules>
5
-      <module fileurl="file://$PROJECT_DIR$/.idea/XT_New.iml" filepath="$PROJECT_DIR$/.idea/XT_New.iml" />
6
-    </modules>
7
-  </component>
8
-</project>

+ 0 - 11
.idea/vcs.xml Просмотреть файл

@@ -1,11 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project version="4">
3
-  <component name="GitSharedSettings">
4
-    <option name="FORCE_PUSH_PROHIBITED_PATTERNS">
5
-      <list />
6
-    </option>
7
-  </component>
8
-  <component name="VcsDirectoryMappings">
9
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
10
-  </component>
11
-</project>

+ 0 - 2
README.md Просмотреть файл

@@ -1,2 +0,0 @@
1
-# XT_New
2
-

+ 0 - 243
conf/app.conf Просмотреть файл

@@ -1,243 +0,0 @@
1
-appname = 血透
2
-httpport = 9531
3
-runmode = prod
4
-#dev/prod
5
-
6
-#
7
-copyrequestbody = true
8
-sessionon = true
9
-#sessiongcmaxlifetime = 64800
10
-
11
-tokencookiemaxlifetime = 7200
12
-enablexsrf = false
13
-xsrfkey = 61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o
14
-xsrfexpire = 3600
15
-
16
-qiniu_accesskey = -l_Pcc1YJs0gh3w0YwN2uoaZO_5fY5J9SIYnSjg0
17
-qiniu_secretkey = DmZSp_Bmnp-9aUB7xUvoyViZpzmx1Rs2RL69GvlW
18
-qiniu_domain = https://images.shengws.com/
19
-qiniu_bucket = syhclub-storage
20
-
21
-
22
-
23
-aes_key = "xuetou-201807319"
24
-
25
-wxtoken = gh_ac6cd0cdde3d
26
-wxoriId = gh_ac6cd0cdde3d
27
-wxappId = wxbb9223f20bc11612
28
-# wxappsecret = a78c793c377268db25dde2eb971a2ebb
29
-# wxEncodingAESKey = 1vRDzqltXYOc9iMqhsQT7AkIRRpUaGl8MZlUcP7x4UK
30
-
31
-sms_appId = dcabb3aa7afd402794046ebbbf652bce
32
-sms_sid = a26cb0ceb3a811ca82143972f4ef38a4
33
-sms_token = ea475ed8d3de6c54c2b3f9d78db76d1e
34
-sms_baseUrl = https://open.ucpaas.com/ol/sms/
35
-ip_max_send_count = 20
36
-moblie_max_send_count = 5
37
-sms_verification_code_templateid = 358429
38
-
39
-
40
-appid = "wx43ad410d9eef426e"
41
-mchid = "1509573721"
42
-key = "e4SHrkiZu0pQEwVoGBapDBTf9N1Q6MxV"
43
-appsecret="61ee2e6268497d5aa9de0b0187c39aea"
44
-
45
-
46
-
47
-[prod]
48
-mobile_token_expiration_second = 604800
49
-httpdomain = https://api.xt.kuyicloud.com
50
-sso_domain = https://sso.kuyicloud.com
51
-call_domain = https://hf.sgjyun.com
52
-front_end_domain = "https://xt.kuyicloud.com/#"
53
-
54
-readmysqlhost = shengws1.mysql.rds.aliyuncs.com
55
-readmysqlport = 3306
56
-readmysqluser = syh
57
-readmysqlpass = xhPECP2nFObR8aUK
58
-readmysqlname = sgj_xt
59
-
60
-
61
-
62
-readmysqlhost2 = rr-kuyicloud.mysql.rds.aliyuncs.com
63
-readmysqlport2 = 3306
64
-readmysqluser2 = syh
65
-readmysqlpass2 = xhPECP2nFObR8aUK
66
-readmysqlname2 = sgj_xt
67
-
68
-writemysqlhost = shengws1.mysql.rds.aliyuncs.com
69
-writemysqlport = 3306
70
-writemysqluser = syh
71
-writemysqlpass = xhPECP2nFObR8aUK
72
-writemysqlname = sgj_xt
73
-
74
-
75
-readuserhost = shengws1.mysql.rds.aliyuncs.com
76
-readuserport = 3306
77
-readuseruser = syh
78
-readuserpass = xhPECP2nFObR8aUK
79
-readusername = sgj_users
80
-
81
-writeuserhost = shengws1.mysql.rds.aliyuncs.com
82
-writeuserport = 3306
83
-writeuseruser = syh
84
-writeuserpass = xhPECP2nFObR8aUK
85
-writeusername = sgj_users
86
-
87
-readmiddlehost = shengws1.mysql.rds.aliyuncs.com
88
-readmiddleport = 3306
89
-readmiddleuser = syh
90
-readmiddlepass = xhPECP2nFObR8aUK
91
-readmiddlename = ky_xt_middle
92
-
93
-writemiddlehost = shengws1.mysql.rds.aliyuncs.com
94
-writemiddleport = 3306
95
-writemiddleuser = syh
96
-writemiddlepass = xhPECP2nFObR8aUK
97
-writemiddlename = ky_xt_middle
98
-
99
-
100
-readsgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
101
-readsgjpatientmysqlport = 3306
102
-readsgjpatientmysqluser = syh
103
-readsgjpatientmysqlpass = xhPECP2nFObR8aUK
104
-readsgjpatientmysqlname = sgj_patient
105
-
106
-writesgjpatientmysqlhost = shengws1.mysql.rds.aliyuncs.com
107
-writesgjpatientmysqlport = 3306
108
-writesgjpatientmysqluser = syh
109
-writesgjpatientmysqlpass = xhPECP2nFObR8aUK
110
-writesgjpatientmysqlname = sgj_patient
111
-
112
-
113
-readpatienthost = shengws1.mysql.rds.aliyuncs.com
114
-readpatientport = 3306
115
-readpatientuser = syh
116
-readpatientpass = xhPECP2nFObR8aUK
117
-readpatientname = sgj_cdm
118
-
119
-writepatienthost = shengws1.mysql.rds.aliyuncs.com
120
-writepatientport = 3306
121
-writepatientuser = syh
122
-writepatientpass = xhPECP2nFObR8aUK
123
-writepatientname = sgj_cdm
124
-
125
-redishost = kuyicloud.redis.rds.aliyuncs.com
126
-redisport = 6379
127
-redispasswrod = 1Q2W3e4r!@#$
128
-redisdb = 1
129
-
130
-EnableRender= false
131
-niprocart =  63
132
-jms = 58
133
-fistula_needle_set = 65
134
-fistula_needle_set_16 = 64
135
-hemoperfusion = 55
136
-dialyser_sterilised = 12
137
-filtryzer = 53
138
-dialyzers = 8
139
-injector = 81
140
-bloodlines = 42
141
-tubingHemodialysis = 30
142
-package = 82
143
-aliquid = 83
144
-
145
-
146
-
147
-[dev]
148
-mobile_token_expiration_second = 604800
149
-# httpdomain = http://new_mobile.xt.api.sgjyun.com
150
-httpdomain = https://api.xt.test.sgjyun.com
151
-sso_domain = https://testsso.sgjyun.com
152
-call_domain = http://hf.szjkhd.com
153
-front_end_domain = "http://xt.test.sgjyun.com/#"
154
-
155
-readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
156
-readmysqlport = 3306
157
-readmysqluser = root
158
-readmysqlpass = 1Q2W3e4r!@#$
159
-readmysqlname = sgj_xt
160
-
161
-writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162
-writemysqlport = 3306
163
-writemysqluser = root
164
-writemysqlpass = 1Q2W3e4r!@#$
165
-writemysqlname = sgj_xt
166
-
167
-readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
168
-readuserport = 3306
169
-readuseruser = root
170
-readuserpass = 1Q2W3e4r!@#$
171
-readusername = sgj_users
172
-
173
-
174
-writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
175
-writeuserport = 3306
176
-writeuseruser = root
177
-writeuserpass = 1Q2W3e4r!@#$
178
-writeusername = sgj_users
179
-
180
-
181
-readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
182
-readmiddleport = 3306
183
-readmiddleuser = root
184
-readmiddlepass = 1Q2W3e4r!@#$
185
-readmiddlename = ky_xt_middle
186
-
187
-writemiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
188
-writemiddleport = 3306
189
-writemiddleuser = root
190
-writemiddlepass = 1Q2W3e4r!@#$
191
-writemiddlename = ky_xt_middle
192
-
193
-
194
-readpatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
195
-readpatientport = 3306
196
-readpatientuser = root
197
-readpatientpass = 1Q2W3e4r!@#$
198
-readpatientname = sgj_cdm
199
-
200
-writepatienthost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
201
-writepatientport = 3306
202
-writepatientuser = root
203
-writepatientpass = 1Q2W3e4r!@#$
204
-writepatientname = sgj_cdm
205
-
206
-readsgjpatientmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
207
-readsgjpatientmysqlport = 3306
208
-readsgjpatientmysqluser = root
209
-readsgjpatientmysqlpass = 1Q2W3e4r!@#$
210
-readsgjpatientmysqlname = sgj_patient
211
-
212
-writesgjpatientmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
213
-writesgjpatientmysqlport = 3306
214
-writesgjpatientmysqluser = root
215
-writesgjpatientmysqlpass = 1Q2W3e4r!@#$
216
-writesgjpatientmysqlname = sgj_patient
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-#redishost = 120.77.235.13
225
-#redishost = 112.74.16.180
226
-redishost = kuyi6666.redis.rds.aliyuncs.com
227
-redisport = 6379
228
-redispasswrod = TZtBW098WId3i27clkpj3q8dnUaVFP
229
-redisdb = 7
230
-
231
-niprocart =  83
232
-jms = 80
233
-fistula_needle_set = 81
234
-fistula_needle_set_16 = 82
235
-hemoperfusion = 85
236
-dialyser_sterilised = 84
237
-filtryzer = 79
238
-dialyzers = 10000
239
-injector = 10001
240
-bloodlines = 10002
241
-tubingHemodialysis = 10003
242
-package = 10004
243
-aliquid = 10005

+ 0 - 115
conf/接口.txt Просмотреть файл

@@ -1,115 +0,0 @@
1
-
2
-//新增临时
3
-/m/api/dialysis/dialysisPrescription?mode=1
4
-修改临处
5
-/m/api/dialysis/dialysisPrescription?mode=2
6
-修改他人临处
7
-/m/api/dialysis/dialysisPrescription?mode=3
8
-
9
-
10
-新增接诊评估
11
-/m/api/dialysis/acceptsAssessment?mode=1
12
-修改接诊评估
13
-/m/api/dialysis/acceptsAssessment?mode=2
14
-修改他人接诊评估
15
-/m/api/dialysis/acceptsAssessment?mode=3
16
-
17
-新增透前评估
18
-/m/api/assessmentbefore/commit?mode=1
19
-修改透前评估
20
-/m/api/assessmentbefore/commit?mode=2
21
-修改他人透前评估
22
-/m/api/assessmentbefore/commit?mode=3
23
-
24
-执行上机
25
-/m/api/dialysis/start?mode=1
26
-修改执行上机
27
-/m/api/startOrder/edit?mode=2
28
-修改他人执行上机
29
-/m/api/startOrder/edit?mode=3
30
-
31
-新增透析监测
32
-/m/api/monitor/add?mode=1
33
-修改透析监测
34
-/m/api/monitor/edit?mode=2
35
-修改他人透析监测
36
-/m/api/monitor/edit?mode=3
37
-删除透析监测
38
-/m/api/monitor/delete?mode=4
39
-删除他人透析监测
40
-/m/api/monitor/delete?mode=5
41
-
42
-执行下机
43
-/m/api/dialysis/finish?mode=1
44
-修改执行下机
45
-/m/api/finishOrder/edit?mode=2
46
-修改他人执行下机
47
-/m/api/finishOrder/edit?mode=3
48
-
49
-新增透后评估
50
-/m/api/dialysis/assessmentAfterDislysis?mode=1
51
-修改透后评估
52
-/m/api/dialysis/assessmentAfterDislysis?mode=2
53
-修改他人透后评估
54
-/m/api/dialysis/assessmentAfterDislysis?mode=3
55
-
56
-新增治疗小结
57
-/m/api/dialysis/treatmentSummary?mode=1
58
-修改治疗小结
59
-/m/api/dialysis/treatmentSummary?mode=2
60
-修改他人治疗小结
61
-/m/api/dialysis/treatmentSummary?mode=3
62
-
63
-新增透析临时医嘱
64
-/m/api/advice/creategroup?mode=1
65
-修改透析临时医嘱
66
-/m/api/advice/edit?mode=2
67
-修改他人透析临时医嘱
68
-/m/api/advice/edit?mode=3
69
-删除透析临时医嘱
70
-/m/api/newadvice/delete?mode=4
71
-删除他人透析临时医嘱
72
-/m/api/newadvice/delete?mode=5
73
-执行透析临时医嘱
74
-/m/api/advice/exec?mode=6
75
-核对透析临时医嘱
76
-/m/api/advice/check?mode=7
77
-修改已执行医嘱
78
-/m/api/advice/exec/modify?mode=8
79
-
80
-
81
-移动端 : /m/api/permission/get      get 请求
82
-参数1: create_url
83
-参数2:modify_url
84
-
85
-参数3:modify_other_url
86
-
87
-参数4:del_url
88
-
89
-参数5:del_other_url
90
-
91
-参数6:exce_url
92
-
93
-参数7:check_url
94
-
95
-参数8:modify_exce_url
96
-参数9:module
97
-
98
-返回值1:is_has_create
99
-返回值2:is_has_modify
100
-
101
-返回值3:is_has_modify_other
102
-
103
-返回值4:is_has_del
104
-
105
-返回值5:is_has_del_other
106
-
107
-返回值6:is_has_exce
108
-
109
-返回值7:is_has_check
110
-
111
-返回值8:is_has_modify_exce
112
-
113
-返回值9:module
114
-
115
-

+ 0 - 58
controllers/admin_api_controllers/admin_api_base_controller.go Просмотреть файл

@@ -1,58 +0,0 @@
1
-package admin_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models/admin_models"
7
-)
8
-
9
-type AdminBaseAPIController struct {
10
-	controllers.BaseAPIController
11
-}
12
-
13
-func (this *AdminBaseAPIController) ErrorLog(format string, a ...interface{}) {
14
-	//beego.Error(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
15
-}
16
-
17
-func (this *AdminBaseAPIController) WarnLog(format string, a ...interface{}) {
18
-	//beego.Warn(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
19
-}
20
-
21
-func (this *AdminBaseAPIController) InfoLog(format string, a ...interface{}) {
22
-	//beego.Info(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
23
-}
24
-
25
-func (this *AdminBaseAPIController) DebugLog(format string, a ...interface{}) {
26
-	//beego.Debug(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
27
-}
28
-
29
-func (this *AdminBaseAPIController) TraceLog(format string, a ...interface{}) {
30
-	//beego.Trace(fmt.Sprintf("[管理员后台] %v", fmt.Sprintf(format, a...)))
31
-}
32
-
33
-func (this *AdminBaseAPIController) GetAdminInfo() *AdminInfo {
34
-	userInfo := this.GetSession("admin_info")
35
-	if userInfo == nil {
36
-		return nil
37
-	} else {
38
-		return userInfo.(*AdminInfo)
39
-	}
40
-}
41
-
42
-type AdminInfo struct {
43
-	Admin *admin_models.AdminAccount
44
-}
45
-
46
-type AdminBaseAPIAuthController struct {
47
-	AdminBaseAPIController
48
-}
49
-
50
-func (this *AdminBaseAPIAuthController) Prepare() {
51
-	this.AdminBaseAPIController.Prepare()
52
-
53
-	adminInfo := this.GetAdminInfo()
54
-	if adminInfo == nil {
55
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
56
-		this.StopRun()
57
-	}
58
-}

+ 0 - 16
controllers/admin_api_controllers/admin_api_router_register.go Просмотреть файл

@@ -1,16 +0,0 @@
1
-package admin_api_controllers
2
-
3
-import "github.com/astaxie/beego"
4
-
5
-// 管理员后台路由,以 /admin/api 为前缀
6
-func AdminAPIControllersRegisterRouters() {
7
-	beego.Router("/admin/api/login/pwd", &LoginAPIController{}, "post:LoginByPwd")
8
-
9
-	beego.Router("/admin/api/org/regist", &AnalysisAPIController{}, "get:RegistOrg")
10
-	beego.Router("/admin/api/org/active", &AnalysisAPIController{}, "get:ActiveOrg")
11
-	beego.Router("/admin/api/user/active", &AnalysisAPIController{}, "get:ActiveUser")
12
-	beego.Router("/admin/api/org/expiring", &AnalysisAPIController{}, "get:ExpiringOrg")
13
-	beego.Router("/admin/api/dialysis/analysis", &AnalysisAPIController{}, "get:DialysisAnalysis")
14
-	beego.Router("/admin/api/monitor/analysis", &AnalysisAPIController{}, "get:MonitorAnalysis")
15
-	beego.Router("/admin/api/patient/analysis", &AnalysisAPIController{}, "get:PatientAnalysis")
16
-}

+ 0 - 466
controllers/admin_api_controllers/analysis_api_controller.go Просмотреть файл

@@ -1,466 +0,0 @@
1
-package admin_api_controllers
2
-
3
-import (
4
-	"XT_New/models"
5
-	"XT_New/service"
6
-	"XT_New/utils"
7
-	"time"
8
-)
9
-
10
-type AnalysisAPIController struct {
11
-	AdminBaseAPIAuthController
12
-	// AdminBaseAPIController
13
-}
14
-
15
-// /admin/api/org/regist [get] RegistOrg
16
-func (this *AnalysisAPIController) RegistOrg() {
17
-	totalOrg, getTotalOrgErr := service.GetTotalOrgCount()
18
-	if getTotalOrgErr != nil {
19
-		this.ErrorLog("获取总机构数失败:%v", getTotalOrgErr)
20
-	}
21
-
22
-	now := time.Now()
23
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
24
-	registOrgCountToday, getRegistOrgCountTodayErr := service.GetRegistedOrgCountFromDayToDay(zeroHourTimeOfToday, now)
25
-	if getRegistOrgCountTodayErr != nil {
26
-		this.ErrorLog("获取今日注册机构数失败:%v", getRegistOrgCountTodayErr)
27
-	}
28
-
29
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&now)
30
-	registOrgCountThisWeek, getRegistOrgCountThisWeekErr := service.GetRegistedOrgCountFromDayToDay(monday, sunday)
31
-	if getRegistOrgCountThisWeekErr != nil {
32
-		this.ErrorLog("获取本周注册机构数失败:%v", getRegistOrgCountThisWeekErr)
33
-	}
34
-
35
-	thisYear := now.Year()
36
-	thisMonth := int(now.Month())
37
-	beginningOfMonth, endOfMonth := utils.MonthBeginningToEnd(thisYear, thisMonth)
38
-	registOrgCountThisMonth, getRegistOrgCountThisMonthErr := service.GetRegistedOrgCountFromDayToDay(beginningOfMonth, endOfMonth)
39
-	if getRegistOrgCountThisMonthErr != nil {
40
-		this.ErrorLog("获取本月注册机构数失败:%v", getRegistOrgCountThisMonthErr)
41
-	}
42
-
43
-	monthRegistOrgCounts := make([]map[string]interface{}, 0, 12)
44
-	for m := 1; m < 12; m++ {
45
-		if m > thisMonth {
46
-			break
47
-		}
48
-		if m == thisMonth {
49
-			monthRegistOrgCounts = append(monthRegistOrgCounts, map[string]interface{}{
50
-				"month": m,
51
-				"count": registOrgCountThisMonth,
52
-			})
53
-
54
-		} else {
55
-			BOM, EOM := utils.MonthBeginningToEnd(thisYear, m)
56
-			registOrgCount, getRegistOrgCountErr := service.GetRegistedOrgCountFromDayToDay(BOM, EOM)
57
-			if getRegistOrgCountErr != nil {
58
-				this.ErrorLog("获取%v月注册机构数失败:%v", m, getRegistOrgCountErr)
59
-			}
60
-			monthRegistOrgCounts = append(monthRegistOrgCounts, map[string]interface{}{
61
-				"month": m,
62
-				"count": registOrgCount,
63
-			})
64
-		}
65
-	}
66
-
67
-	registOrgsThisWeek, getRegistOrgThisWeekErr := service.GetRegistedOrgsFromDayToDay(monday, sunday)
68
-	if getRegistOrgThisWeekErr != nil {
69
-		this.ErrorLog("获取本周注册机构失败:%v", getRegistOrgThisWeekErr)
70
-		registOrgsThisWeek = make([]*models.Org, 0)
71
-	}
72
-
73
-	registOrgsThisMonth, getRegistOrgThisMonthErr := service.GetRegistedOrgsFromDayToDay(beginningOfMonth, endOfMonth)
74
-	if getRegistOrgThisMonthErr != nil {
75
-		this.ErrorLog("获取本月注册机构失败:%v", getRegistOrgThisMonthErr)
76
-		registOrgsThisMonth = make([]*models.Org, 0)
77
-	}
78
-
79
-	this.ServeSuccessJSON(map[string]interface{}{
80
-		"total_org_count":         totalOrg,
81
-		"regist_org_count_today":  registOrgCountToday,
82
-		"regist_org_count_week":   registOrgCountThisWeek,
83
-		"regist_org_count_month":  registOrgCountThisMonth,
84
-		"regist_org_count_months": monthRegistOrgCounts,
85
-		"regist_orgs_week":        registOrgsThisWeek,
86
-		"regist_orgs_month":       registOrgsThisMonth,
87
-	})
88
-}
89
-
90
-// /admin/api/org/active [get] ActiveOrg
91
-func (this *AnalysisAPIController) ActiveOrg() {
92
-	now := time.Now()
93
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
94
-	activeOrgCountToday, getActiveTodayErr := service.GetActiveOrgCountFromDayToDay(zeroHourTimeOfToday, now)
95
-	if getActiveTodayErr != nil {
96
-		this.ErrorLog("获取今日活跃机构数失败:%v", getActiveTodayErr)
97
-	}
98
-
99
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&now)
100
-	activeOrgCountThisWeek, getActiveOrgCountThisWeekErr := service.GetActiveOrgCountFromDayToDay(monday, sunday)
101
-	if getActiveOrgCountThisWeekErr != nil {
102
-		this.ErrorLog("获取本周活跃机构数失败:%v", getActiveOrgCountThisWeekErr)
103
-	}
104
-
105
-	thisYear := now.Year()
106
-	thisMonth := int(now.Month())
107
-	beginningOfMonth, endOfMonth := utils.MonthBeginningToEnd(thisYear, thisMonth)
108
-	activeOrgCountThisMonth, getActiveOrgCountThisMonthErr := service.GetActiveOrgCountFromDayToDay(beginningOfMonth, endOfMonth)
109
-	if getActiveOrgCountThisMonthErr != nil {
110
-		this.ErrorLog("获取本月活跃机构数失败:%v", getActiveOrgCountThisMonthErr)
111
-	}
112
-
113
-	monthActiveOrgCounts := make([]map[string]interface{}, 0, 12)
114
-	for m := 1; m < 12; m++ {
115
-		if m > thisMonth {
116
-			break
117
-		}
118
-		if m == thisMonth {
119
-			monthActiveOrgCounts = append(monthActiveOrgCounts, map[string]interface{}{
120
-				"month": m,
121
-				"count": activeOrgCountThisMonth,
122
-			})
123
-
124
-		} else {
125
-			BOM, EOM := utils.MonthBeginningToEnd(thisYear, m)
126
-			activeOrgCount, getActiveOrgCountErr := service.GetActiveOrgCountFromDayToDay(BOM, EOM)
127
-			if getActiveOrgCountErr != nil {
128
-				this.ErrorLog("获取%v月活跃机构数失败:%v", m, getActiveOrgCountErr)
129
-			}
130
-			monthActiveOrgCounts = append(monthActiveOrgCounts, map[string]interface{}{
131
-				"month": m,
132
-				"count": activeOrgCount,
133
-			})
134
-		}
135
-	}
136
-
137
-	activeOrgsThisWeek, getActiveOrgThisWeekErr := service.GetActiveOrgsFromDayToDay(monday, sunday)
138
-	if getActiveOrgThisWeekErr != nil {
139
-		this.ErrorLog("获取本周活跃机构失败:%v", getActiveOrgThisWeekErr)
140
-		activeOrgsThisWeek = make([]*service.ActiveOrgListVM, 0)
141
-	}
142
-
143
-	activeOrgsThisMonth, getActiveOrgThisMonthErr := service.GetActiveOrgsFromDayToDay(beginningOfMonth, endOfMonth)
144
-	if getActiveOrgThisMonthErr != nil {
145
-		this.ErrorLog("获取本月活跃机构失败:%v", getActiveOrgThisMonthErr)
146
-		activeOrgsThisMonth = make([]*service.ActiveOrgListVM, 0)
147
-	}
148
-
149
-	this.ServeSuccessJSON(map[string]interface{}{
150
-		"active_org_count_today":  activeOrgCountToday,
151
-		"active_org_count_week":   activeOrgCountThisWeek,
152
-		"active_org_count_month":  activeOrgCountThisMonth,
153
-		"active_org_count_months": monthActiveOrgCounts,
154
-		"active_orgs_week":        activeOrgsThisWeek,
155
-		"active_orgs_month":       activeOrgsThisMonth,
156
-	})
157
-}
158
-
159
-// /admin/api/user/active [get] ActiveUser
160
-func (this *AnalysisAPIController) ActiveUser() {
161
-	now := time.Now()
162
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
163
-	activeAdminCountToday, getActiveTodayErr := service.GetActiveAdminUserCountFromDayToDay(zeroHourTimeOfToday, now)
164
-	if getActiveTodayErr != nil {
165
-		this.ErrorLog("获取今日活跃账户数失败:%v", getActiveTodayErr)
166
-	}
167
-
168
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&now)
169
-	activeAdminCountThisWeek, getActiveAdminCountThisWeekErr := service.GetActiveAdminUserCountFromDayToDay(monday, sunday)
170
-	if getActiveAdminCountThisWeekErr != nil {
171
-		this.ErrorLog("获取本周活跃账户数失败:%v", getActiveAdminCountThisWeekErr)
172
-	}
173
-
174
-	thisYear := now.Year()
175
-	thisMonth := int(now.Month())
176
-	beginningOfMonth, endOfMonth := utils.MonthBeginningToEnd(thisYear, thisMonth)
177
-	activeAdminCountThisMonth, getActiveAdminCountThisMonthErr := service.GetActiveAdminUserCountFromDayToDay(beginningOfMonth, endOfMonth)
178
-	if getActiveAdminCountThisMonthErr != nil {
179
-		this.ErrorLog("获取本月活跃账户数失败:%v", getActiveAdminCountThisMonthErr)
180
-	}
181
-
182
-	monthActiveAdminCounts := make([]map[string]interface{}, 0, 12)
183
-	for m := 1; m < 12; m++ {
184
-		if m > thisMonth {
185
-			break
186
-		}
187
-		if m == thisMonth {
188
-			monthActiveAdminCounts = append(monthActiveAdminCounts, map[string]interface{}{
189
-				"month": m,
190
-				"count": activeAdminCountThisMonth,
191
-			})
192
-
193
-		} else {
194
-			BOM, EOM := utils.MonthBeginningToEnd(thisYear, m)
195
-			activeAdminCount, getActiveAdminCountErr := service.GetActiveAdminUserCountFromDayToDay(BOM, EOM)
196
-			if getActiveAdminCountErr != nil {
197
-				this.ErrorLog("获取%v月活跃账户数失败:%v", m, getActiveAdminCountErr)
198
-			}
199
-			monthActiveAdminCounts = append(monthActiveAdminCounts, map[string]interface{}{
200
-				"month": m,
201
-				"count": activeAdminCount,
202
-			})
203
-		}
204
-	}
205
-
206
-	activeAdminsThisWeek, getActiveAdminThisWeekErr := service.GetActiveAdminUsersFromDayToDay(monday, sunday)
207
-	if getActiveAdminThisWeekErr != nil {
208
-		this.ErrorLog("获取本周活跃账户失败:%v", getActiveAdminThisWeekErr)
209
-		activeAdminsThisWeek = make([]*service.ActiveAdminUserListVM, 0)
210
-	}
211
-
212
-	activeAdminsThisMonth, getActiveAdminThisMonthErr := service.GetActiveAdminUsersFromDayToDay(beginningOfMonth, endOfMonth)
213
-	if getActiveAdminThisMonthErr != nil {
214
-		this.ErrorLog("获取本月活跃账户失败:%v", getActiveAdminThisMonthErr)
215
-		activeAdminsThisMonth = make([]*service.ActiveAdminUserListVM, 0)
216
-	}
217
-
218
-	this.ServeSuccessJSON(map[string]interface{}{
219
-		"active_admin_count_today":  activeAdminCountToday,
220
-		"active_admin_count_week":   activeAdminCountThisWeek,
221
-		"active_admin_count_month":  activeAdminCountThisMonth,
222
-		"active_admin_count_months": monthActiveAdminCounts,
223
-		"active_admins_week":        activeAdminsThisWeek,
224
-		"active_admins_month":       activeAdminsThisMonth,
225
-	})
226
-}
227
-
228
-// /admin/api/org/expiring [get] ExpiringOrg
229
-func (this *AnalysisAPIController) ExpiringOrg() {
230
-	now := time.Now()
231
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
232
-	// endTimeOfToday := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999, time.Local)
233
-	timeAfter15Days := zeroHourTimeOfToday.AddDate(0, 0, 15)
234
-	timeBefore15Days := zeroHourTimeOfToday.AddDate(0, 0, -15)
235
-
236
-	countOfWillExpireOrg, getWillExpireOrgCountErr := service.GetWillExpireOrgCountFromDayToDay(zeroHourTimeOfToday, timeAfter15Days)
237
-	if getWillExpireOrgCountErr != nil {
238
-		this.ErrorLog("获取即将到期机构数失败:%v", getWillExpireOrgCountErr)
239
-	}
240
-
241
-	countOfExpiredOrg, getExpiredOrgCountErr := service.GetDidExpiredOrgCountFromDayToDay(timeBefore15Days, zeroHourTimeOfToday)
242
-	if getExpiredOrgCountErr != nil {
243
-		this.ErrorLog("获取刚到期机构数失败:%v", getExpiredOrgCountErr)
244
-	}
245
-
246
-	willExpireOrgs, getWillExpireOrgsErr := service.GetWillExpireOrgsFromDayToDay(zeroHourTimeOfToday, timeAfter15Days)
247
-	if getWillExpireOrgsErr != nil {
248
-		this.ErrorLog("获取即将到期机构失败:%v", getWillExpireOrgsErr)
249
-		willExpireOrgs = make([]*service.ExpireOrgListVM, 0, 0)
250
-	}
251
-
252
-	expiredOrgs, getExpiredOrgsErr := service.GetDidExpireOrgsFromDayToDay(timeBefore15Days, zeroHourTimeOfToday)
253
-	if getExpiredOrgsErr != nil {
254
-		this.ErrorLog("获取已到期机构失败:%v", getExpiredOrgsErr)
255
-		expiredOrgs = make([]*service.ExpireOrgListVM, 0, 0)
256
-	}
257
-
258
-	this.ServeSuccessJSON(map[string]interface{}{
259
-		"will_expire_org_count": countOfWillExpireOrg,
260
-		"did_expired_org_count": countOfExpiredOrg,
261
-		"will_expire_orgs":      willExpireOrgs,
262
-		"did_expired_orgs":      expiredOrgs,
263
-	})
264
-}
265
-
266
-// /admin/api/dialysis/analysis [get] DialysisAnalysis
267
-func (this *AnalysisAPIController) DialysisAnalysis() {
268
-	now := time.Now()
269
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
270
-	endTimeOfToday := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999, time.Local)
271
-
272
-	timesToday, getTimesTodayErr := service.GetDialysisTimesFromDayToDay(zeroHourTimeOfToday, endTimeOfToday)
273
-	if getTimesTodayErr != nil {
274
-		this.ErrorLog("获取今日透析次数失败:%v", getTimesTodayErr)
275
-	}
276
-
277
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&now)
278
-	timesThisWeek, getTimesThisWeekErr := service.GetDialysisTimesFromDayToDay(monday, sunday)
279
-	if getTimesThisWeekErr != nil {
280
-		this.ErrorLog("获取本周透析次数失败:%v", getTimesThisWeekErr)
281
-	}
282
-
283
-	thisYear := now.Year()
284
-	thisMonth := int(now.Month())
285
-	beginningOfMonth, endOfMonth := utils.MonthBeginningToEnd(thisYear, thisMonth)
286
-	timesThisMonth, getTimesThisMonthErr := service.GetDialysisTimesFromDayToDay(beginningOfMonth, endOfMonth)
287
-	if getTimesThisMonthErr != nil {
288
-		this.ErrorLog("获取本月透析次数失败:%v", getTimesThisMonthErr)
289
-	}
290
-
291
-	monthTimes := make([]map[string]interface{}, 0, 12)
292
-	for m := 1; m < 12; m++ {
293
-		if m > thisMonth {
294
-			break
295
-		}
296
-		if m == thisMonth {
297
-			monthTimes = append(monthTimes, map[string]interface{}{
298
-				"month": m,
299
-				"count": timesThisMonth,
300
-			})
301
-
302
-		} else {
303
-			BOM, EOM := utils.MonthBeginningToEnd(thisYear, m)
304
-			times, getTimesErr := service.GetDialysisTimesFromDayToDay(BOM, EOM)
305
-			if getTimesErr != nil {
306
-				this.ErrorLog("获取%v月透析次数失败:%v", m, getTimesErr)
307
-			}
308
-			monthTimes = append(monthTimes, map[string]interface{}{
309
-				"month": m,
310
-				"count": times,
311
-			})
312
-		}
313
-	}
314
-
315
-	this.ServeSuccessJSON(map[string]interface{}{
316
-		"times_today":  timesToday,
317
-		"times_week":   timesThisWeek,
318
-		"times_month":  timesThisMonth,
319
-		"times_months": monthTimes,
320
-	})
321
-}
322
-
323
-// /admin/api/monitor/analysis [get] MonitorAnalysis
324
-func (this *AnalysisAPIController) MonitorAnalysis() {
325
-	now := time.Now()
326
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
327
-	endTimeOfToday := time.Date(now.Year(), now.Month(), now.Day(), 23, 59, 59, 999, time.Local)
328
-
329
-	timesToday, getTimesTodayErr := service.GetMonitoringTimesFromDayToDay(zeroHourTimeOfToday, endTimeOfToday)
330
-	if getTimesTodayErr != nil {
331
-		this.ErrorLog("获取今日监控次数失败:%v", getTimesTodayErr)
332
-	}
333
-
334
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&now)
335
-	timesThisWeek, getTimesThisWeekErr := service.GetMonitoringTimesFromDayToDay(monday, sunday)
336
-	if getTimesThisWeekErr != nil {
337
-		this.ErrorLog("获取本周监控次数失败:%v", getTimesThisWeekErr)
338
-	}
339
-
340
-	thisYear := now.Year()
341
-	thisMonth := int(now.Month())
342
-	beginningOfMonth, endOfMonth := utils.MonthBeginningToEnd(thisYear, thisMonth)
343
-	timesThisMonth, getTimesThisMonthErr := service.GetMonitoringTimesFromDayToDay(beginningOfMonth, endOfMonth)
344
-	if getTimesThisMonthErr != nil {
345
-		this.ErrorLog("获取本月监控次数失败:%v", getTimesThisMonthErr)
346
-	}
347
-
348
-	monthTimes := make([]map[string]interface{}, 0, 12)
349
-	for m := 1; m < 12; m++ {
350
-		if m > thisMonth {
351
-			break
352
-		}
353
-		if m == thisMonth {
354
-			monthTimes = append(monthTimes, map[string]interface{}{
355
-				"month": m,
356
-				"count": timesThisMonth,
357
-			})
358
-
359
-		} else {
360
-			BOM, EOM := utils.MonthBeginningToEnd(thisYear, m)
361
-			times, getTimesErr := service.GetMonitoringTimesFromDayToDay(BOM, EOM)
362
-			if getTimesErr != nil {
363
-				this.ErrorLog("获取%v月监控次数失败:%v", m, getTimesErr)
364
-			}
365
-			monthTimes = append(monthTimes, map[string]interface{}{
366
-				"month": m,
367
-				"count": times,
368
-			})
369
-		}
370
-	}
371
-
372
-	this.ServeSuccessJSON(map[string]interface{}{
373
-		"times_today":  timesToday,
374
-		"times_week":   timesThisWeek,
375
-		"times_month":  timesThisMonth,
376
-		"times_months": monthTimes,
377
-	})
378
-}
379
-
380
-// /admin/api/patient/analysis [get] PatientAnalysis
381
-func (this *AnalysisAPIController) PatientAnalysis() {
382
-	now := time.Now()
383
-	zeroHourTimeOfToday := utils.ZeroHourTimeOfDay(now)
384
-	newCountToday, getNewCountTodayErr := service.GetNewPatientCountFromDayToDay(zeroHourTimeOfToday, now)
385
-	if getNewCountTodayErr != nil {
386
-		this.ErrorLog("获取今日新增病人数失败:%v", getNewCountTodayErr)
387
-	}
388
-
389
-	monday, sunday := utils.GetMondayAndSundayOfWeekDate(&now)
390
-	newCountThisWeek, getNewCountThisWeekErr := service.GetNewPatientCountFromDayToDay(monday, sunday)
391
-	if getNewCountThisWeekErr != nil {
392
-		this.ErrorLog("获取本周新增病人数失败:%v", getNewCountThisWeekErr)
393
-	}
394
-
395
-	thisYear := now.Year()
396
-	thisMonth := int(now.Month())
397
-	beginningOfMonth, endOfMonth := utils.MonthBeginningToEnd(thisYear, thisMonth)
398
-	newCountThisMonth, getNewCountThisMonthErr := service.GetNewPatientCountFromDayToDay(beginningOfMonth, endOfMonth)
399
-	if getNewCountThisMonthErr != nil {
400
-		this.ErrorLog("获取本月新增病人数失败:%v", getNewCountThisMonthErr)
401
-	}
402
-
403
-	monthNewCounts := make([]map[string]interface{}, 0, 12)
404
-	for m := 1; m < 12; m++ {
405
-		if m > thisMonth {
406
-			break
407
-		}
408
-		if m == thisMonth {
409
-			monthNewCounts = append(monthNewCounts, map[string]interface{}{
410
-				"month": m,
411
-				"count": newCountThisMonth,
412
-			})
413
-
414
-		} else {
415
-			BOM, EOM := utils.MonthBeginningToEnd(thisYear, m)
416
-			newCount, getNewCountErr := service.GetNewPatientCountFromDayToDay(BOM, EOM)
417
-			if getNewCountErr != nil {
418
-				this.ErrorLog("获取%v月新增病人数失败:%v", m, getNewCountErr)
419
-			}
420
-			monthNewCounts = append(monthNewCounts, map[string]interface{}{
421
-				"month": m,
422
-				"count": newCount,
423
-			})
424
-		}
425
-	}
426
-
427
-	maleCount, femaleCount, unknowGenderCount, getGenderCountErr := service.GetPatientGenderDistribution()
428
-	if getGenderCountErr != nil {
429
-		this.ErrorLog("获取病人性别分布失败:%v", getGenderCountErr)
430
-	}
431
-
432
-	// 1乙肝 2丙肝 3艾滋病 4肺结核 5梅毒
433
-	// 不写错误日志了,累了
434
-	normalPCount, _ := service.GetInfectiousDiseasePatientCount(0)
435
-	type1PCount, _ := service.GetInfectiousDiseasePatientCount(1)
436
-	type2PCount, _ := service.GetInfectiousDiseasePatientCount(2)
437
-	type3PCount, _ := service.GetInfectiousDiseasePatientCount(3)
438
-	type4PCount, _ := service.GetInfectiousDiseasePatientCount(4)
439
-	type5PCount, _ := service.GetInfectiousDiseasePatientCount(5)
440
-
441
-	ageDistribution, getAgeDistributionErr := service.GetPatientAgeDistribution()
442
-	if getAgeDistributionErr != nil {
443
-		this.ErrorLog("获取病人年龄分布失败:%v", getAgeDistributionErr)
444
-		ageDistribution = make([]*service.PatientAgeCountStruct, 0, 0)
445
-	}
446
-
447
-	this.ServeSuccessJSON(map[string]interface{}{
448
-		"new_patient_count_today":  newCountToday,
449
-		"new_patient_count_week":   newCountThisWeek,
450
-		"new_patient_count_month":  newCountThisMonth,
451
-		"new_patient_count_months": monthNewCounts,
452
-
453
-		"male_count":   maleCount,
454
-		"female_count": femaleCount,
455
-		"total_count":  maleCount + femaleCount + unknowGenderCount,
456
-
457
-		"disease_type_0_count": normalPCount,
458
-		"disease_type_1_count": type1PCount,
459
-		"disease_type_2_count": type2PCount,
460
-		"disease_type_3_count": type3PCount,
461
-		"disease_type_4_count": type4PCount,
462
-		"disease_type_5_count": type5PCount,
463
-
464
-		"age_counts": ageDistribution,
465
-	})
466
-}

+ 0 - 35
controllers/admin_api_controllers/login_api_controller.go Просмотреть файл

@@ -1,35 +0,0 @@
1
-package admin_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-)
7
-
8
-type LoginAPIController struct {
9
-	AdminBaseAPIController
10
-}
11
-
12
-// /admin/api/login/pwd [post] LoginByPwd
13
-// @param account:string
14
-// @param password:string
15
-func (this *LoginAPIController) LoginByPwd() {
16
-	account := this.GetString("account")
17
-	password := this.GetString("password")
18
-
19
-	admin, getAdminErr := service.GetAdminAccount(account, password)
20
-	if getAdminErr != nil {
21
-		this.ErrorLog("获取管理员信息失败:%v", getAdminErr)
22
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
23
-		return
24
-	} else if admin == nil {
25
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
26
-		return
27
-	}
28
-
29
-	this.SetSession("admin_info", &AdminInfo{
30
-		Admin: admin,
31
-	})
32
-	this.ServeSuccessJSON(map[string]interface{}{
33
-		"admin": admin,
34
-	})
35
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 2223
controllers/advice_template.json


+ 0 - 383
controllers/base_api_controller.go Просмотреть файл

@@ -1,383 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"fmt"
8
-	"strconv"
9
-	"strings"
10
-)
11
-
12
-type BaseAPIController struct {
13
-	BaseController
14
-}
15
-
16
-// func (this *BaseAPIController) Prepare() {
17
-// 	this.BaseController.Prepare()
18
-// 	beego.Trace("============================================================")
19
-// 	beego.Trace("session ID: %v", this.Ctx.Input.Cookie("beegosessionID"))
20
-// 	beego.Trace("session : %v", this.GetSession("info"))
21
-// 	this.SetSession("info", time.Now().Format("2006/01/02 15:04:05"))
22
-// 	beego.Trace("============================================================")
23
-// }
24
-
25
-// 输出数据格式化
26
-/*
27
-	success json:
28
-	{
29
-		"state": 1,
30
-		"code": 0,
31
-		"data": json,
32
-	}
33
-
34
-	fail json:
35
-	{
36
-		"state": 0,
37
-		"code": int,
38
-		"msg": string,
39
-	}
40
-*/
41
-func (this *BaseAPIController) ServeSuccessJSON(data map[string]interface{}) {
42
-	this.Data["json"] = enums.MakeSuccessResponseJSON(data)
43
-	this.ServeJSON()
44
-}
45
-
46
-func (this *BaseAPIController) ServeFailJSONWithSGJErrorCode(code int) {
47
-	this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(code)
48
-	this.ServeJSON()
49
-}
50
-
51
-func (this *BaseAPIController) ServeFailJSONWithSGJError(err *enums.SGJError) {
52
-	this.Data["json"] = enums.MakeFailResponseJSONWithSGJError(err)
53
-	this.ServeJSON()
54
-}
55
-
56
-func (this *BaseAPIController) ServeFailJsonSend(code int, msg string) {
57
-	this.Data["json"] = enums.MakeFailResponseJSON(msg, code)
58
-	this.ServeJSON()
59
-}
60
-
61
-func (this *BaseAPIController) ServeDynamicFailJsonSend(msg string) {
62
-	this.Data["json"] = enums.MakeDynamicFailResponseJSON(msg)
63
-	this.ServeJSON()
64
-}
65
-
66
-type BaseAuthAPIController struct {
67
-	BaseAPIController
68
-}
69
-
70
-func (this *BaseAuthAPIController) Prepare() {
71
-	this.BaseAPIController.Prepare()
72
-	if this.GetAdminUserInfo() == nil {
73
-		var userAdmin models.AdminUser
74
-		userAdmin.Id = 1448
75
-		userAdmin.Mobile = "15717313968"
76
-
77
-		userAdmin.Id = 1 //4,809
78
-		userAdmin.Mobile = "12222222222"
79
-		userAdmin.IsSuperAdmin = true
80
-		userAdmin.Status = 1
81
-		userAdmin.CreateTime = 1530786071
82
-		userAdmin.ModifyTime = 1530786071
83
-		var subscibe models.ServeSubscibe
84
-		subscibe.ID = 11
85
-		subscibe.OrgId = 10341 //机构id
86
-		subscibe.PeriodStart = 1547447814
87
-		subscibe.PeriodEnd = 1550039814
88
-		subscibe.State = 1
89
-		subscibe.Status = 1
90
-		subscibe.CreatedTime = 1538035409
91
-		subscibe.UpdatedTime = 1538035409
92
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
-		subscibes[4] = &subscibe
94
-		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 10341 //机构id小英9675或4
96
-		adminUserInfo.CurrentAppId = 3295  //4
97
-		adminUserInfo.AdminUser = &userAdmin
98
-		adminUserInfo.Subscibes = subscibes
99
-		this.SetSession("admin_user_info", &adminUserInfo)
100
-
101
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
102
-		//this.StopRun()
103
-
104
-	}
105
-
106
-	adminUserInfo := this.GetAdminUserInfo()
107
-
108
-	if this.Ctx.Request.Header.Get("Permission") == "2" {
109
-		org, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
110
-		if adminUserInfo.AdminUser.Id != org.Creator { //超级管理员不受此限制
111
-
112
-			isPermission := false
113
-			adminUserInfo := this.GetAdminUserInfo()
114
-			//该机构下该用户有多少个
115
-			role, _ := service.GetUserAllRole(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id)
116
-			var roles []string
117
-			if len(role.RoleIds) <= 0 { //该用户没有设置角色
118
-
119
-			} else {
120
-				roles = strings.Split(role.RoleIds, ",")
121
-			}
122
-			fmt.Println(roles)
123
-
124
-			//获取该用户下所有角色的权限总集
125
-			var userRolePurviews string
126
-			var userRolePurviewsArr []string
127
-			for _, item := range roles {
128
-				role_id, _ := strconv.ParseInt(item, 10, 64)
129
-				purviews, _ := service.GetRoleFuncPurviewIds(role_id)
130
-				if len(userRolePurviews) == 0 {
131
-					userRolePurviews = purviews
132
-				} else {
133
-					userRolePurviews = userRolePurviews + "," + purviews
134
-				}
135
-			}
136
-			//该用户所拥有角色的权限的总集
137
-			userRolePurviewsArr = RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
138
-			fmt.Println(userRolePurviewsArr)
139
-			//系统所记录的权限列表
140
-			allPermission, _ := service.GetAllFunctionPurview()
141
-
142
-			for _, item := range allPermission {
143
-				// fmt.Println(len(strings.Split(item.Urlfor, ",")))
144
-
145
-				// fmt.Println(strings.Split(item.Urlfor, ","))
146
-				//fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
147
-
148
-				//判断当前路由是否在权限路由列表里面
149
-				if strings.Split(item.Urlfor, ",")[1] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
150
-
151
-					//获取该角色的所有权限
152
-					for _, items := range userRolePurviewsArr {
153
-						id, _ := strconv.ParseInt(items, 10, 64)
154
-						if id == item.ID {
155
-							isPermission = true
156
-						}
157
-					}
158
-					if !isPermission {
159
-						msg, _ := service.FindErrorMsgByStr(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
160
-						json := make(map[string]interface{})
161
-						json["msg"] = msg
162
-						json["code"] = 0
163
-						json["state"] = 0
164
-						this.Data["json"] = json
165
-						this.ServeJSON()
166
-						this.StopRun()
167
-					}
168
-				}
169
-			}
170
-		}
171
-	}
172
-
173
-	if this.Ctx.Request.Header.Get("Permission") == "3" {
174
-		org, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
175
-		if adminUserInfo.AdminUser.Id != org.Creator { //超级管理员不受此限制
176
-
177
-			isPermission := false
178
-			adminUserInfo := this.GetAdminUserInfo()
179
-			//该机构下该用户有多少个
180
-			role, _ := service.GetUserAllRole(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id)
181
-			var roles []string
182
-			if len(role.RoleIds) <= 0 { //该用户没有设置角色
183
-
184
-			} else {
185
-				roles = strings.Split(role.RoleIds, ",")
186
-			}
187
-			fmt.Println(roles)
188
-
189
-			//获取该用户下所有角色的权限总集
190
-			var userRolePurviews string
191
-			var userRolePurviewsArr []string
192
-			for _, item := range roles {
193
-				role_id, _ := strconv.ParseInt(item, 10, 64)
194
-				purviews, _ := service.GetRoleFuncPurviewIds(role_id)
195
-				if len(userRolePurviews) == 0 {
196
-					userRolePurviews = purviews
197
-				} else {
198
-					userRolePurviews = userRolePurviews + "," + purviews
199
-				}
200
-			}
201
-			//该用户所拥有角色的权限的总集
202
-			userRolePurviewsArr = RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
203
-			fmt.Println(userRolePurviewsArr)
204
-			//系统所记录的权限列表
205
-			allPermission, _ := service.GetAllFunctionPurview()
206
-
207
-			for _, item := range allPermission {
208
-				// fmt.Println(strings.Split(item.Urlfor, ",")[2])
209
-				// fmt.Println(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
210
-
211
-				//判断当前路由是否在权限路由列表里面
212
-				if strings.Split(item.Urlfor, ",")[2] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
213
-
214
-					//获取该角色的所有权限
215
-					for _, items := range userRolePurviewsArr {
216
-						id, _ := strconv.ParseInt(items, 10, 64)
217
-						if id == item.ID {
218
-							isPermission = true
219
-						}
220
-					}
221
-					if !isPermission {
222
-						msg, _ := service.FindErrorMsgByStr(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
223
-						json := make(map[string]interface{})
224
-						json["msg"] = msg
225
-						json["code"] = 0
226
-						json["state"] = 0
227
-						this.Data["json"] = json
228
-						this.ServeJSON()
229
-						this.StopRun()
230
-					}
231
-				}
232
-			}
233
-		}
234
-	}
235
-
236
-	//if this.Ctx.Request.Method != "GET" {
237
-	//	adminUserInfo := this.GetAdminUserInfo()
238
-	//
239
-	//	err := service.GetOrgSubscibeState(adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId])
240
-	//	if err != nil || adminUserInfo.Subscibes[adminUserInfo.CurrentOrgId].State == 3 {
241
-	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotSubscibe)
242
-	//		this.StopRun()
243
-	//	}
244
-	//}
245
-
246
-	//if this.Ctx.Request.Header.Get("Permission") == "1" {
247
-	//	isPermission := false
248
-	//
249
-	//	//adminUserInfo := this.GetAdminUserInfo()
250
-	//
251
-	//	//service.GetUserAllRole(adminUserInfo.CurrentOrgId)
252
-	//
253
-	//
254
-	//
255
-	//
256
-	//	roles := []int64{1,2}		//模拟该用户有多少角色
257
-	//	var targetRole models.RolePurview
258
-	//	var userRolePurview []string
259
-	//
260
-	//	//用户角色1对应的权限
261
-	//	role1 := models.RolePurview{PurviewIds:"11,12,13"}
262
-	//
263
-	//	//用户角色2对应的权限
264
-	//	role2 := models.RolePurview{PurviewIds:"11,15,16"}
265
-	//
266
-	//
267
-	//	//模拟角色2
268
-	//	//判断该用户有多少个角色,合并最大角色权限
269
-	//	if len(roles) == 1{ //单个
270
-	//		targetRole = role1
271
-	//		userRolePurview = strings.Split(targetRole.PurviewIds, ",")
272
-	//
273
-	//	}else{ //多个
274
-	//		targetRole = role1
275
-	//		targetRole.PurviewIds = targetRole.PurviewIds + "," + role2.PurviewIds
276
-	//		userRolePurview = strings.Split(targetRole.PurviewIds, ",")
277
-	//	}
278
-	//
279
-	//	userRolePurview = RemoveRepeatedElement2(userRolePurview)
280
-	//
281
-	//	fmt.Println(userRolePurview)
282
-	//	//所有权限列表
283
-	//	allPermission := []models.Purview{{Id:10,Urlfor:"/m/api/dialysis/dialysisPrescription-/api/dialysis/prescription"},
284
-	//		{Id:11,Urlfor:"/m/api/dialysis/dialysisPrescription1-/api/dialysis/prescription1"},
285
-	//		{Id:12,Urlfor:"/m/api/dialysis/dialysisPrescription2-/api/dialysis/prescription2"},
286
-	//		{Id:13,Urlfor:"/m/api/dialysis/dialysisPrescription3-/api/dialysis/prescription3"},
287
-	//		{Id:14,Urlfor:"/m/api/dialysis/dialysisPrescription4-/api/dialysis/prescription4"},
288
-	//		{Id:15,Urlfor:"/m/api/dialysis/dialysisPrescription5-/api/dialysis/prescription5"},
289
-	//		{Id:16,Urlfor:"/m/api/dialysis/dialysisPrescription6-/api/dialysis/prescription6"}}
290
-	//	for _, item := range allPermission {
291
-	//		//判断当前路由是否在权限路由列表里面
292
-	//		if strings.Split(item.Urlfor, "-")[1] == strings.Split(this.Ctx.Request.RequestURI , "?")[0]{
293
-	//			fmt.Println(strings.Split(this.Ctx.Request.RequestURI , "?")[0])
294
-	//
295
-	//			//获取该角色的所有权限
296
-	//			for _, items := range userRolePurview{
297
-	//				id, _ := strconv.ParseInt(items, 10, 64)
298
-	//				if id == item.Id{
299
-	//					isPermission = true
300
-	//				}
301
-	//			}
302
-	//			if !isPermission{
303
-	//				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePreExist)
304
-	//				this.StopRun()
305
-	//			}
306
-	//		}
307
-	//
308
-	//	}
309
-	//}
310
-}
311
-
312
-type BaseServeAPIController struct {
313
-	BaseAPIController
314
-}
315
-
316
-func (this *BaseServeAPIController) Prepare() {
317
-	this.BaseAPIController.Prepare()
318
-	if this.GetAdminUserInfo() == nil {
319
-		var userAdmin models.AdminUser
320
-		userAdmin.Id = 1448
321
-		userAdmin.Mobile = "15717313968"
322
-
323
-		userAdmin.Id = 1 //4,809
324
-		userAdmin.Mobile = "12222222222"
325
-		userAdmin.IsSuperAdmin = false
326
-		userAdmin.Status = 1
327
-		userAdmin.CreateTime = 1530786071
328
-		userAdmin.ModifyTime = 1530786071
329
-		var subscibe models.ServeSubscibe
330
-		subscibe.ID = 11
331
-		subscibe.OrgId = 10341 //机构id小英9675或4
332
-		subscibe.PeriodStart = 1538035409
333
-		subscibe.PeriodEnd = 1569571409
334
-		subscibe.State = 1
335
-		subscibe.Status = 1
336
-		subscibe.CreatedTime = 1538035409
337
-		subscibe.UpdatedTime = 1538035409
338
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
-		subscibes[4] = &subscibe
340
-		var adminUserInfo service.AdminUserInfo
341
-		adminUserInfo.CurrentOrgId = 10341 //机构id小英9675或4
342
-		adminUserInfo.CurrentAppId = 3295  //4
343
-		adminUserInfo.AdminUser = &userAdmin
344
-		adminUserInfo.Subscibes = subscibes
345
-		this.SetSession("admin_user_info", &adminUserInfo)
346
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
-		//this.StopRun()
348
-	}
349
-
350
-	//if adminUserInfo.AppRole != nil {
351
-	//	if adminUserInfo.AppRole.Id > 0 {
352
-	//		app_role, _ := service.FindAppRoleById(adminUserInfo.AppRole.Id)
353
-	//		if app_role != nil {
354
-	//			if app_role.Status != 1 {
355
-	//				this.DelSession("mobile_admin_user_info")
356
-	//				this.Ctx.SetCookie("token_cookie", "")
357
-	//				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeForbidden)
358
-	//				this.StopRun()
359
-	//			}
360
-	//		}
361
-	//	}
362
-	//
363
-	//}
364
-	//fmt.Println("222222222")
365
-
366
-}
367
-
368
-func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
369
-	newArr = make([]string, 0)
370
-	for i := 0; i < len(arr); i++ {
371
-		repeat := false
372
-		for j := i + 1; j < len(arr); j++ {
373
-			if arr[i] == arr[j] {
374
-				repeat = true
375
-				break
376
-			}
377
-		}
378
-		if !repeat {
379
-			newArr = append(newArr, arr[i])
380
-		}
381
-	}
382
-	return
383
-}

+ 0 - 40
controllers/base_controller.go Просмотреть файл

@@ -1,40 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/service"
5
-	"github.com/astaxie/beego"
6
-)
7
-
8
-type BaseController struct {
9
-	beego.Controller
10
-}
11
-
12
-func (this *BaseController) GetAdminUserInfo() *service.AdminUserInfo {
13
-	userInfo := this.GetSession("admin_user_info")
14
-	if userInfo == nil {
15
-		return nil
16
-	} else {
17
-		return userInfo.(*service.AdminUserInfo)
18
-	}
19
-}
20
-
21
-func (this *BaseController) ErrorLog(format string, a ...interface{}) {
22
-	//beego.Error(fmt.Sprintf(format, a...))
23
-}
24
-
25
-func (this *BaseController) WarnLog(format string, a ...interface{}) {
26
-	//beego.Warn(fmt.Sprintf(format, a...))
27
-}
28
-
29
-func (this *BaseController) InfoLog(format string, a ...interface{}) {
30
-	//beego.Info(fmt.Sprintf(format, a...))
31
-}
32
-
33
-func (this *BaseController) DebugLog(format string, a ...interface{}) {
34
-	//beego.Debug(fmt.Sprintf(format, a...))
35
-}
36
-
37
-func (this *BaseController) TraceLog(format string, a ...interface{}) {
38
-	//beego.Trace(fmt.Sprintf(format, a...))
39
-}
40
-

+ 0 - 58
controllers/base_view_controller.go Просмотреть файл

@@ -1,58 +0,0 @@
1
-package controllers
2
-
3
-type BaseViewController struct {
4
-	BaseController
5
-}
6
-
7
-// 设置模板
8
-// 第一个参数模板,第二个参数为layout
9
-func (this *BaseViewController) SetTpl(template ...string) {
10
-	var tplName string
11
-	layout := ""
12
-	switch {
13
-	case len(template) == 1:
14
-		tplName = template[0]
15
-	case len(template) == 2:
16
-		tplName = template[0]
17
-		layout = template[1]
18
-	default:
19
-		tplName = "index.tpl"
20
-	}
21
-	this.Layout = layout
22
-	this.TplName = tplName
23
-}
24
-
25
-// 重定向
26
-func (this *BaseViewController) Redirect302(url string) {
27
-	this.Redirect(url, 302)
28
-	this.StopRun()
29
-}
30
-
31
-// 错误页面
32
-func (this *BaseViewController) Abort404() {
33
-	this.Abort("404")
34
-}
35
-
36
-// // 微信错误页面
37
-// func (this *BaseViewController) WxAbort404(title, desc string) {
38
-// 	this.Data["Title"] = title
39
-// 	this.Data["Desc"] = desc
40
-// 	this.SetTpl("view_wx/error/404.html")
41
-// }
42
-
43
-// type BaseAuthViewController struct {
44
-// 	BaseViewController
45
-// }
46
-
47
-// func (this *BaseAuthViewController) Prepare() {
48
-// 	this.BaseController.Prepare()
49
-// 	backUrl := utils.SetThisRequestURI(this.Ctx.Request.RequestURI)
50
-// 	backUrl = base64.URLEncoding.EncodeToString([]byte(backUrl))
51
-// 	if this.GetUserInfo() == nil {
52
-// 		if strings.HasPrefix(this.Ctx.Request.RequestURI, "/web/") {
53
-// 			this.Redirect302(beego.URLFor("WebLoginViewController.Login") + "?backUrl=" + backUrl)
54
-// 		} else {
55
-// 			this.Redirect302(beego.URLFor("WxLoginViewController.Login") + "?backUrl=" + backUrl)
56
-// 		}
57
-// 	}
58
-// }

Разница между файлами не показана из-за своего большого размера
+ 0 - 2162
controllers/common_api_controller.go


+ 0 - 67
controllers/common_api_router.go Просмотреть файл

@@ -1,67 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"github.com/astaxie/beego"
5
-)
6
-
7
-func CommonApiControllersRegisterRouters() {
8
-
9
-	beego.Router("/com/api/getinspectionmajor", &CommonApiController{}, "Get:GetInspectionMajor")
10
-	beego.Router("/com/api/getinspectionminor", &CommonApiController{}, "Get:GetInspectionMinor")
11
-	beego.Router("/com/api/getinspectionrange", &CommonApiController{}, "Get:GetInspectionRange")
12
-	beego.Router("/com/api/saveconfiguration", &CommonApiController{}, "Post:SaveConfiguration")
13
-	beego.Router("com/api/getconfigurationlist", &CommonApiController{}, "Get:GetConfigurationlist")
14
-	beego.Router("com/api/getconfigurationdetail", &CommonApiController{}, "Get:GetConfigurationDetail")
15
-	beego.Router("com/api/getallinspectionminor", &CommonApiController{}, "Get:GetAllInspectionminor")
16
-	beego.Router("com/api/updateconfiguration", &CommonApiController{}, "Post:UpdateConfiguration")
17
-	beego.Router("com/api/deleteconfiguration", &CommonApiController{}, "Delete:DeleteConfiguration")
18
-	beego.Router("com/api/getallinspectiondata", &CommonApiController{}, "Get:GetAllInspectiondata")
19
-	beego.Router("/com/api/savecheckconfiguration", &CommonApiController{}, "Post:SaveCheckConfiguration")
20
-	beego.Router("/com/api/getallchecklist", &CommonApiController{}, "Get:GetAllCheckList")
21
-	beego.Router("/com/api/getcheckdetail", &CommonApiController{}, "Get:GetCheckdetail")
22
-	beego.Router("/com/api/updatecheck", &CommonApiController{}, "Post:UpdateCheck")
23
-	beego.Router("/com/api/deletecheck", &CommonApiController{}, "Delete:DeleteCheck")
24
-	beego.Router("/com/api/getdialysismodetype", &CommonApiController{}, "Get:GetDialysisModeType")
25
-	beego.Router("/com/api/gettotallapsecount", &CommonApiController{}, "Get:GetTotalLapseCount")
26
-	beego.Router("/com/api/gettotalsexcount", &CommonApiController{}, "Get:GetTotalSexCount")
27
-	beego.Router("/com/api/gettoalinfectiouscount", &CommonApiController{}, "Get:GetTotalInfectiouscount")
28
-	beego.Router("/com/api/gettotalagecount", &CommonApiController{}, "Get:GetTotalAgeCount")
29
-	beego.Router("/com/api/gettotaldialysiscount", &CommonApiController{}, "Get:GetTotalDialysisCount")
30
-	beego.Router("/com/api/getcurentorgpatients", &CommonApiController{}, "Get:GetCurentOrgPatients")
31
-	beego.Router("/com/api/getdialysislist", &CommonApiController{}, "Get:GetDialysislist")
32
-	beego.Router("/com/api/getlastsort", &CommonApiController{}, "Get:GetLastSort")
33
-	beego.Router("/com/api/getlastchecklist", &CommonApiController{}, "Get:GetLastCheckList")
34
-	beego.Router("/com/api/getdialysisdetailbyid", &CommonApiController{}, "Get:GetDialysisDetailById")
35
-	beego.Router("/com/api/getprescriptionbyname", &CommonApiController{}, "Get:GetPrescritionByName")
36
-	beego.Router("/com/api/getstatistics", &CommonApiController{}, "Get:GetStatistics")
37
-	beego.Router("/com/api/getinspectiontotalcount", &CommonApiController{}, "Get:GetInspectionTatolCount")
38
-	beego.Router("/com/api/getinspectionDetailById", &CommonApiController{}, "Get:GetInspectionDetailById")
39
-	beego.Router("/com/api/getsearchpatientinfo", &CommonApiController{}, "Get:GetSearchPatientInfo")
40
-	beego.Router("/com/api/getallmajorInspection", &CommonApiController{}, "Get:GetAllMajorInspection")
41
-	beego.Router("/com/api/getpatientlist", &CommonApiController{}, "Get:GetPatientList")
42
-	beego.Router("/com/api/getPatientDetailCheck", &CommonApiController{}, "Get:GetPatientDetailCheck")
43
-	beego.Router("/com/api/searchdetailcheck", &CommonApiController{}, "Get:GetSearchDetailCheck")
44
-	beego.Router("/com/api/getnormdata", &CommonApiController{}, "Get:GetNormData")
45
-	beego.Router("/com/api/getfirstquarter", &CommonApiController{}, "Get:GetFirstQuarter")
46
-	beego.Router("/com/api/getprojectlist", &CommonApiController{}, "Get:GetProjectList")
47
-	beego.Router("/com/api/getmonthprojectlist", &CommonApiController{}, "Get:GetMonthProjectList")
48
-	beego.Router("/com/api/getpatientscontrol", &CommonApiController{}, "Get:GetPatientscontrol")
49
-	beego.Router("/com/api/getcartogramlist", &CommonApiController{}, "Get:GetCartogramList")
50
-	beego.Router("/com/api/getpatientcontor", &CommonApiController{}, "Get:GetPatientContor")
51
-	beego.Router("/com/api/getqualitycontrol", &CommonApiController{}, "Get:GetQualityControl")
52
-	beego.Router("/com/api/gettreatlist", &CommonApiController{}, "Get:GetTreatlist")
53
-	beego.Router("/com/api/getpatientcompliancedetal", &CommonApiController{}, "Get:GetPatientComplianceDetail")
54
-	beego.Router("/com/api/getbloodpressuredetail", &CommonApiController{}, "Get:GetBloodPressureDetail")
55
-	beego.Router("/com/api/updatebloodprussre", &CommonApiController{}, "Post:UpdateBloodPrussre")
56
-	beego.Router("/com/api/getbloodpressurelist", &CommonApiController{}, "Get:GetBloodPressureList")
57
-	beego.Router("/com/api/getmonthbloodlist", &CommonApiController{}, "Get:GetMonthBloodList")
58
-	beego.Router("/com/api/getidslist", &CommonApiController{}, "Post:GetIdsListTwo")
59
-	beego.Router("/com/api/getreatmodelist", &CommonApiController{}, "Get:GetTreatModeList")
60
-	beego.Router("/com/api/getcountmodeid", &CommonApiController{}, "Get:GetCountModeId")
61
-	beego.Router("/com/api/getrolloutcount", &CommonApiController{}, "Get:GetRolloutCount")
62
-
63
-	beego.Router("/com/api/getrolloutcount", &CommonApiController{}, "Get:GetRolloutCount")
64
-
65
-	beego.Router("/com/api/getcheckexamine", &CommonApiController{}, "Get:GetCheckExamine")
66
-
67
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1164
controllers/coordinate_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 1832
controllers/data_api_controller.go


+ 0 - 15
controllers/default.go Просмотреть файл

@@ -1,15 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"github.com/astaxie/beego"
5
-)
6
-
7
-type MainController struct {
8
-	beego.Controller
9
-}
10
-
11
-func (c *MainController) Get() {
12
-	c.Data["Website"] = "beego.me"
13
-	c.Data["Email"] = "astaxie@gmail.com"
14
-	c.TplName = "index.tpl"
15
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1261
controllers/device_api_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 6100
controllers/dialysis_api_controller.go


+ 0 - 58
controllers/dialysis_board_api_controller.go Просмотреть файл

@@ -1,58 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-	"XT_New/utils"
7
-	"time"
8
-
9
-	"github.com/astaxie/beego"
10
-)
11
-
12
-func DialysisBoardAPIControllerRegistRouter() {
13
-	beego.Router("/api/dialysis/board", &DialysisBoardAPIController{}, "get:BoardData")
14
-}
15
-
16
-type DialysisBoardAPIController struct {
17
-	BaseAuthAPIController
18
-}
19
-
20
-func (c *DialysisBoardAPIController) BoardData() {
21
-	page, _ := c.GetInt64("page", 0)
22
-	if page <= 0 {
23
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
24
-		return
25
-	}
26
-	nowTimeUinx := time.Now()
27
-	today := nowTimeUinx.Format("2006-01-02")
28
-	week := nowTimeUinx.Weekday()
29
-
30
-	timeLayout := "2006-01-02"
31
-	loc, _ := time.LoadLocation("Local")
32
-
33
-	todayTime, err := time.ParseInLocation(timeLayout, today, loc)
34
-	if err != nil {
35
-		utils.ErrorLog("%v", err)
36
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
37
-		return
38
-	}
39
-	var limit int64 = 10
40
-	offset := (page - 1) * limit
41
-	todayTimeStamp := todayTime.Unix()
42
-
43
-	adminUserInfo := c.GetAdminUserInfo()
44
-
45
-	boards, err := service.GetDialysisBoard(adminUserInfo.CurrentOrgId, todayTimeStamp, offset, limit)
46
-	if err != nil {
47
-		utils.ErrorLog("%v", err)
48
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
49
-		return
50
-	}
51
-
52
-	c.ServeSuccessJSON(map[string]interface{}{
53
-		"today":  today,
54
-		"week":   week,
55
-		"boards": boards,
56
-	})
57
-
58
-}

+ 0 - 436
controllers/dialysis_parameter_api_controller.go Просмотреть файл

@@ -1,436 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-	"fmt"
7
-	"github.com/astaxie/beego"
8
-	"github.com/jinzhu/gorm"
9
-	"strings"
10
-	"time"
11
-)
12
-
13
-type DialysisPrameterApiController struct {
14
-	BaseAuthAPIController
15
-}
16
-
17
-func DialysisPrameteRoutes() {
18
-	beego.Router("/api/dialysis/getdialysisparameters", &DialysisPrameterApiController{}, "Get:GetDialysisParameters")
19
-	beego.Router("/api/dialysis/getdialysisbatchparameters", &DialysisPrameterApiController{}, "Get:GetDialysisBatchParameters")
20
-	beego.Router("/api/dialysis/getwarehouseoutlist", &DialysisPrameterApiController{}, "Get:GetWareHouseOutList")
21
-	beego.Router("/api/dialysis/getallmaterial", &DialysisPrameterApiController{}, "Get:GetAllMaterial")
22
-	beego.Router("/api/dialysis/getcollectlist", &DialysisPrameterApiController{}, "Get:GetCollectList")
23
-	beego.Router("/api/dialysis/getbatchcollection", &DialysisPrameterApiController{}, "Get:GetBatchCollection")
24
-	beego.Router("/api/dialysis/getgatherlist", &DialysisPrameterApiController{}, "Get:GetGatherList")
25
-	beego.Router("/api/dialysis/getanticoagulantcount", &DialysisPrameterApiController{}, "Get:GetAnticoagulantCount")
26
-}
27
-
28
-func (this *DialysisPrameterApiController) GetDialysisParameters() {
29
-	timeLayout := "2006-01-02"
30
-	loc, _ := time.LoadLocation("Local")
31
-	page, _ := this.GetInt64("page")
32
-	limit, _ := this.GetInt64("limit")
33
-	schedulType, _ := this.GetInt64("scheduleType")
34
-	start_time := this.GetString("start_time")
35
-	partitionType, _ := this.GetInt64("partitionType")
36
-	keywords := this.GetString("keyword")
37
-	adminUserInfo := this.GetAdminUserInfo()
38
-	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
39
-
40
-	if len(keywords) > 0 {
41
-		dialysisSchedule, err, total := service.GetDialysisParametersByKeyword(adminUserInfo.CurrentOrgId, keywords, schedulType, partitionType, page, limit, theTime.Unix())
42
-		patient, err := service.GetDialysisTodaySchedulePatient(adminUserInfo.CurrentOrgId, theTime.Unix(), page, limit, keywords, schedulType, partitionType)
43
-		var vlist []interface{}
44
-		var elist []interface{}
45
-		for _, item := range patient {
46
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
47
-			vlist = append(vlist, prescription)
48
-			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
49
-			elist = append(elist, dialysis)
50
-		}
51
-		if err == nil {
52
-			this.ServeSuccessJSON(map[string]interface{}{
53
-				"schedule":     dialysisSchedule,
54
-				"total":        total,
55
-				"prescription": vlist,
56
-				"dialysbefor":  elist,
57
-				"patient":      patient,
58
-			})
59
-		} else {
60
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
61
-		}
62
-	} else {
63
-		dialysisSchedule, err, total := service.GetDialysisParameter(adminUserInfo.CurrentOrgId, theTime.Unix(), schedulType, partitionType, page, limit)
64
-
65
-		//查询今日排班的病人
66
-		patient, err := service.GetDialysisTodaySchedulePatient(adminUserInfo.CurrentOrgId, theTime.Unix(), page, limit, keywords, schedulType, partitionType)
67
-
68
-		var vlist []interface{}
69
-		var elist []interface{}
70
-		for _, item := range patient {
71
-			//查询当前日期的病人是否存在数据
72
-			//_, errcode := service.GetToDayDialysisPrescription(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
73
-			//if errcode == gorm.ErrRecordNotFound {
74
-			//	//查询每个病人透析处方的最后一次数据
75
-			//	prescription, _ := service.GetLastDialysisPrescription(item.PatientId, adminUserInfo.CurrentOrgId)
76
-			//	vlist = append(vlist, prescription)
77
-			//} else if errcode == nil {
78
-			//	//获取当前日期
79
-			//	prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
80
-			//	vlist = append(vlist, prescription)
81
-			//}
82
-
83
-			//_, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
84
-			//if errcodes == gorm.ErrRecordNotFound {
85
-			//	//查询每个病人透前评估的最后一次数据
86
-			//	dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, adminUserInfo.CurrentOrgId)
87
-			//	elist = append(elist, dialysis)
88
-			//} else if errcodes == nil {
89
-			//	dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
90
-			//	elist = append(elist, dialysis)
91
-			//}
92
-
93
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
94
-			vlist = append(vlist, prescription)
95
-			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, adminUserInfo.CurrentOrgId, theTime.Unix())
96
-			elist = append(elist, dialysis)
97
-		}
98
-
99
-		if err == nil {
100
-			this.ServeSuccessJSON(map[string]interface{}{
101
-				"schedule":     dialysisSchedule,
102
-				"total":        total,
103
-				"prescription": vlist,
104
-				"dialysbefor":  elist,
105
-				"patient":      patient,
106
-			})
107
-		} else {
108
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
109
-		}
110
-	}
111
-
112
-}
113
-
114
-func (this *DialysisPrameterApiController) GetDialysisBatchParameters() {
115
-	timeLayout := "2006-01-02"
116
-	loc, _ := time.LoadLocation("Local")
117
-	adminUser := this.GetAdminUserInfo()
118
-	orgId := adminUser.CurrentOrgId
119
-	schIDStr := this.GetString("ids")
120
-	if len(schIDStr) == 0 {
121
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
122
-		return
123
-	}
124
-	idStrs := strings.Split(schIDStr, ",")
125
-	startime := this.GetString("startime")
126
-	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", startime+" 00:00:00", loc)
127
-	parameters, err := service.GetDialysisBatchParameters(idStrs, orgId)
128
-	var vlist []interface{}
129
-	var elist []interface{}
130
-	for _, item := range parameters {
131
-		//查询当前日期的病人是否存在数据
132
-		_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, theTime.Unix())
133
-		if errcode == gorm.ErrRecordNotFound {
134
-			//查询每个病人透析处方的最后一次数据
135
-			prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
136
-			vlist = append(vlist, prescription)
137
-		} else if errcode == nil {
138
-			//获取当前日期
139
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, theTime.Unix())
140
-			vlist = append(vlist, prescription)
141
-		}
142
-
143
-		_, errcodes := service.GetTodayAssessmentBeforDialysis(item.PatientId, orgId, theTime.Unix())
144
-		if errcodes == gorm.ErrRecordNotFound {
145
-			//查询每个病人透前评估的最后一次数据
146
-			dialysis, _ := service.GetLastAssessmentBeforDialysis(item.PatientId, orgId)
147
-			elist = append(elist, dialysis)
148
-		} else if errcodes == nil {
149
-			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgId, theTime.Unix())
150
-			elist = append(elist, dialysis)
151
-		}
152
-
153
-	}
154
-	if err == nil {
155
-		this.ServeSuccessJSON(map[string]interface{}{
156
-			"schedule":     parameters,
157
-			"prescription": vlist,
158
-			"dialysbefor":  elist,
159
-		})
160
-	}
161
-}
162
-
163
-func (this *DialysisPrameterApiController) GetWareHouseOutList() {
164
-
165
-	timeLayout := "2006-01-02"
166
-	loc, _ := time.LoadLocation("Local")
167
-	start_time := this.GetString("start_time")
168
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
169
-	end_time := this.GetString("end_time")
170
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
171
-	fmt.Println(start_time, end_time)
172
-	adminUserInfo := this.GetAdminUserInfo()
173
-	orgId := adminUserInfo.CurrentOrgId
174
-	wareoutlist, err := service.GetWareHouseOutList(startime.Unix(), endtime.Unix(), orgId)
175
-	if err == nil {
176
-		this.ServeSuccessJSON(map[string]interface{}{
177
-			"wareoutlist": wareoutlist,
178
-		})
179
-	}
180
-}
181
-
182
-func (this *DialysisPrameterApiController) GetAllMaterial() {
183
-
184
-	timeLayout := "2006-01-02"
185
-	loc, _ := time.LoadLocation("Local")
186
-	start_time := this.GetString("startime")
187
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
188
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 23:59:59", loc)
189
-	orgId := this.GetAdminUserInfo().CurrentOrgId
190
-	material, err := service.GetAllMaterial(startime.Unix(), endtime.Unix(), orgId)
191
-	if err == nil {
192
-		this.ServeSuccessJSON(map[string]interface{}{
193
-			"material": material,
194
-		})
195
-	}
196
-}
197
-
198
-func (this *DialysisPrameterApiController) GetCollectList() {
199
-
200
-	timeLayout := "2006-01-02"
201
-	loc, _ := time.LoadLocation("Local")
202
-	limit, _ := this.GetInt64("limit")
203
-	fmt.Println(limit)
204
-	page, _ := this.GetInt64("page")
205
-	fmt.Println("page", page)
206
-	partitiontype, _ := this.GetInt64("partitionType")
207
-	fmt.Println(partitiontype)
208
-	scheduletype, _ := this.GetInt64("scheduleType")
209
-	fmt.Println(scheduletype)
210
-	start_time := this.GetString("start_time")
211
-	fmt.Println(start_time)
212
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
213
-	fmt.Println("startime", startime.Unix())
214
-	orgId := this.GetAdminUserInfo().CurrentOrgId
215
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 23:59:59", loc)
216
-	keyword := this.GetString("keyword")
217
-	//获取透析参数数据
218
-	schedule, err, _ := service.GetCollectList(limit, page, partitiontype, scheduletype, startime.Unix(), orgId, keyword)
219
-
220
-	//查询今日排班的病人
221
-	patient, err := service.GetDialysisTodaySchedulePatient(orgId, startime.Unix(), page, limit, keyword, scheduletype, partitiontype)
222
-	var vlist []interface{}
223
-	var clist []interface{}
224
-	for _, item := range patient {
225
-		fmt.Println("---------", item.PatientId)
226
-		//查询当前日期的病人是否存在数据
227
-		//_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, startime.Unix())
228
-		//if errcode == gorm.ErrRecordNotFound {
229
-		//	//查询每个病人透析处方的最后一次数据
230
-		//	prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
231
-		//	vlist = append(vlist, prescription)
232
-		//} else if errcode == nil {
233
-		//	//获取当前日期
234
-		//	prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
235
-		//	vlist = append(vlist, prescription)
236
-		//}
237
-
238
-		//查询每个病人当前日期是否存在数据
239
-		//_, errco := service.GetAotoMaticReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
240
-		//fmt.Println("errco--------------------------", errco)
241
-		//if errco == gorm.ErrRecordNotFound {
242
-		//	reduece, _ := service.GetMaticReduece(item.PatientId, orgId)
243
-		//	clist = append(clist, reduece)
244
-		//} else if errco == nil {
245
-		//	reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
246
-		//	clist = append(clist, reduece)
247
-		//}
248
-
249
-		prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
250
-		vlist = append(vlist, prescription)
251
-
252
-		reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
253
-		clist = append(clist, reduece)
254
-	}
255
-	//获取透析耗材数据
256
-	//consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
257
-
258
-	//if err == nil {
259
-	// this.ServeSuccessJSON(map[string]interface{}{
260
-	//   "schedule":     schedule,
261
-	//   "total":        total,
262
-	//   "consumables":  consumables,
263
-	//   "prescription": vlist,
264
-	//   "reducelist":   clist,
265
-	// })
266
-	//}
267
-
268
-	_, errors := service.FindStockOutByIsSys(orgId, 1, startime.Unix())
269
-
270
-	goodTypes, _ := service.FindAllGoodType(orgId) //two, err, i := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
271
-
272
-	if errors == gorm.ErrRecordNotFound {
273
-
274
-		dialysisGoods, _, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
275
-		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
276
-			goodUser, _ := service.GetLastDialysisGoodsTwo(item.PatientId, orgId, startime.Unix())
277
-			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepareTwo(item.PatientId, orgId, startime.Unix())
278
-			item.LastAutomaticReduceDetail = goodUser
279
-			item.LastDialysisBeforePrepare = lastGoodUserDetial
280
-		}
281
-		this.ServeSuccessJSON(map[string]interface{}{
282
-			"dialysis_goods": dialysisGoods,
283
-			"good_type":      goodTypes,
284
-			"total":          total,
285
-			"schedule":       schedule,
286
-			//"consumables":    consumables,
287
-			"prescription": vlist,
288
-			"reducelist":   clist,
289
-		})
290
-		return
291
-
292
-	} else if err == nil {
293
-		//获取当天排班的每个患者的库存使用情况
294
-		dialysisGoods, err, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
295
-		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
296
-			goodUser, _ := service.GetLastDialysisGoodsTwo(item.PatientId, orgId, startime.Unix())
297
-			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepareTwo(item.PatientId, orgId, startime.Unix())
298
-
299
-			fmt.Println(goodUser)
300
-			fmt.Println(lastGoodUserDetial)
301
-
302
-			item.LastAutomaticReduceDetail = goodUser
303
-			item.LastDialysisBeforePrepare = lastGoodUserDetial
304
-		}
305
-		if err == nil {
306
-			this.ServeSuccessJSON(map[string]interface{}{
307
-				"dialysis_goods": dialysisGoods,
308
-				"good_type":      goodTypes,
309
-				"total":          total,
310
-				"schedule":       schedule,
311
-				//"consumables":    consumables,
312
-				"prescription": vlist,
313
-				"reducelist":   clist,
314
-			})
315
-			return
316
-
317
-		} else {
318
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
319
-			return
320
-		}
321
-	} else if err != nil {
322
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
323
-		return
324
-
325
-	}
326
-
327
-}
328
-
329
-func (this *DialysisPrameterApiController) GetBatchCollection() {
330
-	timeLayout := "2006-01-02"
331
-	loc, _ := time.LoadLocation("Local")
332
-	adminUser := this.GetAdminUserInfo()
333
-	orgId := adminUser.CurrentOrgId
334
-	fmt.Println(orgId)
335
-	start_time := this.GetString("startime")
336
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
337
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 23:59:59", loc)
338
-	schIDStr := this.GetString("ids")
339
-	//获取透析耗材数据
340
-	consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
341
-
342
-	if len(schIDStr) == 0 {
343
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
344
-		return
345
-	}
346
-	idStrs := strings.Split(schIDStr, ",")
347
-	fmt.Println(idStrs)
348
-	var vlist []interface{}
349
-	var clist []interface{}
350
-	schedule, err := service.GetBatchCollection(orgId, idStrs)
351
-	for _, item := range schedule {
352
-		//查询当前日期的病人是否存在数据
353
-		_, errcode := service.GetToDayDialysisPrescription(item.PatientId, orgId, startime.Unix())
354
-		if errcode == gorm.ErrRecordNotFound {
355
-			//查询每个病人透析处方的最后一次数据
356
-			prescription, _ := service.GetLastDialysisPrescription(item.PatientId, orgId)
357
-			vlist = append(vlist, prescription)
358
-		} else if errcode == nil {
359
-			//获取当前日期
360
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
361
-			vlist = append(vlist, prescription)
362
-		}
363
-
364
-		//查询每个病人当前日期是否存在数据
365
-		_, errco := service.GetAotoMaticReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
366
-		fmt.Println("errco", errco)
367
-		if errco == gorm.ErrRecordNotFound {
368
-			reduece, _ := service.GetMaticReduece(item.PatientId, orgId)
369
-			clist = append(clist, reduece)
370
-		} else if errco == nil {
371
-			reduece, _ := service.GetMaticeReduceByPatientId(item.PatientId, orgId, startime.Unix(), endtime.Unix())
372
-			clist = append(clist, reduece)
373
-		}
374
-
375
-	}
376
-	if err == nil {
377
-		this.ServeSuccessJSON(map[string]interface{}{
378
-			"schedule":     schedule,
379
-			"consumables":  consumables,
380
-			"prescripiton": vlist,
381
-			"reducelist":   clist,
382
-		})
383
-	}
384
-}
385
-
386
-func (this *DialysisPrameterApiController) GetGatherList() {
387
-
388
-	timeLayout := "2006-01-02"
389
-	loc, _ := time.LoadLocation("Local")
390
-	adminUser := this.GetAdminUserInfo()
391
-	orgId := adminUser.CurrentOrgId
392
-	fmt.Println(orgId)
393
-	start_time := this.GetString("start_time")
394
-	end_time := this.GetString("end_time")
395
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
396
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
397
-	fmt.Println("开始时间", startime)
398
-	fmt.Println("结束时间", endtime)
399
-
400
-	warehouselist, err := service.GetWareHouseOutList(startime.Unix(), endtime.Unix(), orgId)
401
-
402
-	//获取透析耗材数据
403
-	consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
404
-
405
-	//统计抗凝剂数据
406
-	count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
407
-
408
-	if err == nil {
409
-		this.ServeSuccessJSON(map[string]interface{}{
410
-			"warehouselist": warehouselist,
411
-			"consumables":   consumables,
412
-			"count":         count,
413
-		})
414
-	}
415
-}
416
-
417
-func (this *DialysisPrameterApiController) GetAnticoagulantCount() {
418
-	timeLayout := "2006-01-02"
419
-	loc, _ := time.LoadLocation("Local")
420
-	adminUser := this.GetAdminUserInfo()
421
-	orgId := adminUser.CurrentOrgId
422
-	fmt.Println(orgId)
423
-	start_time := this.GetString("start_time")
424
-	end_time := this.GetString("end_time")
425
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
426
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
427
-	fmt.Println("开始时间2222", startime)
428
-	fmt.Println("结束时间3333", endtime)
429
-	//统计抗凝剂数据
430
-	count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
431
-	if err == nil {
432
-		this.ServeSuccessJSON(map[string]interface{}{
433
-			"count": count,
434
-		})
435
-	}
436
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1961
controllers/dialysis_record_api_controller.go


+ 0 - 25
controllers/district_api_controller.go Просмотреть файл

@@ -1,25 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/service"
5
-
6
-	"github.com/astaxie/beego"
7
-)
8
-
9
-type DistrictApiController struct {
10
-	BaseAuthAPIController
11
-}
12
-
13
-func DistrictApiRegistRouters() {
14
-	beego.Router("/api/district/getdistrictsbyupid", &DistrictApiController{}, "get:GetDistrictsByUpid")
15
-}
16
-
17
-func (c *DistrictApiController) GetDistrictsByUpid() {
18
-	id, _ := c.GetInt64("id", 0)
19
-	citys, _ := service.GetDistrictsByUpid(id)
20
-
21
-	c.ServeSuccessJSON(map[string]interface{}{
22
-		"citys": citys,
23
-	})
24
-	return
25
-}

+ 0 - 658
controllers/doctor_schedule_api_controller.go Просмотреть файл

@@ -1,658 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"fmt"
8
-	"github.com/astaxie/beego"
9
-	"github.com/jinzhu/gorm"
10
-	"time"
11
-)
12
-
13
-type DoctorScheduleApiController struct {
14
-	BaseAuthAPIController
15
-}
16
-
17
-func DoctorScheduleRouters() {
18
-
19
-	beego.Router("/api/schedules/savedoctorschedules", &DoctorScheduleApiController{}, "Get:SaveDoctorSchedules")
20
-	beego.Router("/api/schedules/getdoctorschedulelist", &DoctorScheduleApiController{}, "Get:GetDoctorScheduleList")
21
-	beego.Router("/api/schedules/getscheduledetail", &DoctorScheduleApiController{}, "Get:GetScheduleDetail")
22
-	beego.Router("/api/schedules/updateschedule", &DoctorScheduleApiController{}, "Get:UpdateSchedule")
23
-	beego.Router("/api/schedule/deleteschedule", &DoctorScheduleApiController{}, "Get:DeleteSchedule")
24
-	beego.Router("/api/schedule/getdoctorlist", &DoctorScheduleApiController{}, "Get:GetDoctorList")
25
-	beego.Router("/api/schedule/getschedulelist", &DoctorScheduleApiController{}, "Get:GetScheduleList")
26
-	beego.Router("/api/schedule/addschedule", &DoctorScheduleApiController{}, "Get:AddSchedule")
27
-	beego.Router("/api/schedule/getstaffschedulelist", &DoctorScheduleApiController{}, "Get:GetStaffScheduleList")
28
-	beego.Router("/api/schedule/getnextweeklist", &DoctorScheduleApiController{}, "Get:GetNextWeekList")
29
-	beego.Router("/api/schedule/getschedulebydoctorid", &DoctorScheduleApiController{}, "Get:GetScheduleByDoctorId")
30
-	beego.Router("/api/schedule/tosearchsechedulelist", &DoctorScheduleApiController{}, "Get:ToSearchScheduleList")
31
-	beego.Router("api/schedule/deletestaffschedule", &DoctorScheduleApiController{}, "Get:DeleteStaffSchedule")
32
-	beego.Router("/api/schedule/copystaffschedule", &DoctorScheduleApiController{}, "Get:CopyStaffSchedule")
33
-	beego.Router("/api/scheudle/updatecontinusschedule", &DoctorScheduleApiController{}, "Get:UpdateContinusSchedule")
34
-	beego.Router("/api/schedule/savenursesort", &DoctorScheduleApiController{}, "Get:SaveNureSort")
35
-	beego.Router("/api/schedule/saveisschedule", &DoctorScheduleApiController{}, "Get:SaveIsSchedule")
36
-	beego.Router("/api/schedule/getscheudlelisttotal", &DoctorScheduleApiController{}, "Get:GetScheduleListTotal")
37
-	beego.Router("/api/schedule/tosearchtotal", &DoctorScheduleApiController{}, "Get:ToSeachTotal")
38
-	beego.Router("/api/schedule/changeoption", &DoctorScheduleApiController{}, "Get:ChangeOption")
39
-	beego.Router("/api/schedule/getchartlist", &DoctorScheduleApiController{}, "Get:GetChartlist")
40
-
41
-}
42
-
43
-func (this *DoctorScheduleApiController) SaveDoctorSchedules() {
44
-	adminUser := this.GetAdminUserInfo()
45
-	orgId := adminUser.CurrentOrgId
46
-	class_name := this.GetString("class_name")
47
-	class_attributes, _ := this.GetInt64("class_attributes")
48
-	timeone_start := this.GetString("timeone_start")
49
-	timeone_type, _ := this.GetInt64("timeone_type")
50
-	timeone_end := this.GetString("timeone_end")
51
-	timetwo_start := this.GetString("timetwo_start")
52
-	timetwo_type, _ := this.GetInt64("timetwo_type")
53
-	timetwo_end := this.GetString("timetwo_end")
54
-	work_time := this.GetString("work_time")
55
-	remarks := this.GetString("remarks")
56
-	minute, _ := this.GetInt64("minute")
57
-	schedules := models.DoctorSchedules{
58
-		ClassName:       class_name,
59
-		ClassAttributes: class_attributes,
60
-		TimeoneStart:    timeone_start,
61
-		TimeoneType:     timeone_type,
62
-		TimeoneEnd:      timeone_end,
63
-		TimetwoStart:    timetwo_start,
64
-		TimetwoEnd:      timetwo_end,
65
-		TimetwoType:     timetwo_type,
66
-		WorkTime:        work_time,
67
-		Remarks:         remarks,
68
-		UserOrgId:       orgId,
69
-		Status:          1,
70
-		Ctime:           time.Now().Unix(),
71
-		Minute:          minute,
72
-	}
73
-
74
-	//查询班种名称是否存在
75
-	_, errcode := service.GetClassName(orgId, class_name)
76
-	//如果不存在
77
-	if errcode == gorm.ErrRecordNotFound {
78
-		err := service.CreateDotorSchedule(&schedules)
79
-		if err != nil {
80
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
81
-			return
82
-		}
83
-
84
-		this.ServeSuccessJSON(map[string]interface{}{
85
-			"schedules": schedules,
86
-		})
87
-	} else if errcode == nil {
88
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "班种名称已存在")
89
-		return
90
-	}
91
-
92
-}
93
-
94
-func (this *DoctorScheduleApiController) GetDoctorScheduleList() {
95
-	adminUserInfo := this.GetAdminUserInfo()
96
-	orgId := adminUserInfo.CurrentOrgId
97
-	page, _ := this.GetInt64("page")
98
-	limit, _ := this.GetInt64("limit")
99
-	schedules, total, err := service.GetDoctorScheduleList(orgId, page, limit)
100
-	if err != nil {
101
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
102
-		return
103
-	}
104
-
105
-	this.ServeSuccessJSON(map[string]interface{}{
106
-		"schedules": schedules,
107
-		"total":     total,
108
-	})
109
-	//查询该机构是否有班种,如果没有去读系统默认的
110
-	//_, errcode := service.GetDoctorScheduleByOrgId(orgId)
111
-	//if errcode == gorm.ErrRecordNotFound{
112
-	//  schedules, total, err := service.GetDoctorScheduleList(0,page, limit)
113
-	//  if err != nil {
114
-	//    this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
115
-	//    return
116
-	//  }
117
-	//
118
-	//  this.ServeSuccessJSON(map[string]interface{}{
119
-	//    "schedules": schedules,
120
-	//    "total":total,
121
-	//  })
122
-	//}else if errcode == nil{
123
-	//  schedules, total, err := service.GetDoctorScheduleList(orgId, page, limit)
124
-	//  if err != nil {
125
-	//    this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
126
-	//    return
127
-	//  }
128
-	//
129
-	//  this.ServeSuccessJSON(map[string]interface{}{
130
-	//    "schedules": schedules,
131
-	//    "total":total,
132
-	//  })
133
-	//}
134
-}
135
-
136
-func (this *DoctorScheduleApiController) GetScheduleDetail() {
137
-
138
-	id, _ := this.GetInt64("id")
139
-	scheduleDetail, err := service.GetScheduleDetail(id)
140
-	if err != nil {
141
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
142
-		return
143
-	}
144
-
145
-	this.ServeSuccessJSON(map[string]interface{}{
146
-		"scheduleDetail": scheduleDetail,
147
-	})
148
-}
149
-
150
-func (this *DoctorScheduleApiController) UpdateSchedule() {
151
-
152
-	id, _ := this.GetInt64("id")
153
-	class_name := this.GetString("class_name")
154
-	class_attributes, _ := this.GetInt64("class_attributes")
155
-	timeone_start := this.GetString("timeone_start")
156
-	timeone_type, _ := this.GetInt64("timeone_type")
157
-	timeone_end := this.GetString("timeone_end")
158
-	timetwo_start := this.GetString("timetwo_start")
159
-	timetwo_type, _ := this.GetInt64("timetwo_type")
160
-	timetwo_end := this.GetString("timetwo_end")
161
-	work_time := this.GetString("work_time")
162
-	remarks := this.GetString("remarks")
163
-	user_org_id, _ := this.GetInt64("user_org_id")
164
-	minute, _ := this.GetInt64("minute")
165
-	schedules := models.DoctorSchedules{
166
-		ClassName:       class_name,
167
-		ClassAttributes: class_attributes,
168
-		TimeoneStart:    timeone_start,
169
-		TimeoneType:     timeone_type,
170
-		TimeoneEnd:      timeone_end,
171
-		TimetwoStart:    timetwo_start,
172
-		TimetwoEnd:      timetwo_end,
173
-		TimetwoType:     timetwo_type,
174
-		WorkTime:        work_time,
175
-		Remarks:         remarks,
176
-		Minute:          minute,
177
-	}
178
-
179
-	if user_org_id == 0 {
180
-		err := service.CreateDotorSchedule(&schedules)
181
-		if err != nil {
182
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
183
-			return
184
-		}
185
-	} else {
186
-		//查询是否班种名称已存在
187
-		scheduledata, _ := service.GetClassNameIsExsit(class_name, user_org_id, id)
188
-
189
-		if scheduledata.ID > 0 && scheduledata.ID != id {
190
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "班种名称已存在")
191
-			return
192
-		}
193
-
194
-		err := service.UpdateScheduleList(id, &schedules)
195
-		if err != nil {
196
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
197
-			return
198
-		}
199
-	}
200
-	this.ServeSuccessJSON(map[string]interface{}{
201
-		"schedules": schedules,
202
-	})
203
-}
204
-
205
-func (this *DoctorScheduleApiController) DeleteSchedule() {
206
-	adminUserInfo := this.GetAdminUserInfo()
207
-	orgId := adminUserInfo.CurrentOrgId
208
-	id, _ := this.GetInt64("id")
209
-	//产寻该班种是否存在排班,如果存在不能删除
210
-	_, errcode := service.GetStaffScheduleByScheduleType(id, orgId)
211
-	if errcode == gorm.ErrRecordNotFound {
212
-		err := service.DeleteScheduleById(id)
213
-		if err != nil {
214
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
215
-			return
216
-		}
217
-		returnData := make(map[string]interface{}, 0)
218
-		returnData["msg"] = "ok"
219
-		this.ServeSuccessJSON(returnData)
220
-		return
221
-	} else if errcode == nil {
222
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "该班种已存在排班,不能删除")
223
-		return
224
-	}
225
-
226
-}
227
-
228
-func (this *DoctorScheduleApiController) GetDoctorList() {
229
-
230
-	orgId := this.GetAdminUserInfo().CurrentOrgId
231
-	appId := this.GetAdminUserInfo().CurrentAppId
232
-	//admin_user_id := this.GetAdminUserInfo().AdminUser.Id
233
-	list, err := service.GetDoctorList(orgId, appId)
234
-
235
-	//获取所有的医生
236
-	doctorList, err := service.GetAllDoctorList(orgId, appId)
237
-
238
-	//获取所有的护士
239
-	nurseList, err := service.GetAllNurseList(orgId, appId)
240
-	if err != nil {
241
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
242
-		return
243
-	}
244
-
245
-	this.ServeSuccessJSON(map[string]interface{}{
246
-		"list":       list,
247
-		"doctorlist": doctorList,
248
-		"nurselist":  nurseList,
249
-	})
250
-}
251
-
252
-func (this *DoctorScheduleApiController) GetScheduleList() {
253
-
254
-	orgId := this.GetAdminUserInfo().CurrentOrgId
255
-	_, errcode := service.GetDoctorScheduleByOrgId(orgId)
256
-	if errcode == gorm.ErrRecordNotFound {
257
-		scheduleList, err := service.GetScheduleList(0)
258
-		if err != nil {
259
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
260
-			return
261
-		}
262
-
263
-		this.ServeSuccessJSON(map[string]interface{}{
264
-			"scheduleList": scheduleList,
265
-		})
266
-	} else {
267
-		scheduleList, err := service.GetScheduleList(orgId)
268
-		if err != nil {
269
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
270
-			return
271
-		}
272
-
273
-		this.ServeSuccessJSON(map[string]interface{}{
274
-			"scheduleList": scheduleList,
275
-		})
276
-	}
277
-}
278
-
279
-func (this *DoctorScheduleApiController) AddSchedule() {
280
-
281
-	orgId := this.GetAdminUserInfo().CurrentOrgId
282
-	doctor_id, _ := this.GetInt64("doctor_id")
283
-	fmt.Println("doctor_id", doctor_id)
284
-	doctor_type, _ := this.GetInt64("doctor_type")
285
-	fmt.Println("doctor_type", doctor_type)
286
-	start_time, _ := this.GetInt64("start_time")
287
-	fmt.Println("start_time", start_time)
288
-	end_time, _ := this.GetInt64("end_time")
289
-	fmt.Println("end_time", end_time)
290
-	schedule_type, _ := this.GetInt64("schedule_type")
291
-	fmt.Println("schedule_type", schedule_type)
292
-	schedule_week, _ := this.GetInt64("schedule_week")
293
-	fmt.Println("schedule_week", schedule_week)
294
-	schedule_date, _ := this.GetInt64("schedule_date")
295
-	schedule := models.StaffSchedule{
296
-		DoctorId:     doctor_id,
297
-		DoctorType:   doctor_type,
298
-		ScheduleType: schedule_type,
299
-		ScheduleWeek: schedule_week,
300
-		UserOrgId:    orgId,
301
-		StartTime:    start_time,
302
-		EndTime:      end_time,
303
-		Status:       1,
304
-		Ctime:        time.Now().Unix(),
305
-		ScheduleDate: schedule_date,
306
-	}
307
-
308
-	_, errcode := service.GetScheduleListDetail(doctor_id, orgId, schedule_date)
309
-	fmt.Println("errcode-----", errcode)
310
-	if errcode == gorm.ErrRecordNotFound {
311
-		err := service.AddSchedule(&schedule)
312
-		if err != nil {
313
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
314
-			return
315
-		}
316
-
317
-		this.ServeSuccessJSON(map[string]interface{}{
318
-			"schedule": schedule,
319
-		})
320
-	} else if errcode == nil {
321
-		schedules, _ := service.GetScheduleListDetail(doctor_id, orgId, schedule_date)
322
-		err := service.UpdateStaffList(&schedule, schedules.ID)
323
-		if err != nil {
324
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
325
-			return
326
-		}
327
-
328
-		this.ServeSuccessJSON(map[string]interface{}{
329
-			"schedule": schedule,
330
-		})
331
-	}
332
-
333
-}
334
-
335
-func (this *DoctorScheduleApiController) GetStaffScheduleList() {
336
-
337
-	start_time, _ := this.GetInt64("start_time")
338
-	fmt.Println("start_time", start_time)
339
-	end_time, _ := this.GetInt64("end_time")
340
-	fmt.Println("end_time", end_time)
341
-	orgId := this.GetAdminUserInfo().CurrentOrgId
342
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
343
-	if err != nil {
344
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
345
-		return
346
-	}
347
-
348
-	this.ServeSuccessJSON(map[string]interface{}{
349
-		"staffList": staffList,
350
-	})
351
-}
352
-
353
-func (this *DoctorScheduleApiController) GetNextWeekList() {
354
-	start_time, _ := this.GetInt64("start_time")
355
-	fmt.Println("start_time", start_time)
356
-	end_time, _ := this.GetInt64("end_time")
357
-	fmt.Println("end_time", end_time)
358
-	orgId := this.GetAdminUserInfo().CurrentOrgId
359
-	staffList, err := service.GetStaffScheduleList(orgId, start_time, end_time)
360
-	if err != nil {
361
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
362
-		return
363
-	}
364
-
365
-	this.ServeSuccessJSON(map[string]interface{}{
366
-		"staffList": staffList,
367
-	})
368
-}
369
-
370
-func (this *DoctorScheduleApiController) GetScheduleByDoctorId() {
371
-
372
-	doctor_id, _ := this.GetInt64("doctor_id")
373
-	start_time, _ := this.GetInt64("start_time")
374
-	end_time, _ := this.GetInt64("end_time")
375
-	orgId := this.GetAdminUserInfo().CurrentOrgId
376
-	staffList, err := service.GetScheduleByDoctorId(doctor_id, start_time, end_time, orgId)
377
-	if err != nil {
378
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
379
-		return
380
-	}
381
-
382
-	this.ServeSuccessJSON(map[string]interface{}{
383
-		"staffList": staffList,
384
-	})
385
-}
386
-
387
-func (this *DoctorScheduleApiController) ToSearchScheduleList() {
388
-
389
-	//doctor_id, _ := this.GetInt64("doctor_id")
390
-	user_name := this.GetString("user_name")
391
-	start_time, _ := this.GetInt64("start_time")
392
-	end_time, _ := this.GetInt64("end_time")
393
-	orgId := this.GetAdminUserInfo().CurrentOrgId
394
-	staffList, err := service.ToSearchSeacheduleList(user_name, start_time, end_time, orgId)
395
-	if err != nil {
396
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
397
-		return
398
-	}
399
-
400
-	this.ServeSuccessJSON(map[string]interface{}{
401
-		"staffList": staffList,
402
-	})
403
-}
404
-
405
-func (this *DoctorScheduleApiController) DeleteStaffSchedule() {
406
-	adminUserInfo := this.GetAdminUserInfo()
407
-	orgId := adminUserInfo.CurrentOrgId
408
-	start_time, _ := this.GetInt64("start_time")
409
-	fmt.Println("start_time", start_time)
410
-	end_time, _ := this.GetInt64("end_time")
411
-	err := service.DeleteStaffSchedule(orgId, start_time, end_time)
412
-	if err != nil {
413
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
414
-		return
415
-	}
416
-	returnData := make(map[string]interface{}, 0)
417
-	returnData["msg"] = "ok"
418
-	this.ServeSuccessJSON(returnData)
419
-	return
420
-}
421
-
422
-func (this *DoctorScheduleApiController) CopyStaffSchedule() {
423
-
424
-	adminUserInfo := this.GetAdminUserInfo()
425
-	orgId := adminUserInfo.CurrentOrgId
426
-	start_time, _ := this.GetInt64("start_time")
427
-	fmt.Println("start_time", start_time)
428
-	end_time, _ := this.GetInt64("end_time")
429
-	fmt.Println("end_time", end_time)
430
-	copy_startime, _ := this.GetInt64("copy_startime")
431
-	fmt.Println("copy_startime", copy_startime)
432
-	copy_endtime, _ := this.GetInt64("copy_endtime")
433
-	schedule, err := service.GetStaffScheduleListTwo(orgId, start_time, end_time)
434
-	//查询选中日期的排班是否存在
435
-	_, errcode := service.GetNextWeekSchedule(orgId, copy_startime, copy_endtime)
436
-	if errcode == gorm.ErrRecordNotFound {
437
-		for _, item := range schedule {
438
-			//fmt.Println(item.StartTime+604800)
439
-			//礼拜1
440
-			if item.ScheduleWeek == 1 {
441
-				item.ScheduleDate = copy_startime
442
-			}
443
-			if item.ScheduleWeek == 2 {
444
-				item.ScheduleDate = copy_startime + 86400
445
-			}
446
-			if item.ScheduleWeek == 3 {
447
-				item.ScheduleDate = copy_startime + 172800
448
-			}
449
-			if item.ScheduleWeek == 4 {
450
-				item.ScheduleDate = copy_startime + 259200
451
-			}
452
-			if item.ScheduleWeek == 5 {
453
-				item.ScheduleDate = copy_startime + 345600
454
-			}
455
-
456
-			if item.ScheduleWeek == 6 {
457
-				item.ScheduleDate = copy_startime + 432000
458
-			}
459
-			//礼拜天
460
-			if item.ScheduleWeek == 0 {
461
-				item.ScheduleDate = copy_endtime
462
-			}
463
-			staffSchedule := models.StaffSchedule{
464
-				DoctorId:     item.DoctorId,
465
-				DoctorType:   item.DoctorType,
466
-				ScheduleType: item.ScheduleType,
467
-				ScheduleWeek: item.ScheduleWeek,
468
-				UserOrgId:    item.UserOrgId,
469
-				StartTime:    copy_startime,
470
-				EndTime:      copy_endtime,
471
-				Status:       1,
472
-				Ctime:        time.Now().Unix(),
473
-				ScheduleDate: item.ScheduleDate,
474
-			}
475
-			service.AddSchedule(&staffSchedule)
476
-		}
477
-		if err != nil {
478
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
479
-			return
480
-		}
481
-		returnData := make(map[string]interface{}, 0)
482
-		returnData["msg"] = "ok"
483
-		this.ServeSuccessJSON(returnData)
484
-		return
485
-	} else if errcode == nil {
486
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "排班数据已存在")
487
-		fmt.Print("下周排班已存在")
488
-		return
489
-	}
490
-
491
-}
492
-
493
-func (this *DoctorScheduleApiController) UpdateContinusSchedule() {
494
-	adminUserInfo := this.GetAdminUserInfo()
495
-	orgId := adminUserInfo.CurrentOrgId
496
-	is_status, _ := this.GetInt64("is_status")
497
-	fmt.Println("is_status", is_status)
498
-	schedule := models.ContinueSchedule{
499
-		IsStatus: is_status,
500
-	}
501
-	err := service.UpdateContinusSchedule(&schedule, orgId)
502
-	if err != nil {
503
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
504
-		return
505
-	}
506
-
507
-	this.ServeSuccessJSON(map[string]interface{}{
508
-		"schedule": schedule,
509
-	})
510
-}
511
-
512
-func (this *DoctorScheduleApiController) SaveNureSort() {
513
-
514
-	id, _ := this.GetInt64("id")
515
-	fmt.Println("id", id)
516
-	sort, _ := this.GetInt64("sort")
517
-	fmt.Println("sort", sort)
518
-	role := models.App_Role{
519
-		Sort: sort,
520
-	}
521
-	err := service.SaveNurseSort(&role, id)
522
-	if err != nil {
523
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
524
-		return
525
-	}
526
-
527
-	this.ServeSuccessJSON(map[string]interface{}{
528
-		"role": role,
529
-	})
530
-}
531
-
532
-func (this *DoctorScheduleApiController) SaveIsSchedule() {
533
-
534
-	id, _ := this.GetInt64("id")
535
-	fmt.Println("id", id)
536
-	is_sort, _ := this.GetInt64("is_sort")
537
-	fmt.Println("is_sort", is_sort)
538
-	role := models.App_Role{
539
-		IsSort: is_sort,
540
-	}
541
-	err := service.SaveIsSchedule(id, &role)
542
-	if err != nil {
543
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
544
-		return
545
-	}
546
-
547
-	this.ServeSuccessJSON(map[string]interface{}{
548
-		"role": role,
549
-	})
550
-}
551
-
552
-func (this *DoctorScheduleApiController) GetScheduleListTotal() {
553
-
554
-	start_time, _ := this.GetInt64("start_time")
555
-	fmt.Println(start_time)
556
-	end_time, _ := this.GetInt64("end_time")
557
-	fmt.Println("end_time", end_time)
558
-	adminUserInfo := this.GetAdminUserInfo()
559
-	orgId := adminUserInfo.CurrentOrgId
560
-	//统计班次
561
-	scheudletotal, err := service.GetScheduleListTotal(orgId, start_time, end_time)
562
-	//统计总工时
563
-	list, err := service.GetTotalMinutes(orgId, start_time, end_time)
564
-	//统计出勤天数
565
-	workDay, err := service.GetTotalWorkDay(orgId, start_time, end_time)
566
-	//统计缺勤天数
567
-	noWorkDay, err := service.GetTotalNoWorkDay(orgId, start_time, end_time)
568
-	if err != nil {
569
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
570
-		return
571
-	}
572
-
573
-	this.ServeSuccessJSON(map[string]interface{}{
574
-		"scheudletotal": scheudletotal,
575
-		"list":          list,
576
-		"workDay":       workDay,
577
-		"noWorkDay":     noWorkDay,
578
-	})
579
-}
580
-
581
-func (this *DoctorScheduleApiController) ToSeachTotal() {
582
-	start_time, _ := this.GetInt64("start_time")
583
-	end_time, _ := this.GetInt64("end_time")
584
-	adminUserInfo := this.GetAdminUserInfo()
585
-	orgId := adminUserInfo.CurrentOrgId
586
-	keyword := this.GetString("keyword")
587
-	//统计表
588
-	scheduletotal, err := service.GetSearchScheduleListTotal(orgId, start_time, end_time, keyword)
589
-	list, err := service.GeSearchtTotalMinutes(orgId, start_time, end_time, keyword)
590
-	workDay, err := service.GetSearchWorkDay(orgId, start_time, end_time, keyword)
591
-	noWorkDay, err := service.GetSearchWorkNoDay(orgId, start_time, end_time, keyword)
592
-
593
-	//统计图
594
-	chartTotalMinute, err := service.GetChartTotalMinutesOne(orgId, start_time, end_time, keyword)
595
-	chartWorkDayMinute, err := service.GetChartTotalMinutesTwo(orgId, start_time, end_time, keyword)
596
-
597
-	if err != nil {
598
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
599
-		return
600
-	}
601
-	this.ServeSuccessJSON(map[string]interface{}{
602
-		"scheduletotal":      scheduletotal,
603
-		"list":               list,
604
-		"workDay":            workDay,
605
-		"noWorkDay":          noWorkDay,
606
-		"chartTotalMinute":   chartTotalMinute,
607
-		"chartWorkDayMinute": chartWorkDayMinute,
608
-	})
609
-}
610
-
611
-func (this *DoctorScheduleApiController) ChangeOption() {
612
-
613
-	start_time, _ := this.GetInt64("start_time")
614
-	end_time, _ := this.GetInt64("end_time")
615
-	adminUserInfo := this.GetAdminUserInfo()
616
-	orgId := adminUserInfo.CurrentOrgId
617
-	doctor_type, _ := this.GetInt64("doctor_type")
618
-	//统计图
619
-	scheduletotal, err := service.ChagneScheduleListTotal(orgId, start_time, end_time, doctor_type)
620
-	list, err := service.ChangeScheduleMinute(orgId, start_time, end_time, doctor_type)
621
-	workday, err := service.ChangeWorkDay(orgId, start_time, end_time, doctor_type)
622
-	worknoday, err := service.ChangeNoWorkDay(orgId, start_time, end_time, doctor_type)
623
-
624
-	//统计表
625
-	chartotalminute, err := service.ChartTotalMinute(orgId, start_time, end_time, doctor_type)
626
-	chartworkdayminute, err := service.ChartWorkDayMinute(orgId, start_time, end_time, doctor_type)
627
-	if err != nil {
628
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
629
-		return
630
-	}
631
-	this.ServeSuccessJSON(map[string]interface{}{
632
-		"scheduletotal":      scheduletotal,
633
-		"list":               list,
634
-		"workday":            workday,
635
-		"worknoday":          worknoday,
636
-		"chartotalminute":    chartotalminute,
637
-		"chartworkdayminute": chartworkdayminute,
638
-	})
639
-}
640
-
641
-func (this *DoctorScheduleApiController) GetChartlist() {
642
-	start_time, _ := this.GetInt64("start_time")
643
-	end_time, _ := this.GetInt64("end_time")
644
-	adminUserInfo := this.GetAdminUserInfo()
645
-	orgId := adminUserInfo.CurrentOrgId
646
-	//统计总工时
647
-	list, err := service.GetTotalMinutesOne(orgId, start_time, end_time)
648
-	//统计出勤的总工时
649
-	workDaylist, err := service.GetTotalMinutesTwo(orgId, start_time, end_time)
650
-	if err != nil {
651
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
652
-		return
653
-	}
654
-	this.ServeSuccessJSON(map[string]interface{}{
655
-		"list":        list,
656
-		"workDaylist": workDaylist,
657
-	})
658
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1628
controllers/doctors_api_controller.go


+ 0 - 523
controllers/drug_pharmacy_management_controller.go Просмотреть файл

@@ -1,523 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"fmt"
9
-	"github.com/astaxie/beego"
10
-	"github.com/jinzhu/gorm"
11
-	"math"
12
-	"strconv"
13
-	"strings"
14
-	"time"
15
-)
16
-
17
-type PharmacyApiController struct {
18
-	BaseAuthAPIController
19
-}
20
-
21
-func PharmacyApiControllersRegisterRouters() {
22
-
23
-	//获取设置为药房发药的药品数据
24
-	beego.Router("/api/advice/gettodayadvicelist", &PharmacyApiController{}, "Get:GetTodayAdviceList")
25
-	//获取今日未发药的数据
26
-	beego.Router("api/advice/getpharmacybasedrug", &PharmacyApiController{}, "Get:GetPharyMacyBaseDrug")
27
-	//发药
28
-	beego.Router("/api/advice/updatepharmacybasedrug", &PharmacyApiController{}, "Get:UpdatePharmacyBaseDrug")
29
-
30
-	//获取今日已发药的数据
31
-	beego.Router("/api/advice/getpharmacybasedruglist", &PharmacyApiController{}, "Get:GetPharmacyBaseDrugList")
32
-	//退药流程
33
-	beego.Router("/api/advice/getreturnpharmacybasedrug", &PharmacyApiController{}, "Get:GetReturnPharmacyBaseDrug")
34
-
35
-	//设置
36
-	beego.Router("/api/advice/savesetting", &PharmacyApiController{}, "Get:SaveSetting")
37
-
38
-	beego.Router("/api/advice/getpharmacyconfig", &PharmacyApiController{}, "Get:GetPharmacyConfig")
39
-
40
-}
41
-
42
-func (this *PharmacyApiController) GetTodayAdviceList() {
43
-
44
-	orgId := this.GetAdminUserInfo().CurrentOrgId
45
-	//获取药房发药药品库数据
46
-	appId := this.GetAdminUserInfo().CurrentAppId
47
-	doctorlist, err := service.GetAllDoctorSix(orgId, appId)
48
-	if err == nil {
49
-		this.ServeSuccessJSON(map[string]interface{}{
50
-			"doctorlist": doctorlist,
51
-		})
52
-	} else {
53
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
54
-	}
55
-}
56
-
57
-func (this *PharmacyApiController) GetPharyMacyBaseDrug() {
58
-
59
-	start_time := this.GetString("start_time")
60
-	timeLayout := "2006-01-02"
61
-	loc, _ := time.LoadLocation("Local")
62
-	var theStartTime int64
63
-	if len(start_time) > 0 {
64
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
65
-		if err != nil {
66
-			utils.ErrorLog(err.Error())
67
-		}
68
-		theStartTime = theTime.Unix()
69
-	}
70
-
71
-	drug_id, _ := this.GetInt64("drug_id")
72
-
73
-	orgId := this.GetAdminUserInfo().CurrentOrgId
74
-	//获取血透医嘱
75
-	advicelist, _ := service.GetBloodAdviceList(theStartTime, drug_id, orgId)
76
-
77
-	//获取医保医嘱
78
-	hisAdviceList, err := service.GetHisAdviceList(theStartTime, drug_id, orgId)
79
-
80
-	patient, _ := service.GetAllPatientListSix(orgId)
81
-	if err == nil {
82
-		this.ServeSuccessJSON(map[string]interface{}{
83
-			"advicelist":    advicelist,
84
-			"hisAdviceList": hisAdviceList,
85
-			"patient":       patient,
86
-		})
87
-	} else {
88
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
89
-	}
90
-}
91
-
92
-func (this *PharmacyApiController) UpdatePharmacyBaseDrug() {
93
-
94
-	bloodStr := this.GetString("bloodStr")
95
-
96
-	hisStr := this.GetString("hisStr")
97
-
98
-	admin_user_id, _ := this.GetInt64("admin_user_id")
99
-	if len(bloodStr) == 0 {
100
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
101
-		return
102
-	}
103
-
104
-	idArray := strings.Split(bloodStr, ",")
105
-
106
-	if len(hisStr) == 0 {
107
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
108
-		return
109
-	}
110
-
111
-	idArrayOne := strings.Split(hisStr, ",")
112
-
113
-	fmt.Println("idArray23332233223", idArray)
114
-	fmt.Println("idArrayOne23332233223", idArrayOne)
115
-
116
-	orgId := this.GetAdminUserInfo().CurrentOrgId
117
-	service.UpdatePharmacyAdviceBaseDrug(idArray, orgId)
118
-	service.UpdatePharmacyHisAdviceBaseDrug(idArray, orgId)
119
-
120
-	//出库逻辑
121
-	adviceList, _ := service.GetPharmacyAdviceList(idArray, orgId)
122
-
123
-	hisAdviceList, _ := service.GetPharmacyHisAdviceList(idArray, orgId)
124
-
125
-	//查询是否通过药房出库
126
-	pharmacyConfig, _ := service.FindPharmacyConfig(orgId)
127
-	if pharmacyConfig.IsOpen == 1 {
128
-		var total int64
129
-		var prescribing_number_total int64
130
-		//创建流水
131
-		timeStr := time.Now().Format("2006-01-02")
132
-		timeArr := strings.Split(timeStr, "-")
133
-		totals, _ := service.FindAllPharmacyDrugWarehouseOut(orgId)
134
-		totals = totals + 1
135
-		warehousing_out_order := strconv.FormatInt(orgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
136
-		number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
137
-		number = number + totals
138
-		warehousing_out_order = "FY" + strconv.FormatInt(number, 10)
139
-
140
-		//血透
141
-		for _, item := range adviceList {
142
-
143
-			pharmacy := models.Pharmacy{
144
-				UserOrgId:      item.UserOrgId,
145
-				PatientId:      item.PatientId,
146
-				PrescriptionId: 0,
147
-				XtAdviceId:     item.ID,
148
-				HisOrXt:        1,
149
-				Ctime:          time.Now().Unix(),
150
-				Mtime:          0,
151
-				Status:         1,
152
-				HisAdviceId:    0,
153
-				DrugId:         item.DrugId,
154
-				RecordDate:     item.AdviceDate,
155
-				OrdreNumber:    warehousing_out_order,
156
-				Creater:        admin_user_id,
157
-			}
158
-
159
-			service.CreatePharmacy(pharmacy)
160
-
161
-			lastPharmacy, _ := service.GetLastPharmary(item.UserOrgId, item.ID, item.AdviceDate)
162
-
163
-			houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
164
-			////查询该药品是否有库存
165
-			list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
166
-			//
167
-			////查询改药品信息
168
-			medical, _ := service.GetBaseDrugMedical(item.DrugId)
169
-			////判断单位是否相等
170
-			if medical.MaxUnit == item.PrescribingNumberUnit {
171
-				prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
172
-				count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
173
-				//转化为最小单位
174
-				total = list.Count*medical.MinNumber + list.StockMinNumber
175
-				prescribing_number_total = count * medical.MinNumber
176
-			}
177
-			if medical.MinUnit == item.PrescribingNumberUnit {
178
-				prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
179
-				count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
180
-				total = list.Count*medical.MinNumber + list.StockMinNumber
181
-				prescribing_number_total = count
182
-			}
183
-
184
-			if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
185
-				this.ServeSuccessJSON(map[string]interface{}{
186
-					"msg":     "3",
187
-					"medical": medical,
188
-				})
189
-				return
190
-			}
191
-			if prescribing_number_total > total {
192
-				this.ServeSuccessJSON(map[string]interface{}{
193
-					"msg":     "2",
194
-					"medical": medical,
195
-				})
196
-				return
197
-			}
198
-
199
-			if prescribing_number_total <= total {
200
-
201
-				//查询是否门诊处方和临时医嘱同步到透析医嘱的开关是否开启
202
-				adviceSetting, _ := service.FindAdviceSettingById(item.UserOrgId)
203
-				if adviceSetting.IsAdviceOpen == 1 {
204
-					if medical.IsUse == 2 {
205
-						service.PharmacyDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item, lastPharmacy.ID)
206
-						//查询默认仓库
207
-						houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
208
-						//查询默认仓库剩余多少库存
209
-						list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
210
-						var sum_count int64
211
-						var sum_in_count int64
212
-						for _, it := range list {
213
-							baseDrug, _ := service.GetBaseDrugMedical(it.DrugId)
214
-							if it.MaxUnit == baseDrug.MaxUnit {
215
-								it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
216
-								it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
217
-							}
218
-							sum_count += it.StockMaxNumber + it.StockMinNumber
219
-							sum_in_count += it.WarehousingCount
220
-						}
221
-						service.UpdateMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.UserOrgId)
222
-						break
223
-						this.ServeSuccessJSON(map[string]interface{}{
224
-							"msg":     "1",
225
-							"medical": medical,
226
-						})
227
-						return
228
-					}
229
-					if medical.IsUse == 1 {
230
-						this.ServeSuccessJSON(map[string]interface{}{
231
-							"msg": "1",
232
-						})
233
-						return
234
-					}
235
-
236
-				} else {
237
-					if medical.IsUse == 2 {
238
-						service.PharmacyDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item, lastPharmacy.ID)
239
-						//查询默认仓库
240
-						houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
241
-						//查询默认仓库剩余多少库存
242
-						list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
243
-						var sum_count int64
244
-						var sum_in_count int64
245
-						for _, it := range list {
246
-							baseDrug, _ := service.GetBaseDrugMedical(it.DrugId)
247
-							if it.MaxUnit == baseDrug.MaxUnit {
248
-								it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
249
-								it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
250
-							}
251
-							sum_count += it.StockMaxNumber + it.StockMinNumber
252
-							sum_in_count += it.WarehousingCount
253
-						}
254
-						service.UpdateMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.UserOrgId)
255
-						this.ServeSuccessJSON(map[string]interface{}{
256
-							"msg":     "1",
257
-							"medical": medical,
258
-						})
259
-						return
260
-					}
261
-					if medical.IsUse == 1 {
262
-						this.ServeSuccessJSON(map[string]interface{}{
263
-							"msg":     "1",
264
-							"medical": medical,
265
-						})
266
-						return
267
-					}
268
-				}
269
-			}
270
-		}
271
-
272
-		//血透
273
-		for _, item := range hisAdviceList {
274
-
275
-			pharmacy := models.Pharmacy{
276
-				UserOrgId:      item.UserOrgId,
277
-				PatientId:      item.PatientId,
278
-				PrescriptionId: 0,
279
-				XtAdviceId:     0,
280
-				HisOrXt:        2,
281
-				Ctime:          time.Now().Unix(),
282
-				Mtime:          0,
283
-				Status:         1,
284
-				HisAdviceId:    item.ID,
285
-				DrugId:         item.DrugId,
286
-				RecordDate:     item.AdviceDate,
287
-				OrdreNumber:    warehousing_out_order,
288
-				Creater:        admin_user_id,
289
-			}
290
-
291
-			service.CreatePharmacy(pharmacy)
292
-
293
-			lastPharmary, _ := service.GetLastHisPharmary(item.UserOrgId, item.ID, item.AdviceDate)
294
-
295
-			houseConfig, _ := service.GetAllStoreHouseConfig(orgId)
296
-			////查询该药品是否有库存
297
-			list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
298
-			//
299
-			////查询改药品信息
300
-			medical, _ := service.GetBaseDrugMedical(item.DrugId)
301
-			////判断单位是否相等
302
-			if medical.MaxUnit == item.PrescribingNumberUnit {
303
-				prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
304
-				count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
305
-				//转化为最小单位
306
-				total = list.Count*medical.MinNumber + list.StockMinNumber
307
-				prescribing_number_total = count * medical.MinNumber
308
-			}
309
-			if medical.MinUnit == item.PrescribingNumberUnit {
310
-				prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
311
-				count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
312
-				total = list.Count*medical.MinNumber + list.StockMinNumber
313
-				prescribing_number_total = count
314
-			}
315
-
316
-			if (list.Count*medical.MinNumber + list.StockMinNumber) == 0 {
317
-				this.ServeSuccessJSON(map[string]interface{}{
318
-					"msg":     "3",
319
-					"medical": medical,
320
-				})
321
-				return
322
-			}
323
-			if prescribing_number_total > total {
324
-				this.ServeSuccessJSON(map[string]interface{}{
325
-					"msg":     "2",
326
-					"medical": medical,
327
-				})
328
-				return
329
-			}
330
-
331
-			if prescribing_number_total <= total {
332
-
333
-				//查询是否门诊处方和临时医嘱同步到透析医嘱的开关是否开启
334
-				adviceSetting, _ := service.FindAdviceSettingById(item.UserOrgId)
335
-				if adviceSetting.IsAdviceOpen == 1 {
336
-					if medical.IsUse == 2 {
337
-						service.PharmacyHisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item, lastPharmary.ID)
338
-						//查询默认仓库
339
-						houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
340
-						//查询默认仓库剩余多少库存
341
-						list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
342
-						var sum_count int64
343
-						var sum_in_count int64
344
-						for _, it := range list {
345
-							baseDrug, _ := service.GetBaseDrugMedical(it.DrugId)
346
-							if it.MaxUnit == baseDrug.MaxUnit {
347
-								it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
348
-								it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
349
-							}
350
-							sum_count += it.StockMaxNumber + it.StockMinNumber
351
-							sum_in_count += it.WarehousingCount
352
-						}
353
-						service.UpdateMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.UserOrgId)
354
-						break
355
-						this.ServeSuccessJSON(map[string]interface{}{
356
-							"msg":     "1",
357
-							"medical": medical,
358
-						})
359
-						return
360
-					}
361
-					if medical.IsUse == 1 {
362
-						this.ServeSuccessJSON(map[string]interface{}{
363
-							"msg": "1",
364
-						})
365
-						return
366
-					}
367
-
368
-				} else {
369
-					if medical.IsUse == 2 {
370
-						service.PharmacyHisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item, lastPharmary.ID)
371
-						//查询默认仓库
372
-						houseConfig, _ := service.GetAllStoreHouseConfig(item.UserOrgId)
373
-						//查询默认仓库剩余多少库存
374
-						list, _ := service.GetDrugSumCountByStorehouseId(houseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
375
-						var sum_count int64
376
-						var sum_in_count int64
377
-						for _, it := range list {
378
-							baseDrug, _ := service.GetBaseDrugMedical(it.DrugId)
379
-							if it.MaxUnit == baseDrug.MaxUnit {
380
-								it.StockMaxNumber = it.StockMaxNumber * baseDrug.MinNumber
381
-								it.WarehousingCount = it.WarehousingCount * baseDrug.MinNumber
382
-							}
383
-							sum_count += it.StockMaxNumber + it.StockMinNumber
384
-							sum_in_count += it.WarehousingCount
385
-						}
386
-						service.UpdateMedicalSumCount(item.DrugId, sum_count, sum_in_count, item.UserOrgId)
387
-						this.ServeSuccessJSON(map[string]interface{}{
388
-							"msg":     "1",
389
-							"medical": medical,
390
-						})
391
-						return
392
-					}
393
-					if medical.IsUse == 1 {
394
-						this.ServeSuccessJSON(map[string]interface{}{
395
-							"msg":     "1",
396
-							"medical": medical,
397
-						})
398
-						return
399
-					}
400
-				}
401
-			}
402
-		}
403
-	}
404
-}
405
-
406
-func (this *PharmacyApiController) GetPharmacyBaseDrugList() {
407
-
408
-	start_time := this.GetString("start_time")
409
-	timeLayout := "2006-01-02"
410
-	loc, _ := time.LoadLocation("Local")
411
-	var theStartTime int64
412
-	if len(start_time) > 0 {
413
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
414
-		if err != nil {
415
-			utils.ErrorLog(err.Error())
416
-		}
417
-		theStartTime = theTime.Unix()
418
-	}
419
-
420
-	drug_id, _ := this.GetInt64("drug_id")
421
-
422
-	orgId := this.GetAdminUserInfo().CurrentOrgId
423
-	//获取血透医嘱
424
-	advicelist, _ := service.GetUseredBloodAdviceList(theStartTime, drug_id, orgId)
425
-
426
-	//获取医保医嘱
427
-	hisAdviceList, err := service.GetUseredHisAdviceList(theStartTime, drug_id, orgId)
428
-
429
-	patient, _ := service.GetAllPatientListSix(orgId)
430
-	if err == nil {
431
-		this.ServeSuccessJSON(map[string]interface{}{
432
-			"advicelist":    advicelist,
433
-			"hisAdviceList": hisAdviceList,
434
-			"patient":       patient,
435
-		})
436
-	} else {
437
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
438
-	}
439
-}
440
-
441
-func (this *PharmacyApiController) GetReturnPharmacyBaseDrug() {
442
-
443
-	bloodStr := this.GetString("bloodStr")
444
-
445
-	hisStr := this.GetString("hisStr")
446
-
447
-	if len(bloodStr) == 0 {
448
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
449
-		return
450
-	}
451
-
452
-	idArray := strings.Split(bloodStr, ",")
453
-
454
-	if len(hisStr) == 0 {
455
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
456
-		return
457
-	}
458
-
459
-	idArrayOne := strings.Split(hisStr, ",")
460
-
461
-	fmt.Println("idArray23332233223", idArray)
462
-	fmt.Println("idArrayOne23332233223", idArrayOne)
463
-
464
-	orgId := this.GetAdminUserInfo().CurrentOrgId
465
-	service.UpdateReturnPharmacyAdviceBaseDrug(idArray, orgId)
466
-	service.UpdateReturnPharmacyHisAdviceBaseDrug(idArray, orgId)
467
-}
468
-
469
-func (this *PharmacyApiController) SaveSetting() {
470
-	var err error
471
-	defer func() {
472
-		if rec := recover(); rec != nil {
473
-			err = fmt.Errorf("程序异常:%v", rec)
474
-		}
475
-		if err != nil {
476
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
477
-		}
478
-	}()
479
-	is_open, _ := this.GetInt64("is_open")
480
-
481
-	orgId := this.GetAdminUserInfo().CurrentOrgId
482
-	config := models.PharmacyConfig{
483
-		UserOrgId: orgId,
484
-		IsOpen:    is_open,
485
-		Status:    1,
486
-		Ctime:     time.Now().Unix(),
487
-	}
488
-
489
-	if is_open == 1 {
490
-		service.UpdateSettleOpenConfigOne(orgId, 2)
491
-	}
492
-	//查找是否存在
493
-	_, errcode := service.GetConfigSettingIsExsit(orgId)
494
-	if errcode == gorm.ErrRecordNotFound {
495
-		service.CreatePharmacyConfig(&config)
496
-	} else if errcode == nil {
497
-		service.UpdatePharmacyConfig(orgId, &config)
498
-	}
499
-	if is_open == 2 {
500
-		err = fmt.Errorf("用户关闭药房管理出库")
501
-	} else {
502
-		err = fmt.Errorf("用户开启药房管理出库")
503
-	}
504
-
505
-	this.ServeSuccessJSON(map[string]interface{}{
506
-		"config": config,
507
-	})
508
-}
509
-
510
-func (this *PharmacyApiController) GetPharmacyConfig() {
511
-
512
-	orgId := this.GetAdminUserInfo().CurrentOrgId
513
-
514
-	config, err := service.GetPharmacyConfig(orgId)
515
-
516
-	if err == nil {
517
-		this.ServeSuccessJSON(map[string]interface{}{
518
-			"config": config,
519
-		})
520
-	} else {
521
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
522
-	}
523
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 4286
controllers/drug_stock_api_contorller.go


+ 0 - 158
controllers/err_msg.json Просмотреть файл

@@ -1,158 +0,0 @@
1
-{
2
-  "msg": [
3
-    {
4
-      "url": "/m/api/solution?mode=1,/api/dialysis/soulution?mode=1,/api/patients/dialysissolution/create?mode=1",
5
-      "err_msg": "没有权限新增长期处方"
6
-    },{
7
-      "url": ",,/api/patients/dialysissolution/edit?mode=2",
8
-      "err_msg": "没有权限修改长期处方"
9
-    },{
10
-      "url": ",,/api/patients/dialysissolution/edit?mode=3",
11
-      "err_msg": "没有权限修改别人的长期处方"
12
-    },{
13
-      "url": "/m/api/dialysis/dialysisPrescription?mode=1,/api/dialysis/prescription?mode=1,",
14
-      "err_msg": "没有权限新增临时处方"
15
-    },{
16
-      "url": "/m/api/dialysis/dialysisPrescription?mode=3,/api/dialysis/prescription?mode=3,",
17
-      "err_msg": "没有权限修改他人的临时处方"
18
-    },{
19
-      "url": "/m/api/dialysis/acceptsAssessment?mode=1,/api/dialysis/accepts?mode=1,",
20
-      "err_msg": "没有权限新增接诊评估"
21
-    },{
22
-      "url": "/m/api/dialysis/acceptsAssessment?mode=2,/api/dialysis/accepts?mode=2,",
23
-      "err_msg": "没有权限修改接诊评估"
24
-    },{
25
-      "url": "/m/api/dialysis/acceptsAssessment?mode=3,/api/dialysis/accepts?mode=3,",
26
-      "err_msg": "没有权限修改别人接诊评估"
27
-    },{
28
-      "url": "/m/api/assessmentbefore/commit?mode=1,/api/dialysis/assessmentbeforedislysis?mode=1,",
29
-      "err_msg": "没有权限新增透前评估"
30
-    },{
31
-      "url": "/m/api/assessmentbefore/commit?mode=2,/api/dialysis/assessmentbeforedislysis?mode=2,",
32
-      "err_msg": "没有权限修改透前评估"
33
-    },{
34
-      "url": "/m/api/assessmentbefore/commit?mode=3,/api/dialysis/assessmentbeforedislysis?mode=3,",
35
-      "err_msg": "没有权限修改别人透前评估"
36
-    },{
37
-      "url": "/m/api/dialysis/start?mode=1,/api/dialysis/start_record?mode=1,",
38
-      "err_msg": "没有权限执行上机"
39
-    },{
40
-      "url": "/m/api/startOrder/edit?mode=2,/api/start_dialysis/modify?mode=2,",
41
-      "err_msg": "没有权限修改执行上机"
42
-    },{
43
-      "url": "/m/api/startOrder/edit?mode=3,/api/start_dialysis/modify?mode=3,",
44
-      "err_msg": "没有权限修改他人执行上机"
45
-    },{
46
-      "url": "/m/api/monitor/add?mode=1,/api/dislysis/monitor/edit?mode=1,",
47
-      "err_msg": "没有权限新增透析监测"
48
-    },{
49
-      "url": "/m/api/monitor/edit?mode=2,/api/dislysis/monitor/edit?mode=2,",
50
-      "err_msg": "没有权限修改透析监测"
51
-    },{
52
-      "url": "/m/api/monitor/edit?mode=3,/api/dislysis/monitor/edit?mode=3,",
53
-      "err_msg": "没有权限修改他人透析监测"
54
-    },{
55
-      "url": "/m/api/monitor/delete?mode=4,/api/dialysis/monitor/del?mode=4,",
56
-      "err_msg": "没有权限删除透析监测"
57
-    },{
58
-      "url": "/m/api/monitor/delete?mode=5,/api/dialysis/monitor/del?mode=5,",
59
-      "err_msg": "没有权限删除他人透析监测"
60
-    },{
61
-      "url": "/m/api/dialysis/finish?mode=1,/api/dialysis/finish?mode=1,",
62
-      "err_msg": "没有权限执行下机"
63
-    },{
64
-      "url": "/m/api/finishOrder/edit?mode=2,/api/finish_dialysis/modify?mode=2,",
65
-      "err_msg": "没有权限修改执行下机"
66
-    },{
67
-      "url": "/m/api/finishOrder/edit?mode=3,/api/finish_dialysis/modify?mode=3,",
68
-      "err_msg": "没有权限修改他人执行下机"
69
-    },{
70
-      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=1,/api/dialysis/assessmentafterdislysis?mode=1,",
71
-      "err_msg": "没有权限新增透后评估"
72
-    },{
73
-      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=2,/api/dialysis/assessmentafterdislysis?mode=2,",
74
-      "err_msg": "没有权限修改透后评估"
75
-    },{
76
-      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=3,/api/dialysis/assessmentafterdislysis?mode=3,",
77
-      "err_msg": "没有权限修改他人透后评估"
78
-    },{
79
-      "url": "/m/api/dialysis/treatmentSummary?mode=1,/api/dialysis/treatmentsummary?mode=1,",
80
-      "err_msg": "没有权限新增治疗小结"
81
-    },{
82
-      "url": "/m/api/dialysis/treatmentSummary?mode=2,/api/dialysis/treatmentsummary?mode=2,",
83
-      "err_msg": "没有权限修改治疗小结"
84
-    },{
85
-      "url": "/m/api/dialysis/treatmentSummary?mode=3,/api/dialysis/treatmentsummary?mode=3,",
86
-      "err_msg": "没有权限修改他人治疗小结"
87
-    },{
88
-      "url": "/m/api/dryweight/commit?mode=1,/api/dryweight/commit?mode=1,/api/patient/updatedryweightdata?mode=1",
89
-      "err_msg": "没有权限新增干体重"
90
-    },{
91
-      "url": ",/api/patients/advice/create?mode=1-1,/api/patients/advice/creategroup?mode=1-1",
92
-      "err_msg": "没有权限新增临时医嘱"
93
-    },{
94
-      "url": ",/api/patients/advice/edit?mode=2-1,",
95
-      "err_msg": "没有权限修改临时医嘱"
96
-    },{
97
-      "url": ",/api/patients/advice/edit?mode=3-1,",
98
-      "err_msg": "没有权限修改他人临时医嘱"
99
-    },{
100
-      "url": ",/api/patients/advice/delete?mode=4-1,/api/patients/advice/deletegroup?mode=4-1",
101
-      "err_msg": "没有权限删除临时医嘱"
102
-    },{
103
-      "url": ",/api/patients/advice/delete?mode=5-1,/api/patients/advice/deletegroup?mode=5-1",
104
-      "err_msg": "没有权限删除他人开的临时医嘱"
105
-    },{
106
-      "url": ",/api/patients/advice/create?mode=1-2,/api/patients/advice/creategroup?mode=1-2",
107
-      "err_msg": "没有权限新增长期医嘱"
108
-    },{
109
-      "url": ",/api/patients/advice/edit?mode=1-3,",
110
-      "err_msg": "没有权限修改长期医嘱"
111
-    },{
112
-      "url": ",/api/patients/advice/edit?mode=1-4,",
113
-      "err_msg": "没有权限修改他人长期医嘱"
114
-    },{
115
-      "url": ",/api/patients/advice/stop?mode=1-5,",
116
-      "err_msg": "没有权限停止长期医嘱"
117
-    },{
118
-      "url": ",/api/patients/advice/delete?mode=1-6,/api/patients/advice/deletegroup?mode=1-6",
119
-      "err_msg": "没有权限删除长期医嘱"
120
-    },{
121
-      "url": ",/api/patients/advice/delete?mode=1-7,/api/patients/advice/deletegroup?mode=1-7",
122
-      "err_msg": "没有权限删除他人长期医嘱"
123
-    },{
124
-      "url": "/m/api/advice/creategroup?mode=1,/api/patients/advice/creategroup?mode=1,/api/patients/advice/create?mode=1",
125
-      "err_msg": "没有权限新增透析临时医嘱"
126
-    },{
127
-      "url": "/m/api/advice/edit?mode=2,/api/patients/advice/edit?mode=2,",
128
-      "err_msg": "没有权限修改透析临时医嘱"
129
-    },{
130
-      "url": "/m/api/advice/edit?mode=3,/api/patients/advice/edit?mode=3,",
131
-      "err_msg": "没有权限修改他人透析临时医嘱"
132
-    },{
133
-      "url": "/m/api/newadvice/delete?mode=4,/api/patients/advice/delete?mode=4,/api/patients/advice/deletegroup?mode=4",
134
-      "err_msg": "没有权限删除透析临时医嘱"
135
-    },{
136
-      "url": "/m/api/newadvice/delete?mode=5,/api/patients/advice/delete?mode=5,/api/patients/advice/deletegroup?mode=5",
137
-      "err_msg": "没有权限删除他人透析临时医嘱"
138
-    },{
139
-      "url": "/m/api/advice/exec?mode=6,/api/patients/advice/exec?mode=6,",
140
-      "err_msg": "没有权限执行透析临时医嘱"
141
-    },{
142
-      "url": "/m/api/advice/exec/modify?mode=8,,",
143
-      "err_msg": "没有权限修改已执行医嘱"
144
-    },{
145
-      "url": "/m/api/advice/check?mode=7,/api/patients/advice/check?mode=7,",
146
-      "err_msg": "没有权限核对透析临时医嘱"
147
-    },{
148
-      "url": ",/api/patients/advice/stop?mode=1-8,",
149
-      "err_msg": "没有权限停止他人长期医嘱"
150
-    },{
151
-      "url": ",/api/patients/advice/execgroup?mode=6-1,",
152
-      "err_msg": "没有权限执行医嘱"
153
-    },{
154
-      "url": ",/api/patients/advice/checkgroup?mode=7-1,",
155
-      "err_msg": "没有权限核对医嘱"
156
-    }
157
-  ]
158
-}

+ 0 - 472
controllers/gdyb_controller.go Просмотреть файл

@@ -1,472 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/models"
5
-	"XT_New/service"
6
-	"XT_New/utils"
7
-	"encoding/json"
8
-	"fmt"
9
-	"github.com/astaxie/beego"
10
-	"io/ioutil"
11
-)
12
-
13
-type GdybController struct {
14
-	BaseAuthAPIController
15
-}
16
-
17
-func GdybRegistRouters() {
18
-	beego.Router("/gdyb/one", &GdybController{}, "get:PostOne")
19
-	beego.Router("/gdyb/two", &GdybController{}, "get:PostTwo")
20
-	beego.Router("/gdyb/three", &GdybController{}, "get:PostThree")
21
-	beego.Router("/gdyb/four", &GdybController{}, "get:PostFour")
22
-	beego.Router("/gdyb/five", &GdybController{}, "post:PostFive")
23
-	beego.Router("/gdyb/six", &GdybController{}, "get:PostSix")
24
-	beego.Router("/gdyb/seven", &GdybController{}, "get:PostSeven")
25
-	beego.Router("/gdyb/eight", &GdybController{}, "get:PostEight")
26
-	beego.Router("/gdyb/nine", &GdybController{}, "get:PostNine")
27
-	beego.Router("/gdyb/ten", &GdybController{}, "get:PostTen")
28
-	beego.Router("/gdyb/eleven", &GdybController{}, "get:PostEleven")
29
-	beego.Router("/gdyb/twelve", &GdybController{}, "get:PostTwelve")
30
-
31
-}
32
-
33
-type Result struct {
34
-	ErrMsg      interface{} `json:"err_msg"`
35
-	InfRefmsgid string      `json:"inf_refmsgid"`
36
-	Infcode     int64       `json:"infcode"`
37
-	Output      struct {
38
-		Baseinfo struct {
39
-			Age         float64 `json:"age"`
40
-			Brdy        string  `json:"brdy"`
41
-			Certno      string  `json:"certno"`
42
-			Gend        string  `json:"gend"`
43
-			Naty        string  `json:"naty"`
44
-			PsnCertType string  `json:"psn_cert_type"`
45
-			PsnName     string  `json:"psn_name"`
46
-			PsnNo       string  `json:"psn_no"`
47
-		} `json:"baseinfo"`
48
-		Idetinfo []interface{} `json:"idetinfo"`
49
-		Iinfo    []struct {
50
-			Balc                   int64       `json:"balc"`
51
-			CvlservFlag            string      `json:"cvlserv_flag"`
52
-			EmpName                string      `json:"emp_name"`
53
-			InsuplcAdmdvs          string      `json:"insuplc_admdvs"`
54
-			Insutype               string      `json:"insutype"`
55
-			PausInsuDansuplcAdmdvs string      `json:"paus_insu_dansuplc_admdvs"`
56
-			PausInsuDate           interface{} `json:"paus_insu_date"`
57
-			PsnInsuDate            string      `json:"psn_insu_date"`
58
-			PsnInsuStas            string      `json:"psn_insu_stas"`
59
-			PsnType                string      `json:"psn_type"`
60
-		} `json:"iinfo"`
61
-	} `json:"output"`
62
-	RefmsgTime  string      `json:"refmsg_time"`
63
-	RespondTime string      `json:"respond_time"`
64
-	Signtype    interface{} `json:"signtype"`
65
-	WarnInfo    interface{} `json:"warn_info"`
66
-}
67
-
68
-func (c *GdybController) PostOne() {
69
-	certNo := c.GetString("cert_no")
70
-	org_name := c.GetString("org_name")
71
-	doctor := c.GetString("doctor")
72
-	fixmedins_code := c.GetString("fixmedins_code")
73
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
74
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
75
-	secret_key := c.GetString("secret_key")
76
-	result := service.Gdyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
77
-	var dat map[string]interface{}
78
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
79
-
80
-	} else {
81
-
82
-	}
83
-
84
-	c.ServeSuccessJSON(map[string]interface{}{
85
-		"pre": dat,
86
-	})
87
-}
88
-
89
-func (c *GdybController) PostTwo() {
90
-	psnNo := c.GetString("psn_no")
91
-	insutype := c.GetString("insutype")
92
-	certNo := c.GetString("cert_no")
93
-	org_name := c.GetString("org_name")
94
-	doctor := c.GetString("doctor")
95
-	ipt_otp_no := c.GetString("ipt_otp_no")
96
-	dept := c.GetString("dept")
97
-	fixmedins_code := c.GetString("fixmedins_code")
98
-
99
-	dept_code := c.GetString("dept_code")
100
-	doctor_id := c.GetString("doctor_id")
101
-
102
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
103
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
104
-
105
-	secret_key := c.GetString("secret_key")
106
-
107
-	result := service.Gdyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key)
108
-
109
-	var dat map[string]interface{}
110
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
111
-		//fmt.Println(dat["status"])
112
-	} else {
113
-	}
114
-
115
-	c.ServeSuccessJSON(map[string]interface{}{
116
-		"pre": dat,
117
-	})
118
-}
119
-
120
-func (c *GdybController) PostThree() {
121
-	psnNo := c.GetString("psn_no")
122
-	mdtrtId := c.GetString("mdtrt_id")
123
-	iptOtpNo := c.GetString("ipt_otp_no")
124
-	org_name := c.GetString("org_name")
125
-	doctor := c.GetString("doctor")
126
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
127
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
128
-	secret_key := c.GetString("secret_key")
129
-
130
-	result := service.Gdyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key)
131
-	c.ServeSuccessJSON(map[string]interface{}{
132
-		"pre": result,
133
-	})
134
-}
135
-
136
-func (c *GdybController) PostFour() {
137
-	psnNo := c.GetString("psn_no")
138
-	mdtrtId := c.GetString("mdtrt_id")
139
-	doctor := c.GetString("doctor")
140
-	department := c.GetString("department")
141
-	diag := c.GetString("diag")
142
-	org_name := c.GetString("org_name")
143
-	med_type := c.GetString("med_type")
144
-	doctor_id, _ := c.GetInt64("doctor_id", 0)
145
-	fixmedins_code := c.GetString("fixmedins_code")
146
-
147
-	diag_code := c.GetString("diag_code")
148
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
149
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
150
-	secret_key := c.GetString("secret_key")
151
-
152
-	result := service.Gdyb2203(psnNo, mdtrtId, doctor, department, diag, org_name, med_type, doctor_id, fixmedins_code, diag_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
153
-	var dat map[string]interface{}
154
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
155
-	} else {
156
-	}
157
-	c.ServeSuccessJSON(map[string]interface{}{
158
-		"pre": dat,
159
-	})
160
-}
161
-
162
-type All struct {
163
-	HisPrescription HisPrescription
164
-	mdtrt_id        string
165
-	psn_no          string
166
-}
167
-
168
-type HisPrescription struct {
169
-	ID                     int64                            `gorm:"column:id" json:"id" form:"id"`
170
-	UserOrgId              int64                            `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
171
-	RecordDate             int64                            `gorm:"column:record_date" json:"record_date" form:"record_date"`
172
-	PatientId              int64                            `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
173
-	HisPatientId           int64                            `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
174
-	Status                 int64                            `gorm:"column:status" json:"status" form:"status"`
175
-	Ctime                  int64                            `gorm:"column:ctime" json:"ctime" form:"ctime"`
176
-	Mtime                  int64                            `gorm:"column:mtime" json:"mtime" form:"mtime"`
177
-	Number                 string                           `gorm:"column:number" json:"number" form:"number"`
178
-	Type                   int64                            `gorm:"column:type" json:"type" form:"type"`
179
-	Doctor                 int64                            `gorm:"column:doctor" json:"doctor" form:"doctor"`
180
-	Creator                int64                            `gorm:"column:creator" json:"creator" form:"creator"`
181
-	Modifier               int64                            `gorm:"column:modifier" json:"modifier" form:"modifier"`
182
-	HisDoctorAdviceInfo    []*models.HisDoctorAdviceInfo    `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"advices"`
183
-	HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"project"`
184
-}
185
-
186
-func (c *GdybController) PostFive() {
187
-	body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
188
-	var respJSON map[string]interface{}
189
-	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
190
-		utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
191
-		return
192
-	}
193
-	userJSONBytes, _ := json.Marshal(respJSON["pre"])
194
-	var hp []*models.HisPrescription
195
-	if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
196
-		utils.ErrorLog("解析失败:%v", err)
197
-		return
198
-	}
199
-	fmt.Println(respJSON["psn_no"].(string))
200
-	fmt.Println(respJSON["mdtrt_id"].(string))
201
-
202
-	fmt.Println(respJSON["chrg_bchno"].(string))
203
-	fmt.Println(respJSON["org_name"].(string))
204
-	fmt.Println(respJSON["doctor"].(string))
205
-	fmt.Println(respJSON["dept"].(string))
206
-
207
-	fmt.Println(respJSON["fixmedins_code"].(string))
208
-	fmt.Println(respJSON["dept_code"].(string))
209
-	fmt.Println(respJSON["doctor_id"].(string))
210
-
211
-	fmt.Println(respJSON["insuplc_admdvs"].(string))
212
-	fmt.Println(respJSON["mdtrtarea_admvs"].(string))
213
-	fmt.Println(respJSON["secret_key"].(string))
214
-
215
-	result := service.Gdyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
216
-		respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string))
217
-
218
-	var dat map[string]interface{}
219
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
220
-		fmt.Println(dat)
221
-	} else {
222
-		fmt.Println(err)
223
-	}
224
-	c.ServeSuccessJSON(map[string]interface{}{
225
-		"pre": dat,
226
-	})
227
-}
228
-
229
-func (c *GdybController) PostSix() {
230
-	psnNo := c.GetString("psn_no")
231
-	mdtrtId := c.GetString("mdtrt_id")
232
-	chrgBchno := c.GetString("chrg_bchno")
233
-	org_name := c.GetString("org_name")
234
-	doctor := c.GetString("doctor")
235
-
236
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
237
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
238
-
239
-	secret_key := c.GetString("secret_key")
240
-	fixmedins_code := c.GetString("fixmedins_code")
241
-
242
-	result := service.Gdyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
243
-	var dat map[string]interface{}
244
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
245
-		fmt.Println(dat)
246
-	} else {
247
-		fmt.Println(err)
248
-	}
249
-	c.ServeSuccessJSON(map[string]interface{}{
250
-		"pre": result,
251
-	})
252
-}
253
-
254
-func (c *GdybController) PostSeven() {
255
-	psnNo := c.GetString("psn_no")
256
-	mdtrtId := c.GetString("mdtrt_id")
257
-	chrgBchno := c.GetString("chrg_bchno")
258
-	certNo := c.GetString("cert_no")
259
-	insutype := c.GetString("insutype")
260
-	total := c.GetString("total")
261
-	org_name := c.GetString("org_name")
262
-	doctor := c.GetString("doctor")
263
-	secret_key := c.GetString("secret_key")
264
-
265
-	result := service.Gdyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, secret_key)
266
-	var dat map[string]interface{}
267
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
268
-		fmt.Println(dat)
269
-	} else {
270
-		fmt.Println(err)
271
-	}
272
-	c.ServeSuccessJSON(map[string]interface{}{
273
-		"pre": dat,
274
-	})
275
-}
276
-
277
-func (c *GdybController) PostEight() {
278
-	psnNo := c.GetString("psn_no")
279
-	mdtrtId := c.GetString("mdtrt_id")
280
-	chrgBchno := c.GetString("chrg_bchno")
281
-	certNo := c.GetString("cert_no")
282
-	insutype := c.GetString("insutype")
283
-	total := c.GetString("total")
284
-	org_name := c.GetString("org_name")
285
-	doctor := c.GetString("doctor")
286
-	fixmedins_code := c.GetString("fixmedins_code")
287
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
288
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
289
-	secret_key := c.GetString("secret_key")
290
-
291
-	result := service.Gdyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key)
292
-	var dat map[string]interface{}
293
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
294
-		fmt.Println(dat)
295
-	} else {
296
-		fmt.Println(err)
297
-	}
298
-
299
-	c.ServeSuccessJSON(map[string]interface{}{
300
-		"pre": dat,
301
-	})
302
-}
303
-
304
-func (c *GdybController) PostNine() {
305
-	psnNo := c.GetString("psn_no")
306
-	mdtrtId := c.GetString("mdtrt_id")
307
-	setlId := c.GetString("setl_id")
308
-	org_name := c.GetString("org_name")
309
-	doctor := c.GetString("doctor")
310
-	secret_key := c.GetString("secret_key")
311
-	fixmedins_code := c.GetString("fixmedins_code")
312
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
313
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
314
-	result := service.Gdyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
315
-	var dat map[string]interface{}
316
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
317
-		fmt.Println(dat)
318
-	} else {
319
-		fmt.Println(err)
320
-	}
321
-	c.ServeSuccessJSON(map[string]interface{}{
322
-		"pre": dat,
323
-	})
324
-}
325
-
326
-func (c *GdybController) PostTen() {
327
-	fmt.Println("11222333-----")
328
-
329
-	insutype := c.GetString("insutype")
330
-	clrType := c.GetString("clr_type")
331
-	setlOptins := c.GetString("setl_optins")
332
-	stmtBegndate := c.GetString("stmt_begndate")
333
-	stmtEnddate := c.GetString("stm_enddate")
334
-	medfeeSumamt, _ := c.GetFloat("medfee_sumamt", 0)
335
-	fundPaySumamt, _ := c.GetFloat("fund_pay_sumamt", 0)
336
-	acctPay, _ := c.GetFloat("acct_pay", 0)
337
-	fixmedinsSetlCnt, _ := c.GetInt64("fixmedins_setl_cnt", 0)
338
-	fixmedins_code := c.GetString("fixmedins_code")
339
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
340
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
341
-	secret_key := c.GetString("secret_key")
342
-	org_name := c.GetString("org_name")
343
-	doctor := c.GetString("doctor")
344
-
345
-	fmt.Println(insutype)
346
-	fmt.Println(clrType)
347
-	fmt.Println(setlOptins)
348
-	fmt.Println(stmtBegndate)
349
-	fmt.Println(stmtEnddate)
350
-	fmt.Println(medfeeSumamt)
351
-
352
-	baseParams := models.BaseParams{
353
-		SecretKey:      secret_key,
354
-		FixmedinsCode:  fixmedins_code,
355
-		InsuplcAdmdvs:  insuplc_admdvs,
356
-		MdtrtareaAdmvs: mdtrtarea_admvs,
357
-		OrgName:        org_name,
358
-		Doctor:         doctor,
359
-	}
360
-	businessParams := models.BusinessParams{
361
-		Insutype:         insutype,
362
-		ClrType:          clrType,
363
-		SetlOptins:       setlOptins,
364
-		StmtBegndate:     stmtBegndate,
365
-		StmtEnddate:      stmtEnddate,
366
-		MedfeeSumamt:     medfeeSumamt,
367
-		FundPaySumamt:    fundPaySumamt,
368
-		AcctPay:          acctPay,
369
-		FixmedinsSetlCnt: fixmedinsSetlCnt,
370
-	}
371
-	fmt.Println(baseParams)
372
-	fmt.Println(businessParams)
373
-
374
-	fmt.Println("11222333--33333---")
375
-
376
-	result := service.Gdyb3201(baseParams, businessParams)
377
-	fmt.Println("11222333--33333---555555")
378
-
379
-	var dat map[string]interface{}
380
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
381
-		fmt.Println(dat)
382
-	} else {
383
-		fmt.Println(err)
384
-	}
385
-	c.ServeSuccessJSON(map[string]interface{}{
386
-		"pre": dat,
387
-	})
388
-}
389
-
390
-func (c *GdybController) PostEleven() {
391
-	//fmt.Println("777777666666-----")
392
-	//
393
-	//file_byte := c.GetString("file_byte")
394
-	//file_name := c.GetString("file_name")
395
-	//fixmedins_code := c.GetString("fixmedins_code")
396
-	//insuplc_admdvs := c.GetString("insuplc_admdvs")
397
-	//mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
398
-	//secret_key := c.GetString("secret_key")
399
-	//org_name := c.GetString("org_name")
400
-	//doctor := c.GetString("doctor")
401
-	//
402
-	//baseParams := models.BaseParams{
403
-	//	SecretKey:      secret_key,
404
-	//	FixmedinsCode:  fixmedins_code,
405
-	//	InsuplcAdmdvs:  insuplc_admdvs,
406
-	//	MdtrtareaAdmvs: mdtrtarea_admvs,
407
-	//	OrgName:        org_name,
408
-	//	Doctor:         doctor,
409
-	//}
410
-
411
-	//x := (*[2]uintptr)(unsafe.Pointer(&file_byte))
412
-	//h := [3]uintptr{x[0], x[1], x[1]}
413
-	//bytes := *(*[]byte)(unsafe.Pointer(&h))
414
-
415
-	//result := service.Gdyb9101(baseParams, file_name, []byte(file_byte))
416
-	//var dat map[string]interface{}
417
-	//if err := json.Unmarshal([]byte(result), &dat); err == nil {
418
-	//	fmt.Println(dat)
419
-	//} else {
420
-	//	fmt.Println(err)
421
-	//}
422
-	//c.ServeSuccessJSON(map[string]interface{}{
423
-	//	"pre": dat,
424
-	//})
425
-}
426
-
427
-func (c *GdybController) PostTwelve() {
428
-	fileQuryNo := c.GetString("file_qury_no")
429
-	setlOptins := c.GetString("setl_optins")
430
-	stmtBegndate := c.GetString("stmt_begndate")
431
-	stmtEnddate := c.GetString("stm_enddate")
432
-	medfeeSumamt, _ := c.GetFloat("medfee_sumamt", 0)
433
-	fundPaySumamt, _ := c.GetFloat("fund_pay_sumamt", 0)
434
-	fixmedinsSetlCnt, _ := c.GetInt64("fixmedins_setl_cnt", 0)
435
-	fixmedins_code := c.GetString("fixmedins_code")
436
-	insuplc_admdvs := c.GetString("insuplc_admdvs")
437
-	mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
438
-	secret_key := c.GetString("secret_key")
439
-	org_name := c.GetString("org_name")
440
-	doctor := c.GetString("doctor")
441
-	cashPayamt, _ := c.GetFloat("cash_payamt", 0)
442
-
443
-	baseParams := models.BaseParams{
444
-		SecretKey:      secret_key,
445
-		FixmedinsCode:  fixmedins_code,
446
-		InsuplcAdmdvs:  insuplc_admdvs,
447
-		MdtrtareaAdmvs: mdtrtarea_admvs,
448
-		OrgName:        org_name,
449
-		Doctor:         doctor,
450
-	}
451
-	businessParams := models.BusinessParams{
452
-		FileQuryNo:       fileQuryNo,
453
-		SetlOptins:       setlOptins,
454
-		StmtBegndate:     stmtBegndate,
455
-		StmtEnddate:      stmtEnddate,
456
-		MedfeeSumamt:     medfeeSumamt,
457
-		FundPaySumamt:    fundPaySumamt,
458
-		FixmedinsSetlCnt: fixmedinsSetlCnt,
459
-		CashPayamt:       cashPayamt,
460
-	}
461
-
462
-	result := service.Gdyb3202(baseParams, businessParams)
463
-	var dat map[string]interface{}
464
-	if err := json.Unmarshal([]byte(result), &dat); err == nil {
465
-		fmt.Println(dat)
466
-	} else {
467
-		fmt.Println(err)
468
-	}
469
-	c.ServeSuccessJSON(map[string]interface{}{
470
-		"pre": dat,
471
-	})
472
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 2644
controllers/gobal_config_api_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 10336
controllers/his_api_controller.go


+ 0 - 456
controllers/his_charge_api_controller.go Просмотреть файл

@@ -1,456 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"github.com/astaxie/beego"
9
-	"time"
10
-)
11
-
12
-type HisChargeApiController struct {
13
-	BaseAuthAPIController
14
-}
15
-
16
-func HisChargeApiRegistRouters() {
17
-	beego.Router("/api/his/chargestatistics/detail", &HisChargeApiController{}, "get:GetChargeStatisticsDetail")
18
-	beego.Router("/api/his/chargestatistics/settle", &HisChargeApiController{}, "get:GetChargeStatisticsSettle")
19
-
20
-	beego.Router("/api/his/patient", &HisChargeApiController{}, "get:GetAllPatient")
21
-	//beego.Router("/api/his/chargestatistics/settle", &HisChargeApiController{}, "get:GetChargeStatisticsSettle")
22
-
23
-	beego.Router("/api/his/inspectionlist/get", &HisChargeApiController{}, "get:GetHisInspectionList")
24
-	beego.Router("/api/his/inspectioninfo/get", &HisChargeApiController{}, "get:GetHisInspectionInfo")
25
-
26
-	//发票
27
-	beego.Router("/api/fapiao/create", &HisChargeApiController{}, "post:CreateFaPiaoRecord")
28
-	beego.Router("/api/fapiao/modify", &HisChargeApiController{}, "post:ModifyFaPiaoRecord")
29
-	beego.Router("/api/fapiao/list", &HisChargeApiController{}, "get:GetFaPiaoRecordList")
30
-	beego.Router("/api/fapiao/delete", &HisChargeApiController{}, "post:DeleteFaPiaoRecord")
31
-	beego.Router("/api/fapiao", &HisChargeApiController{}, "get:GetFaPiaoRecord")
32
-	beego.Router("/api/fapiao/is_use", &HisChargeApiController{}, "post:UpdateFaPiaoRecordIsUse")
33
-
34
-	beego.Router("/api/his/getyidiclear", &HisChargeApiController{}, "get:GetHisYidiClearRecord")
35
-
36
-	beego.Router("/api/his/getexportdata", &HisChargeApiController{}, "get:GetExportData")
37
-
38
-}
39
-
40
-func (c *HisChargeApiController) GetExportData() {
41
-	start_time := c.GetString("start_time")
42
-	end_time := c.GetString("end_time")
43
-	adminUser := c.GetAdminUserInfo()
44
-	timeLayout := "2006-01-02"
45
-	loc, _ := time.LoadLocation("Local")
46
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
47
-	if err != nil {
48
-
49
-	}
50
-	startRecordDateTime := startTime.Unix()
51
-
52
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
53
-	if err != nil {
54
-
55
-	}
56
-	endRecordDateTime := endTime.Unix()
57
-	chargePatient, err := service.GetAllChargeDetailsTwo(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
58
-	if err == nil {
59
-		c.ServeSuccessJSON(map[string]interface{}{
60
-			"patients": chargePatient,
61
-		})
62
-		return
63
-	} else {
64
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
65
-		return
66
-
67
-	}
68
-
69
-}
70
-
71
-func (c *HisChargeApiController) UpdateFaPiaoRecordIsUse() {
72
-	id, _ := c.GetInt64("id", 0)
73
-	is_use, _ := c.GetInt64("is_use")
74
-	if id <= 0 {
75
-		utils.ErrorLog("id == 0")
76
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
77
-		return
78
-	}
79
-
80
-	record, _ := service.FindFapiaoById(id)
81
-	adminUserInfo := c.GetAdminUserInfo()
82
-	service.UpdateFapiaoIsUse(adminUserInfo.CurrentOrgId)
83
-	records := models.HisFapiaoRecord{
84
-		ID:           id,
85
-		FapiaoCode:   record.FapiaoCode,
86
-		FapiaoNumber: record.FapiaoNumber,
87
-		Ctime:        time.Now().Unix(),
88
-		Mtime:        time.Now().Unix(),
89
-		UserOrgId:    adminUserInfo.CurrentOrgId,
90
-		Status:       1,
91
-		IsUse:        is_use,
92
-	}
93
-	err := service.ModifyFapiao(&records)
94
-	if err == nil {
95
-		c.ServeSuccessJSON(map[string]interface{}{
96
-			"fapiao_record": records,
97
-		})
98
-	} else {
99
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
100
-	}
101
-}
102
-func (c *HisChargeApiController) CreateFaPiaoRecord() {
103
-	fapiao_code := c.GetString("fapiao_code")
104
-	fapiao_number := c.GetString("fapiao_number")
105
-	if len(fapiao_code) <= 0 {
106
-		utils.ErrorLog("len(fapiao_code) == 0")
107
-
108
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
109
-		return
110
-	}
111
-
112
-	if len(fapiao_number) <= 0 {
113
-		utils.ErrorLog("len(fapiao_number) == 0")
114
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
115
-		return
116
-	}
117
-
118
-	adminUserInfo := c.GetAdminUserInfo()
119
-
120
-	record := models.HisFapiaoRecord{
121
-		FapiaoCode:   fapiao_code,
122
-		FapiaoNumber: fapiao_number,
123
-		Ctime:        time.Now().Unix(),
124
-		Mtime:        time.Now().Unix(),
125
-		UserOrgId:    adminUserInfo.CurrentOrgId,
126
-		Status:       1,
127
-		IsUse:        0,
128
-	}
129
-
130
-	err, records := service.AddSigleFapiaoRecord(&record)
131
-	if err == nil {
132
-		c.ServeSuccessJSON(map[string]interface{}{
133
-			"fapiao_record": records,
134
-		})
135
-
136
-	} else {
137
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
138
-
139
-	}
140
-
141
-}
142
-func (c *HisChargeApiController) ModifyFaPiaoRecord() {
143
-	id, _ := c.GetInt64("id", 0)
144
-	fapiao_code := c.GetString("fapiao_code")
145
-	fapiao_number := c.GetString("fapiao_number")
146
-
147
-	if id <= 0 {
148
-		utils.ErrorLog("id == 0")
149
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
150
-		return
151
-	}
152
-
153
-	if len(fapiao_code) <= 0 {
154
-		utils.ErrorLog("len(fapiao_code) == 0")
155
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
156
-		return
157
-	}
158
-
159
-	if len(fapiao_number) <= 0 {
160
-		utils.ErrorLog("len(fapiao_number) == 0")
161
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
162
-		return
163
-	}
164
-
165
-	record, _ := service.FindFapiaoById(id)
166
-	adminUserInfo := c.GetAdminUserInfo()
167
-	records := models.HisFapiaoRecord{
168
-		ID:           id,
169
-		FapiaoCode:   fapiao_code,
170
-		FapiaoNumber: fapiao_number,
171
-		Ctime:        time.Now().Unix(),
172
-		Mtime:        time.Now().Unix(),
173
-		UserOrgId:    adminUserInfo.CurrentOrgId,
174
-		Status:       1,
175
-		IsUse:        record.IsUse,
176
-	}
177
-
178
-	err := service.ModifyFapiao(&records)
179
-
180
-	if err == nil {
181
-		c.ServeSuccessJSON(map[string]interface{}{
182
-			"fapiao_record": records,
183
-		})
184
-	} else {
185
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
186
-	}
187
-}
188
-func (c *HisChargeApiController) GetFaPiaoRecordList() {
189
-	page, _ := c.GetInt64("page", 1)
190
-	limit, _ := c.GetInt64("limit", 7)
191
-	adminUserInfo := c.GetAdminUserInfo()
192
-	fapiaoRecord, total, err := service.FindAllFapiaoList(adminUserInfo.CurrentOrgId, page, limit)
193
-	if err == nil {
194
-		c.ServeSuccessJSON(map[string]interface{}{
195
-			"fapiao_record": fapiaoRecord,
196
-			"total":         total,
197
-		})
198
-	} else {
199
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
200
-	}
201
-}
202
-func (c *HisChargeApiController) DeleteFaPiaoRecord() {
203
-	id, _ := c.GetInt64("id", 0)
204
-	err := service.DeleteFapiaoById(id)
205
-	if err == nil {
206
-		c.ServeSuccessJSON(map[string]interface{}{
207
-			"msg": "删除成功",
208
-		})
209
-	} else {
210
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
211
-	}
212
-}
213
-func (c *HisChargeApiController) GetFaPiaoRecord() {
214
-	id, _ := c.GetInt64("id", 0)
215
-	fapiaoRecord, err := service.FindFapiaoById(id)
216
-	if err == nil {
217
-		c.ServeSuccessJSON(map[string]interface{}{
218
-			"fapiao_record": fapiaoRecord,
219
-		})
220
-	} else {
221
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
222
-	}
223
-}
224
-
225
-func (c *HisChargeApiController) GetChargeStatisticsDetail() {
226
-	start_time := c.GetString("start_time")
227
-	end_time := c.GetString("end_time")
228
-	keyword := c.GetString("keyword")
229
-	item_type, _ := c.GetInt64("type")
230
-
231
-	adminUser := c.GetAdminUserInfo()
232
-
233
-	timeLayout := "2006-01-02"
234
-	loc, _ := time.LoadLocation("Local")
235
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
236
-	if err != nil {
237
-
238
-	}
239
-	startRecordDateTime := startTime.Unix()
240
-
241
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
242
-	if err != nil {
243
-
244
-	}
245
-	endRecordDateTime := endTime.Unix()
246
-
247
-	chargePatient, err := service.GetAllPatientChargeDetails(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type)
248
-
249
-	if err == nil {
250
-		c.ServeSuccessJSON(map[string]interface{}{
251
-			"patients": chargePatient,
252
-		})
253
-		return
254
-	} else {
255
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
256
-		return
257
-
258
-	}
259
-
260
-}
261
-
262
-func (c *HisChargeApiController) GetChargeStatisticsSettle() {
263
-	start_time := c.GetString("start_time")
264
-	end_time := c.GetString("end_time")
265
-	keyword := c.GetString("keyword")
266
-	item_type, _ := c.GetInt64("type")
267
-	adminUser := c.GetAdminUserInfo()
268
-
269
-	timeLayout := "2006-01-02"
270
-	loc, _ := time.LoadLocation("Local")
271
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
272
-	if err != nil {
273
-
274
-	}
275
-	startRecordDateTime := startTime.Unix()
276
-
277
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
278
-	if err != nil {
279
-
280
-	}
281
-	endRecordDateTime := endTime.Unix()
282
-	chargePatient, err := service.GetAllPatientChargeSettle(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type)
283
-	if err == nil {
284
-		c.ServeSuccessJSON(map[string]interface{}{
285
-			"patients": chargePatient,
286
-		})
287
-		return
288
-	} else {
289
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
290
-		return
291
-
292
-	}
293
-
294
-}
295
-
296
-func (c *HisChargeApiController) GetHisInspectionList() {
297
-	record_date := c.GetString("record_date")
298
-	keyword := c.GetString("keyword")
299
-	is_print, _ := c.GetInt64("is_print")
300
-	page, _ := c.GetInt64("page")
301
-	limit, _ := c.GetInt64("limit")
302
-	tube_color, _ := c.GetInt64("tube_color")
303
-
304
-	adminUser := c.GetAdminUserInfo()
305
-
306
-	timeLayout := "2006-01-02"
307
-	loc, _ := time.LoadLocation("Local")
308
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
309
-	if err != nil {
310
-
311
-	}
312
-	record_time := startTime.Unix()
313
-	var labels []*models.HisLabelPrintInfo
314
-	var labels_two []*models.HisLabelPrintInfo
315
-
316
-	var total int64
317
-	var total_two int64
318
-	//var err error
319
-	if tube_color == 0 {
320
-		labels, total, err = service.GetLabelPrintList(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color)
321
-	} else {
322
-		labels, total, err = service.GetLabelPrintList(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color)
323
-		labels_two, total_two, err = service.GetLabelPrintListTwo(page, limit, adminUser.CurrentOrgId, record_time, is_print, keyword, tube_color)
324
-		total = total + total_two
325
-		labels = append(labels, labels_two...)
326
-	}
327
-
328
-	if err == nil {
329
-
330
-		c.ServeSuccessJSON(map[string]interface{}{
331
-			"labels": labels,
332
-			"total":  total,
333
-		})
334
-		return
335
-
336
-	} else {
337
-
338
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
339
-		return
340
-
341
-	}
342
-
343
-}
344
-func (c *HisChargeApiController) GetHisInspectionInfo() {
345
-	id, _ := c.GetInt64("id")
346
-	label, err := service.GetLabelPrintInfo(id)
347
-	if err == nil {
348
-		c.ServeSuccessJSON(map[string]interface{}{
349
-			"label": label,
350
-		})
351
-		return
352
-	} else {
353
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
354
-		return
355
-	}
356
-}
357
-
358
-func (c *HisChargeApiController) GetHisYidiClearRecord() {
359
-	records, err := service.FindHisYidiClearRecord(c.GetAdminUserInfo().CurrentOrgId)
360
-	if err == nil {
361
-		c.ServeSuccessJSON(map[string]interface{}{
362
-			"list": records,
363
-		})
364
-		return
365
-	} else {
366
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
367
-		return
368
-	}
369
-}
370
-
371
-func (c *HisChargeApiController) GetAllPatient() {
372
-	patients, err := service.GetAllPatientTwo(c.GetAdminUserInfo().CurrentOrgId)
373
-	if err == nil {
374
-		c.ServeSuccessJSON(map[string]interface{}{
375
-			"list": patients,
376
-		})
377
-		return
378
-	} else {
379
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
380
-		return
381
-	}
382
-}
383
-
384
-func (c *HisChargeApiController) GetStatisticsDetail() {
385
-	start_time := c.GetString("start_time")
386
-	end_time := c.GetString("end_time")
387
-	keyword := c.GetString("keyword")
388
-	item_type, _ := c.GetInt64("type")
389
-	p_type, _ := c.GetInt64("p_type")
390
-	patinet_id, _ := c.GetInt64("patinet_id")
391
-
392
-	adminUser := c.GetAdminUserInfo()
393
-
394
-	timeLayout := "2006-01-02"
395
-	loc, _ := time.LoadLocation("Local")
396
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
397
-	if err != nil {
398
-
399
-	}
400
-	startRecordDateTime := startTime.Unix()
401
-
402
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
403
-	if err != nil {
404
-
405
-	}
406
-	endRecordDateTime := endTime.Unix()
407
-
408
-	chargePatient, err := service.GetPatientChargeDetails(patinet_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type, p_type)
409
-
410
-	if err == nil {
411
-		c.ServeSuccessJSON(map[string]interface{}{
412
-			"patients": chargePatient,
413
-		})
414
-		return
415
-	} else {
416
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
417
-		return
418
-
419
-	}
420
-
421
-}
422
-
423
-func (c *HisChargeApiController) GetStatisticsGather() {
424
-	start_time := c.GetString("start_time")
425
-	end_time := c.GetString("end_time")
426
-	keyword := c.GetString("keyword")
427
-	item_type, _ := c.GetInt64("type")
428
-	adminUser := c.GetAdminUserInfo()
429
-	timeLayout := "2006-01-02"
430
-	loc, _ := time.LoadLocation("Local")
431
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
432
-	if err != nil {
433
-
434
-	}
435
-	startRecordDateTime := startTime.Unix()
436
-
437
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
438
-	if err != nil {
439
-
440
-	}
441
-	endRecordDateTime := endTime.Unix()
442
-
443
-	chargePatient, err := service.GetAllPatientChargeDetails(adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime, keyword, item_type)
444
-
445
-	if err == nil {
446
-		c.ServeSuccessJSON(map[string]interface{}{
447
-			"patients": chargePatient,
448
-		})
449
-		return
450
-	} else {
451
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
452
-		return
453
-
454
-	}
455
-
456
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1844
controllers/his_config_api_controller.go


+ 0 - 989
controllers/his_deposit_controller.go Просмотреть файл

@@ -1,989 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"encoding/json"
9
-	"fmt"
10
-	"github.com/astaxie/beego"
11
-	"github.com/shopspring/decimal"
12
-	"strconv"
13
-	"strings"
14
-	"time"
15
-)
16
-
17
-type HisDepositApiController struct {
18
-	BaseAuthAPIController
19
-}
20
-
21
-func HisDepositApiRegistRouters() {
22
-	//beego.Router("/api/his/ttt", &HisDepositApiController{}, "get:TTT")                         //测试接口
23
-	beego.Router("/api/his/gethisusertoalive", &HisDepositApiController{}, "get:GetHisUserToAlive")  //获取病例中心,有效患者名称(去除了转出和死亡的)
24
-	beego.Router("/api/his/gethisuser", &HisDepositApiController{}, "get:GetHisUser")                //获取病例中心,有效患者名称
25
-	beego.Router("/api/his/adddeposit", &HisDepositApiController{}, "post:AddDeposit")               //新增押金
26
-	beego.Router("/api/his/getdepositcode", &HisDepositApiController{}, "get:GetDepositCode")        //获取新增押金编号
27
-	beego.Router("/api/his/getdeletecode", &HisDepositApiController{}, "get:GetDeleteCode")          //获取退款编号
28
-	beego.Router("/api/his/rechargedetails", &HisDepositApiController{}, "get:RechargeDetails")      //充值明细列表
29
-	beego.Router("/api/his/updeposit", &HisDepositApiController{}, "get:UpDeposit")                  //押金审核
30
-	beego.Router("/api/his/deletehistory", &HisDepositApiController{}, "get:DeleteHistory")          //押金删除
31
-	beego.Router("/api/his/rechargesummary", &HisDepositApiController{}, "get:RechargeSummary")      //充值汇总列表
32
-	beego.Router("/api/his/getuserlist", &HisDepositApiController{}, "get:GetUserList")              //获取患者押金列表
33
-	beego.Router("/api/his/depositflow", &HisDepositApiController{}, "get:DepositFlow")              //根据患者id获取押金流水
34
-	beego.Router("/api/his/deductiondetails", &HisDepositApiController{}, "get:DeductionDetails")    //扣费明细查询
35
-	beego.Router("/api/his/desummary", &HisDepositApiController{}, "get:DeSummary")                  //扣费汇总
36
-	beego.Router("/api/his/idtobalance", &HisDepositApiController{}, "get:IdToBalance")              //根据患者id查询患者的余额
37
-	beego.Router("/api/his/refundapplication", &HisDepositApiController{}, "post:RefundApplication") //新增一条退款申请
38
-	beego.Router("/api/his/refundreview", &HisDepositApiController{}, "get:RefundReview")            //退款审核通过/拒绝
39
-	beego.Router("/api/his/deleterefund", &HisDepositApiController{}, "get:DeleteRefund")            //退款删除
40
-	beego.Router("/api/his/changerefund", &HisDepositApiController{}, "post:ChangeRefund")           //更改退款申请
41
-	beego.Router("/api/his/refundlist", &HisDepositApiController{}, "get:RefundList")                //退款分页
42
-	beego.Router("/api/his/getorgname", &HisDepositApiController{}, "get:GetorgName")                //获取供应商名字
43
-	beego.Router("/api/his/getweektime", &HisDepositApiController{}, "get:GetWeekTime")              //获取本周时间
44
-	beego.Router("/api/his/getmonthtime", &HisDepositApiController{}, "get:GetMonthTime")            //获取本月时间
45
-}
46
-
47
-//func (this *HisDepositApiController) TTT() {
48
-//	orgid := this.GetAdminUserInfo().CurrentOrgId
49
-//	id, _ := this.GetInt64("id")
50
-//	code := this.GetString("code")
51
-//	deposit,_ := this.GetInt64("depostit")
52
-//	err := service.MoneyIncrease(orgid,id,code,deposit)
53
-//	if err != nil {
54
-//
55
-//	}
56
-//	this.ServeSuccessJSON(map[string]interface{}{
57
-//		"list": "成功",
58
-//	})
59
-//	return
60
-//}
61
-
62
-//获取病例中心,有效患者名称(去除了转出和死亡的)
63
-func (this *HisDepositApiController) GetHisUserToAlive() {
64
-	orgid := this.GetAdminUserInfo().CurrentOrgId
65
-	list, err := service.GetHisUserToAlive(orgid)
66
-	if err != nil {
67
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
68
-		return
69
-	}
70
-	this.ServeSuccessJSON(map[string]interface{}{
71
-		"list": list,
72
-	})
73
-	return
74
-}
75
-
76
-//获取病例中心,有效患者名称
77
-func (this *HisDepositApiController) GetHisUser() {
78
-	orgid := this.GetAdminUserInfo().CurrentOrgId
79
-	token := this.Ctx.Request.Header.Get("Cookie")
80
-	fmt.Println(token)
81
-	list, err := service.GetHisUser(orgid)
82
-	if err != nil {
83
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
84
-		return
85
-	}
86
-	this.ServeSuccessJSON(map[string]interface{}{
87
-		"list": list,
88
-	})
89
-	return
90
-}
91
-
92
-//新增押金
93
-func (this *HisDepositApiController) AddDeposit() {
94
-	orgid := this.GetAdminUserInfo().CurrentOrgId
95
-	dataBody := make(map[string]interface{}, 0)
96
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
97
-	if err != nil {
98
-		utils.ErrorLog(err.Error())
99
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
100
-		return
101
-	}
102
-	switch {
103
-	case dataBody["code"] == nil:
104
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金编号不能为空")
105
-		return
106
-	case dataBody["his_patient_id"] == nil || dataBody["his_patient_id"] == "":
107
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "患者名称不能为空")
108
-		return
109
-	case dataBody["deposit"] == nil || dataBody["deposit"] == "":
110
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金金额不能为空")
111
-		return
112
-	case dataBody["trial_status"] == nil || dataBody["trial_status"] == "":
113
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "审核状态不能为空")
114
-		return
115
-	}
116
-	code := dataBody["code"].(string)                             //押金编号
117
-	his_patient_id := int64(dataBody["his_patient_id"].(float64)) //患者编号
118
-	var tmps float64
119
-	switch dataBody["deposit"].(type) {
120
-	case string:
121
-		t_deposit := dataBody["deposit"].(string)
122
-		if len(t_deposit) > 0 {
123
-			if t_deposit[0] == 45 {
124
-				this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金金额错误")
125
-				return
126
-			}
127
-		}
128
-		tt, errs := strconv.ParseFloat(t_deposit, 64)
129
-		if errs != nil {
130
-			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金金额错误")
131
-			return
132
-		} else {
133
-			tmps = tt
134
-		}
135
-	default:
136
-		tmps = dataBody["deposit"].(float64)
137
-	}
138
-	if tmps == 0 {
139
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金金额不能为0")
140
-		return
141
-	}
142
-	deposit := decimal.NewFromFloat(tmps) //押金金额
143
-	var remarks string
144
-	if dataBody["remarks"] == nil {
145
-		remarks = ""
146
-	} else {
147
-		remarks = dataBody["remarks"].(string) //备注
148
-	}
149
-	trial_status := int64(dataBody["trial_status"].(float64)) //审核状态
150
-	createid := this.GetAdminUserInfo().AdminUser.Id
151
-	pp := this.GetAdminUserInfo()
152
-	fmt.Println(pp)
153
-	err = service.UpDeposit(code, remarks, his_patient_id, orgid, trial_status, createid, deposit)
154
-	if err != nil {
155
-		utils.ErrorLog(err.Error())
156
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
157
-		return
158
-	}
159
-	this.ServeSuccessJSON(map[string]interface{}{
160
-		"list": "添加成功",
161
-	})
162
-	return
163
-}
164
-
165
-//获取新增押金编号
166
-func (this *HisDepositApiController) GetDepositCode() {
167
-	orgid := this.GetAdminUserInfo().CurrentOrgId
168
-	var code string
169
-	for a := true; a == true; {
170
-		code = service.CreateCPCode("CP")
171
-		tmp := service.FindDecimalCode(orgid, code)
172
-		if tmp == false {
173
-			a = false
174
-		}
175
-	}
176
-	this.ServeSuccessJSON(map[string]interface{}{
177
-		"list": code,
178
-	})
179
-	return
180
-}
181
-
182
-//获取退款编号
183
-func (this *HisDepositApiController) GetDeleteCode() {
184
-	orgid := this.GetAdminUserInfo().CurrentOrgId
185
-	var code string
186
-	for a := true; a == true; {
187
-		code = service.CreateCPCode("AF")
188
-		tmp := service.FindDecimalCode(orgid, code)
189
-		if tmp == false {
190
-			a = false
191
-		}
192
-	}
193
-	this.ServeSuccessJSON(map[string]interface{}{
194
-		"list": code,
195
-	})
196
-	return
197
-}
198
-
199
-//充值明细列表
200
-func (this *HisDepositApiController) RechargeDetails() {
201
-	orgid := this.GetAdminUserInfo().CurrentOrgId
202
-	timeLayout := "2006-01-02"
203
-	loc, _ := time.LoadLocation("Local")
204
-	keyword := this.GetString("keyword")
205
-	start_time := this.GetString("start_time")
206
-	end_time := this.GetString("end_time")
207
-	var stime int64 //开始时间
208
-	var etime int64 //结束时间
209
-
210
-	namemap := make(map[int64]string)
211
-	slicekey := make([]int64, 0)
212
-	lists, _ := service.GetHisUser(orgid)
213
-	for _, v := range lists {
214
-		namemap[v.ID] = v.Name
215
-	}
216
-	if len(keyword) > 0 {
217
-		for k, v := range namemap {
218
-			res := strings.Contains(v, keyword)
219
-			if res == true {
220
-				slicekey = append(slicekey, k)
221
-			}
222
-		}
223
-	}
224
-	if start_time == "" && end_time == "" {
225
-		//如果为空查询全部的
226
-		_, etime = service.GetMondayOfWeek()
227
-		stime = 0
228
-	} else {
229
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
230
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
231
-		stime = stmp.Unix()
232
-		etime = etmp.Unix()
233
-	}
234
-	list, err := service.DetailsList(orgid, stime, etime, keyword, slicekey)
235
-	if err != nil {
236
-		utils.ErrorLog(err.Error())
237
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
238
-		return
239
-	}
240
-	var sum decimal.Decimal
241
-	for i := 0; i < len(list); i++ {
242
-		if list[i].TrialStatus == 1 {
243
-			sum = sum.Add(list[i].Deposit)
244
-		}
245
-		list[i].Name = service.GetCreateidName(list[i].CreateId, orgid)
246
-		list[i].HisName = namemap[list[i].HisPatientId]
247
-		list[i].Starttime = fmt.Sprintf(time.Unix(list[i].Ctime, 0).Format("2006-01-02"))
248
-	}
249
-	this.ServeSuccessJSON(map[string]interface{}{
250
-		"list": list,
251
-		"sum":  sum,
252
-	})
253
-	return
254
-}
255
-
256
-//充值汇总列表
257
-func (this *HisDepositApiController) RechargeSummary() {
258
-	orgid := this.GetAdminUserInfo().CurrentOrgId
259
-	timeLayout := "2006-01-02"
260
-	loc, _ := time.LoadLocation("Local")
261
-	keyword := this.GetString("keyword")
262
-	start_time := this.GetString("start_time")
263
-	end_time := this.GetString("end_time")
264
-	var stime int64 //开始时间
265
-	var etime int64 //结束时间
266
-	namemap := make(map[int64]string)
267
-	slicekey := make([]int64, 0)
268
-	lists, _ := service.GetHisUser(orgid)
269
-	for _, v := range lists {
270
-		namemap[v.ID] = v.Name
271
-	}
272
-	if len(keyword) > 0 {
273
-		for k, v := range namemap {
274
-			res := strings.Contains(v, keyword)
275
-			if res == true {
276
-				slicekey = append(slicekey, k)
277
-			}
278
-		}
279
-	}
280
-	if start_time == "" && end_time == "" {
281
-		_, etime = service.GetMondayOfWeek()
282
-		stime = 0
283
-	} else {
284
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
285
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
286
-		stime = stmp.Unix()
287
-		etime = etmp.Unix()
288
-	}
289
-	list, err := service.SummaryList(orgid, stime, etime, keyword, slicekey)
290
-	if err != nil {
291
-		utils.ErrorLog(err.Error())
292
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
293
-		return
294
-	}
295
-	//list为详细数据,把list整理合并为maplist输出
296
-	maplist := make(map[int64]models.Summary)
297
-	Finlist := []models.Summary{}
298
-	tmpslice := make([]int64, 0)
299
-	var sum decimal.Decimal
300
-	for i := 0; i < len(list); i++ {
301
-		if list[i].TrialStatus == 1 {
302
-			if k, ok := maplist[list[i].HisPatientId]; ok {
303
-				k.SumDecimal = k.SumDecimal.Add(list[i].Deposit)
304
-				maplist[list[i].HisPatientId] = models.Summary{
305
-					namemap[list[i].HisPatientId],
306
-					k.SumDecimal,
307
-					service.GetUserMoney(list[i].HisPatientId, orgid),
308
-				}
309
-			} else {
310
-				maplist[list[i].HisPatientId] = models.Summary{
311
-					namemap[list[i].HisPatientId],
312
-					list[i].Deposit,
313
-					service.GetUserMoney(list[i].HisPatientId, orgid),
314
-				}
315
-				tmpslice = append(tmpslice, list[i].HisPatientId)
316
-			}
317
-			sum = sum.Add(list[i].Deposit)
318
-		}
319
-	}
320
-	//maplist虽然满足接口要求,但格式不行,整理为Finlist输出
321
-	for i := 0; i < len(tmpslice); i++ {
322
-		Finlist = append(Finlist, maplist[tmpslice[i]])
323
-	}
324
-	this.ServeSuccessJSON(map[string]interface{}{
325
-		"list": Finlist,
326
-		"sum":  sum,
327
-	})
328
-	return
329
-}
330
-
331
-//审核
332
-func (this *HisDepositApiController) UpDeposit() {
333
-	id, _ := this.GetInt64("id", 0)
334
-	if id == 0 {
335
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "id不能为空")
336
-		return
337
-	}
338
-	tmp, err := service.GetDecimalHistoryOne(id)
339
-	if err != nil {
340
-		utils.ErrorLog("无法查询该记录信息", err.Error())
341
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "无法查询该记录信息")
342
-		return
343
-	}
344
-	if tmp.TrialStatus == 0 {
345
-		err = service.UpDecimalHistory(id)
346
-		if err != nil {
347
-			utils.ErrorLog("更新押金历史表出错,原因为:", err.Error())
348
-			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "系统错误")
349
-			return
350
-		}
351
-	} else {
352
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "当前状态不可审核")
353
-		return
354
-	}
355
-	this.ServeSuccessJSON(map[string]interface{}{
356
-		"list": "审核通过",
357
-	})
358
-	return
359
-}
360
-func (this *HisDepositApiController) DeleteHistory() {
361
-	id, _ := this.GetInt64("id", 0)
362
-	if id == 0 {
363
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "id不能为空")
364
-		return
365
-	}
366
-	tmp, err := service.GetDecimalHistoryOne(id)
367
-	if err != nil {
368
-		utils.ErrorLog("无法查询该记录信息", err.Error())
369
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "无法查询该记录信息")
370
-		return
371
-	}
372
-	if tmp.TrialStatus == 0 {
373
-		err = service.DelDecimalHistory(id)
374
-		if err != nil {
375
-			utils.ErrorLog("删除历史记录出错,原因为:", err.Error())
376
-			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "系统错误")
377
-			return
378
-		}
379
-	} else {
380
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "已审核的单据不能进行删除操作")
381
-		return
382
-	}
383
-	this.ServeSuccessJSON(map[string]interface{}{
384
-		"list": "删除成功",
385
-	})
386
-	return
387
-}
388
-
389
-//根据id获取押金流水
390
-func (this *HisDepositApiController) DepositFlow() {
391
-	orgid := this.GetAdminUserInfo().CurrentOrgId
392
-	check := map[string][]string{
393
-		"id":             {"must", "int", "id"},
394
-		"deposit_status": {"must", "int", "deposit_status"},
395
-		"page":           {"must", "string", "page"},
396
-		"limit":          {"must", "string", "limit"},
397
-	}
398
-	_, err := checks(this, &check)
399
-	if err != nil {
400
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
401
-		return
402
-	}
403
-	id, _ := this.GetInt64("id") //患者id
404
-	//获取当前患者的姓名
405
-	tmp, _ := service.GetHisUserName(orgid, id)
406
-	name := tmp.Name
407
-	deposit_status, _ := this.GetInt64("deposit_status", 0) //押金类型
408
-	if deposit_status > 4 {
409
-		utils.ErrorLog("押金类型错误,deposit_status:", deposit_status)
410
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "押金类型错误")
411
-		return
412
-	}
413
-	start_time := this.GetString("start_time", "") //开始时间
414
-	end_time := this.GetString("end_time", "")     //结束时间
415
-	page, _ := this.GetInt64("page")               //页码
416
-	limit, _ := this.GetInt64("limit")             //每一页查出来的条数
417
-	timeLayout := "2006-01-02"
418
-	loc, _ := time.LoadLocation("Local")
419
-	var stime int64 //开始时间
420
-	var etime int64 //结束时间
421
-	if start_time == "" && end_time == "" {
422
-		//如果为空则查全部的
423
-		_, etime = service.GetMonth()
424
-		stime = 0
425
-	} else {
426
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
427
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
428
-		stime = stmp.Unix()
429
-		etime = etmp.Unix()
430
-	}
431
-	//获取该角色当前时间段的余额
432
-	decimal := service.GetMoneyforTime(id, orgid, etime)
433
-	//获取列表
434
-	deposirhistory, total, errs := service.GetFlowList(page, limit, id, orgid, stime, etime, deposit_status)
435
-	if errs != nil {
436
-		utils.ErrorLog("获取列表失败,原因为:", errs.Error())
437
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, errs.Error())
438
-		return
439
-	}
440
-	for i := 0; i < len(deposirhistory); i++ {
441
-		//如果为扣费,或退费 则把订单id变为就诊号
442
-		if deposirhistory[i].DepositStatus == 2 || deposirhistory[i].DepositStatus == 4 {
443
-			tmpcode, _ := strconv.ParseInt(deposirhistory[i].DepositCode, 10, 64)
444
-			deposirhistory[i].DepositCode = service.FindcodeToid(tmpcode)
445
-		}
446
-	}
447
-
448
-	this.ServeSuccessJSON(map[string]interface{}{
449
-		"list":    deposirhistory,
450
-		"name":    name,
451
-		"decimal": decimal,
452
-		"total":   total,
453
-	})
454
-	return
455
-}
456
-
457
-//获取患者押金列表
458
-func (this *HisDepositApiController) GetUserList() {
459
-	orgid := this.GetAdminUserInfo().CurrentOrgId
460
-	keyword := this.GetString("keyword")
461
-	page, _ := this.GetInt64("page")   //页码
462
-	limit, _ := this.GetInt64("limit") //每一页查出来的条数
463
-	check := map[string][]string{
464
-		"page":  {"must", "string", "page"},
465
-		"limit": {"must", "string", "limit"},
466
-	}
467
-	_, err := checks(this, &check)
468
-	if err != nil {
469
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
470
-		return
471
-	}
472
-	namemap := make(map[int64]string)
473
-	slicekey := make([]int64, 0)
474
-	lists, _ := service.GetHisUser(orgid)
475
-	for _, v := range lists {
476
-		namemap[v.ID] = v.Name
477
-	}
478
-	if len(keyword) > 0 {
479
-		for k, v := range namemap {
480
-			res := strings.Contains(v, keyword)
481
-			if res == true {
482
-				slicekey = append(slicekey, k)
483
-			}
484
-		}
485
-	}
486
-	list, total, errs := service.GetUserList(page, limit, orgid, keyword, slicekey)
487
-	if errs != nil {
488
-		utils.ErrorLog(errs.Error())
489
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
490
-		return
491
-	}
492
-	for i := 0; i < len(list); i++ {
493
-		list[i].HisPatientName = namemap[list[i].HisPatientId]
494
-	}
495
-	this.ServeSuccessJSON(map[string]interface{}{
496
-		"list":  list,
497
-		"total": total,
498
-	})
499
-	return
500
-}
501
-
502
-//扣费明细查询
503
-func (this *HisDepositApiController) DeductionDetails() {
504
-	orgid := this.GetAdminUserInfo().CurrentOrgId
505
-	timeLayout := "2006-01-02"
506
-	loc, _ := time.LoadLocation("Local")
507
-	keyword := this.GetString("keyword")
508
-	start_time := this.GetString("start_time")
509
-	end_time := this.GetString("end_time")
510
-	var stime int64 //开始时间
511
-	var etime int64 //结束时间
512
-
513
-	namemap := make(map[int64]string)
514
-	slicekey := make([]int64, 0)
515
-	lists, _ := service.GetHisUser(orgid)
516
-	for _, v := range lists {
517
-		namemap[v.ID] = v.Name
518
-	}
519
-	if len(keyword) > 0 {
520
-		for k, v := range namemap {
521
-			res := strings.Contains(v, keyword)
522
-			if res == true {
523
-				slicekey = append(slicekey, k)
524
-			}
525
-		}
526
-	}
527
-	if start_time == "" && end_time == "" {
528
-		_, etime = service.GetMondayOfWeek()
529
-		stime = 0
530
-	} else {
531
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
532
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
533
-		stime = stmp.Unix()
534
-		etime = etmp.Unix()
535
-	}
536
-	list, err := service.DeductionList(orgid, stime, etime, keyword, slicekey)
537
-	if err != nil {
538
-		utils.ErrorLog(err.Error())
539
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
540
-		return
541
-	}
542
-
543
-	var sum decimal.Decimal
544
-	var detailslist []models.Details
545
-	var details models.Details
546
-	for i := 0; i < len(list); i++ {
547
-		sum = sum.Add(list[i].Deposit)
548
-		tmp_id, _ := strconv.ParseInt(list[i].DepositCode, 10, 64)
549
-		details.ID = tmp_id
550
-		details.Code = service.FindcodeToid(tmp_id)
551
-		details.NameId = list[i].HisPatientId
552
-		details.Name = namemap[list[i].HisPatientId]
553
-		details.Number = service.FindnumberToid(tmp_id)
554
-		details.Decimal = list[i].Deposit
555
-		details.ChargeDate = fmt.Sprintf(time.Unix(list[i].Ctime, 0).Format("2006-01-02 15:04:05"))
556
-		details.Chargetype = service.CodeToChargetype(orgid, details.Code)
557
-		details.Total = service.MedicalTotal(orgid, tmp_id)
558
-		details.ButtonShow = service.IsButtonShow(list[i].DepositCode, orgid, list[i].HisPatientId)
559
-		detailslist = append(detailslist, details)
560
-	}
561
-
562
-	this.ServeSuccessJSON(map[string]interface{}{
563
-		"list": detailslist,
564
-		"sum":  sum,
565
-	})
566
-	return
567
-}
568
-
569
-//扣费汇总
570
-func (this *HisDepositApiController) DeSummary() {
571
-	orgid := this.GetAdminUserInfo().CurrentOrgId
572
-	timeLayout := "2006-01-02"
573
-	loc, _ := time.LoadLocation("Local")
574
-	keyword := this.GetString("keyword")
575
-	start_time := this.GetString("start_time")
576
-	end_time := this.GetString("end_time")
577
-	var stime int64 //开始时间
578
-	var etime int64 //结束时间
579
-
580
-	namemap := make(map[int64]string)
581
-	slicekey := make([]int64, 0)
582
-	lists, _ := service.GetHisUser(orgid)
583
-	for _, v := range lists {
584
-		namemap[v.ID] = v.Name
585
-	}
586
-	if len(keyword) > 0 {
587
-		for k, v := range namemap {
588
-			res := strings.Contains(v, keyword)
589
-			if res == true {
590
-				slicekey = append(slicekey, k)
591
-			}
592
-		}
593
-	}
594
-	if start_time == "" && end_time == "" {
595
-		_, etime = service.GetMondayOfWeek()
596
-		stime = 0
597
-	} else {
598
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
599
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
600
-		stime = stmp.Unix()
601
-		etime = etmp.Unix()
602
-	}
603
-	list, err := service.DeductionList(orgid, stime, etime, keyword, slicekey)
604
-	if err != nil {
605
-		utils.ErrorLog(err.Error())
606
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
607
-		return
608
-	}
609
-	var sum decimal.Decimal
610
-	var detailslist []models.DeductionSummary
611
-	var details models.DeductionSummary
612
-	for i := 0; i < len(list); i++ {
613
-		sum = sum.Add(list[i].Deposit)
614
-		details.Name = namemap[list[i].HisPatientId]
615
-		details.Decimal = list[i].Deposit
616
-		tmp_id, _ := strconv.ParseInt(list[i].DepositCode, 10, 64)
617
-		details.Total = service.MedicalTotal(orgid, tmp_id)
618
-		detailslist = append(detailslist, details)
619
-	}
620
-	maplist := make(map[string]models.DeductionSummary)
621
-	Finlist := []models.DeductionSummary{}
622
-	tmpslice := make([]string, 0)
623
-	for i := 0; i < len(detailslist); i++ {
624
-		if k, ok := maplist[detailslist[i].Name]; ok {
625
-			k.Total = k.Total.Add(detailslist[i].Total)
626
-			k.Decimal = k.Decimal.Add(detailslist[i].Decimal)
627
-			maplist[detailslist[i].Name] = models.DeductionSummary{
628
-				detailslist[i].Name,
629
-				k.Total,
630
-				k.Decimal,
631
-			}
632
-		} else {
633
-			maplist[detailslist[i].Name] = models.DeductionSummary{
634
-				detailslist[i].Name,
635
-				detailslist[i].Total,
636
-				detailslist[i].Decimal,
637
-			}
638
-			tmpslice = append(tmpslice, detailslist[i].Name)
639
-		}
640
-	}
641
-	for i := 0; i < len(tmpslice); i++ {
642
-		Finlist = append(Finlist, maplist[tmpslice[i]])
643
-	}
644
-	this.ServeSuccessJSON(map[string]interface{}{
645
-		"list": Finlist,
646
-		"sum":  sum,
647
-	})
648
-	return
649
-}
650
-
651
-//根据患者id查询患者的余额
652
-func (this *HisDepositApiController) IdToBalance() {
653
-	check := map[string][]string{
654
-		"his_patient_id": {"must", "int", "his_patient_id"},
655
-	}
656
-	_, err := checks(this, &check)
657
-	if err != nil {
658
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
659
-		return
660
-	}
661
-	orgid := this.GetAdminUserInfo().CurrentOrgId
662
-	his_patient_id, _ := this.GetInt64("his_patient_id")
663
-	tmp := service.GetUserMoney(his_patient_id, orgid)
664
-	this.ServeSuccessJSON(map[string]interface{}{
665
-		"list": tmp,
666
-	})
667
-	return
668
-}
669
-
670
-//新增一条退款申请
671
-func (this *HisDepositApiController) RefundApplication() {
672
-	orgid := this.GetAdminUserInfo().CurrentOrgId
673
-	createid := this.GetAdminUserInfo().AdminUser.Id
674
-	dataBody := make(map[string]interface{}, 0)
675
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
676
-	if err != nil {
677
-		utils.ErrorLog(err.Error())
678
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
679
-		return
680
-	}
681
-	switch {
682
-	case dataBody["code"] == nil:
683
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "申请编号不能为空")
684
-		return
685
-	case dataBody["his_patient_id"] == nil:
686
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "患者名称不能为空")
687
-		return
688
-	case dataBody["deposit"] == nil || dataBody["deposit"] == "":
689
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额不能为空")
690
-		return
691
-	case dataBody["trial_status"] == nil:
692
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "审核状态不能为空")
693
-		return
694
-	}
695
-	code := dataBody["code"].(string)                             //申请编号
696
-	his_patient_id := int64(dataBody["his_patient_id"].(float64)) //患者编号
697
-	//deposit := decimal.NewFromFloat(dataBody["deposit"].(float64)) //退款金额
698
-	var tmps float64
699
-	switch dataBody["deposit"].(type) {
700
-	case string:
701
-		t_deposit := dataBody["deposit"].(string)
702
-		if len(t_deposit) > 0 {
703
-			if t_deposit[0] == 45 {
704
-				this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额错误")
705
-				return
706
-			}
707
-		}
708
-		tt, errs := strconv.ParseFloat(t_deposit, 64)
709
-		if errs != nil {
710
-			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额错误")
711
-			return
712
-		} else {
713
-			tmps = tt
714
-		}
715
-	default:
716
-		tmps = dataBody["deposit"].(float64)
717
-	}
718
-	if tmps == 0 {
719
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额不能为0")
720
-		return
721
-	}
722
-	deposit := decimal.NewFromFloat(tmps)                     //押金金额
723
-	trial_status := int64(dataBody["trial_status"].(float64)) //审核状态
724
-
725
-	err = service.RefundApplication(orgid, his_patient_id, trial_status, createid, code, deposit)
726
-	if err != nil {
727
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
728
-		return
729
-	}
730
-	this.ServeSuccessJSON(map[string]interface{}{
731
-		"list": "新增成功",
732
-	})
733
-	return
734
-
735
-}
736
-
737
-//退款审核通过/拒绝
738
-func (this *HisDepositApiController) RefundReview() {
739
-	check := map[string][]string{
740
-		"ids":          {"must", "string", "ids"},
741
-		"trial_status": {"must", "int", "trial_status"},
742
-	}
743
-	_, err := checks(this, &check)
744
-	if err != nil {
745
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
746
-		return
747
-	}
748
-	orgid := this.GetAdminUserInfo().CurrentOrgId
749
-	ids := this.GetString("ids") //很多id
750
-
751
-	trial_status, _ := this.GetInt64("trial_status")
752
-	if trial_status != 1 && trial_status != 2 {
753
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数trial_status值错误")
754
-		return
755
-	}
756
-	err = service.RefundReviewMore(orgid, trial_status, ids)
757
-	if err != nil {
758
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
759
-		return
760
-	}
761
-	var tmplist string
762
-	if trial_status == 1 {
763
-		tmplist = "审核通过"
764
-	} else {
765
-		tmplist = "审核拒绝"
766
-	}
767
-	this.ServeSuccessJSON(map[string]interface{}{
768
-		"list": tmplist,
769
-	})
770
-	return
771
-}
772
-
773
-//退款删除
774
-func (this *HisDepositApiController) DeleteRefund() {
775
-	check := map[string][]string{
776
-		"id": {"must", "int", "id"},
777
-	}
778
-	_, err := checks(this, &check)
779
-	if err != nil {
780
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
781
-		return
782
-	}
783
-	orgid := this.GetAdminUserInfo().CurrentOrgId
784
-	id, _ := this.GetInt64("id")
785
-	err = service.DeleteRefund(orgid, id)
786
-	if err != nil {
787
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
788
-		return
789
-	}
790
-	this.ServeSuccessJSON(map[string]interface{}{
791
-		"list": "删除成功",
792
-	})
793
-	return
794
-}
795
-
796
-//更改退款申请
797
-func (this *HisDepositApiController) ChangeRefund() {
798
-	orgid := this.GetAdminUserInfo().CurrentOrgId
799
-	dataBody := make(map[string]interface{}, 0)
800
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
801
-	if err != nil {
802
-		utils.ErrorLog(err.Error())
803
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
804
-		return
805
-	}
806
-	switch {
807
-	case dataBody["id"] == nil:
808
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "id不能为空")
809
-		return
810
-	case dataBody["code"] == nil:
811
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "申请编号不能为空")
812
-		return
813
-	case dataBody["his_patient_id"] == nil:
814
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "患者名称不能为空")
815
-		return
816
-	case dataBody["deposit"] == nil || dataBody["deposit"] == "":
817
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额不能为空")
818
-		return
819
-	case dataBody["trial_status"] == nil:
820
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "审核状态不能为空")
821
-		return
822
-	}
823
-	id := int64(dataBody["id"].(float64))
824
-	code := dataBody["code"].(string)                             //申请编号
825
-	his_patient_id := int64(dataBody["his_patient_id"].(float64)) //患者编号
826
-	//deposit := decimal.NewFromFloat(dataBody["deposit"].(float64)) //退款金额
827
-	var tmps float64
828
-	switch dataBody["deposit"].(type) {
829
-	case string:
830
-		t_deposit := dataBody["deposit"].(string)
831
-		if len(t_deposit) > 0 {
832
-			if t_deposit[0] == 45 {
833
-				this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额错误")
834
-				return
835
-			}
836
-		}
837
-		tt, errs := strconv.ParseFloat(t_deposit, 64)
838
-		if errs != nil {
839
-			this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额错误")
840
-			return
841
-		} else {
842
-			tmps = tt
843
-		}
844
-	default:
845
-		tmps = dataBody["deposit"].(float64)
846
-	}
847
-	if tmps == 0 {
848
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "退款金额不能为0")
849
-		return
850
-	}
851
-	deposit := decimal.NewFromFloat(tmps)                     //押金金额
852
-	trial_status := int64(dataBody["trial_status"].(float64)) //审核状态
853
-	err = service.ChangeRefund(orgid, his_patient_id, trial_status, id, code, deposit)
854
-	if err != nil {
855
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
856
-		return
857
-	}
858
-	this.ServeSuccessJSON(map[string]interface{}{
859
-		"list": "保存成功",
860
-	})
861
-	return
862
-}
863
-
864
-//退款分页
865
-func (this *HisDepositApiController) RefundList() {
866
-	check := map[string][]string{
867
-		"refundtype":  {"must", "int", "refundtype"},
868
-		"examinetype": {"must", "int", "examinetype"},
869
-		"page":        {"must", "string", "page"},
870
-		"limit":       {"must", "string", "limit"},
871
-	}
872
-	_, err := checks(this, &check)
873
-	if err != nil {
874
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
875
-		return
876
-	}
877
-	orgid := this.GetAdminUserInfo().CurrentOrgId
878
-	timeLayout := "2006-01-02"
879
-	loc, _ := time.LoadLocation("Local")
880
-	keyword := this.GetString("keyword")           //获取搜索框
881
-	refundtype, _ := this.GetInt64("refundtype")   //获取退款类型
882
-	examinetype, _ := this.GetInt64("examinetype") //获取审核状态
883
-	page, _ := this.GetInt64("page")               //页码
884
-	limit, _ := this.GetInt64("limit")             //每一页查出来的条数
885
-	start_time := this.GetString("start_time")
886
-	end_time := this.GetString("end_time")
887
-	var stime int64 //开始时间
888
-	var etime int64 //结束时间
889
-
890
-	namemap := make(map[int64]string)
891
-	slicekey := make([]int64, 0)
892
-	lists, _ := service.GetHisUser(orgid)
893
-	for _, v := range lists {
894
-		namemap[v.ID] = v.Name
895
-	}
896
-	if len(keyword) > 0 {
897
-		for k, v := range namemap {
898
-			res := strings.Contains(v, keyword)
899
-			if res == true {
900
-				slicekey = append(slicekey, k)
901
-			}
902
-		}
903
-	}
904
-	if start_time == "" && end_time == "" {
905
-		stime, etime = service.GetMondayOfWeek()
906
-		stime = 0
907
-	} else {
908
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
909
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
910
-		stime = stmp.Unix()
911
-		etime = etmp.Unix()
912
-	}
913
-	depo := []models.RefundList{}
914
-	var total int64
915
-	depo, total, err = service.RefundList(page, limit, orgid, stime, etime, refundtype, examinetype, keyword, slicekey)
916
-	if err != nil {
917
-		utils.ErrorLog("查询失败,原因为:", err.Error())
918
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
919
-		return
920
-	}
921
-	for i := 0; i < len(depo); i++ {
922
-		depo[i].Name = service.GetCreateidName(depo[i].CreateId, orgid)
923
-		depo[i].HisName = namemap[depo[i].HisPatientId]
924
-		if depo[i].Mtime > depo[i].Ctime {
925
-			depo[i].Starttime = fmt.Sprintf(time.Unix(depo[i].Mtime, 0).Format("2006-01-02 15:04:05"))
926
-		} else {
927
-			depo[i].Starttime = fmt.Sprintf(time.Unix(depo[i].Ctime, 0).Format("2006-01-02 15:04:05"))
928
-		}
929
-		if depo[i].DepositStatus == 4 {
930
-			depo[i].Name = "-"
931
-			tmpcode, _ := strconv.ParseInt(depo[i].DepositCode, 10, 64)
932
-			depo[i].DepositCode = service.FindcodeToid(tmpcode)
933
-		}
934
-
935
-	}
936
-	this.ServeSuccessJSON(map[string]interface{}{
937
-		"list":  depo,
938
-		"total": total,
939
-	})
940
-	return
941
-}
942
-
943
-func (this *HisDepositApiController) GetorgName() {
944
-	orgid := this.GetAdminUserInfo().CurrentOrgId
945
-	name := service.GetorgName(orgid)
946
-	this.ServeSuccessJSON(map[string]interface{}{
947
-		"list": name,
948
-	})
949
-	return
950
-}
951
-
952
-//获取本月时间
953
-func (this *HisDepositApiController) GetMonthTime() {
954
-	stime, etime := service.GetMonth()
955
-	srart_time := fmt.Sprintf(time.Unix(stime, 0).Format("2006-01-02"))
956
-	end_time := fmt.Sprintf(time.Unix(etime, 0).Format("2006-01-02"))
957
-
958
-	this.ServeSuccessJSON(map[string]interface{}{
959
-		"srart_time": srart_time,
960
-		"end_time":   end_time,
961
-	})
962
-	return
963
-}
964
-
965
-//获取本周时间
966
-func (this *HisDepositApiController) GetWeekTime() {
967
-	stime, etime := service.GetMondayOfWeek()
968
-	srart_time := fmt.Sprintf(time.Unix(stime, 0).Format("2006-01-02"))
969
-	end_time := fmt.Sprintf(time.Unix(etime, 0).Format("2006-01-02"))
970
-
971
-	this.ServeSuccessJSON(map[string]interface{}{
972
-		"srart_time": srart_time,
973
-		"end_time":   end_time,
974
-	})
975
-	return
976
-}
977
-
978
-//判断前端参数是否为空
979
-func checks(this *HisDepositApiController, m *map[string][]string) (map[string]string, error) {
980
-	tmp := make(map[string]string)
981
-	for k, v := range *m {
982
-		t := this.GetString(k)
983
-		if v[0] == "must" && t == "" {
984
-			return nil, fmt.Errorf(v[2] + "不能为空")
985
-		}
986
-		tmp[k] = t
987
-	}
988
-	return tmp, nil
989
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1086
controllers/his_hospital_api_controller.go


+ 0 - 88
controllers/his_print_api_controller.go Просмотреть файл

@@ -1,88 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"github.com/astaxie/beego"
8
-	"strings"
9
-	"time"
10
-)
11
-
12
-type HisPrintApiController struct {
13
-	BaseAuthAPIController
14
-}
15
-
16
-func HisPrintApiRegistRouters() {
17
-	beego.Router("/api/his/prescription/print", &HisPrintApiController{}, "get:GetBatchHisPrescriptionData")
18
-}
19
-
20
-func (c *HisPrintApiController) GetBatchHisPrescriptionData() {
21
-	record_date := c.GetString("record_date")
22
-	patient_ids := c.GetString("patient_ids")
23
-	print_type, _ := c.GetInt64("type")
24
-	timeLayout := "2006-01-02"
25
-	loc, _ := time.LoadLocation("Local")
26
-	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
27
-	if err != nil {
28
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
29
-		return
30
-	}
31
-	recordDateTime := theTime.Unix()
32
-	adminInfo := c.GetAdminUserInfo()
33
-	ids := strings.Split(patient_ids, ",")
34
-	switch print_type {
35
-	case 1:
36
-		patients, _ := service.GetBatchDrugHisPrescription(ids, recordDateTime, adminInfo.CurrentOrgId)
37
-		c.ServeSuccessJSON(map[string]interface{}{
38
-			"patients": patients,
39
-		})
40
-		break
41
-	case 2:
42
-		//var newPatients []*models.PrintPatient
43
-
44
-		patients, _ := service.GetBatchProjectHisPrescription(ids, recordDateTime, adminInfo.CurrentOrgId)
45
-		//for _, item := range patients {
46
-		//	for _, subItem := range item.HisPrintPrescription {
47
-		//		for _, subItemTwo := range subItem.HisPrescriptionProject {
48
-		//			if subItemTwo.HisProject.CostClassify != 3 {
49
-		//
50
-		//			}
51
-		//		}
52
-		//	}
53
-		//}
54
-		c.ServeSuccessJSON(map[string]interface{}{
55
-			"patients": patients,
56
-		})
57
-		break
58
-	case 3:
59
-		var newPatients []*models.PrintPatient
60
-		var newPatientsTwo []*models.PrintPatient
61
-
62
-		patients, _ := service.GetBatchInspectionProjectHisPrescription(ids, recordDateTime, adminInfo.CurrentOrgId)
63
-		for _, item := range patients {
64
-			var newPatient *models.PrintPatient
65
-			newPatient = item
66
-			for index, subItem := range item.HisPrintPrescription {
67
-				if index > 0 {
68
-					item.HisPrintPrescription[0].HisPrescriptionProject = append(item.HisPrintPrescription[0].HisPrescriptionProject, subItem.HisPrescriptionProject...)
69
-				}
70
-			}
71
-			newPatients = append(newPatients, newPatient)
72
-		}
73
-
74
-		for _, item := range patients {
75
-			var newPatient *models.PrintPatient
76
-			newPatient = item
77
-			if len(item.HisPrintPrescription) > 0 {
78
-				newPatient.NewHisPrintPrescription = append(newPatient.NewHisPrintPrescription, item.HisPrintPrescription[0])
79
-				newPatientsTwo = append(newPatientsTwo, newPatient)
80
-			}
81
-		}
82
-
83
-		c.ServeSuccessJSON(map[string]interface{}{
84
-			"patients": newPatientsTwo,
85
-		})
86
-		break
87
-	}
88
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1761
controllers/his_project_api_controller.go


+ 0 - 715
controllers/his_summary_controller.go Просмотреть файл

@@ -1,715 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-	"fmt"
7
-	"github.com/astaxie/beego"
8
-	"time"
9
-)
10
-
11
-type HisSummaryApiController struct {
12
-	BaseAuthAPIController
13
-}
14
-
15
-func HisSummaryApiRegistRouters() {
16
-
17
-	beego.Router("/api/gethissummarydetaillist", &HisSummaryApiController{}, "Get:GetHisSummaryDetailList")
18
-	beego.Router("/api/his/getgatherdetailist", &HisSummaryApiController{}, "Get:GetGatherDetaiList")
19
-	beego.Router("/api/his/getdetailpatients", &HisSummaryApiController{}, "Get:GetDetailPatients")
20
-
21
-	beego.Router("/api/his/gethisorderlist", &HisSummaryApiController{}, "Get:GetHisOrderList")
22
-	beego.Router("/api/his/gethisadviceorderlist", &HisSummaryApiController{}, "Get:GetHisAdviceOrderList")
23
-}
24
-
25
-func (this *HisSummaryApiController) GetHisSummaryDetailList() {
26
-
27
-	start_time := this.GetString("start_time")
28
-	end_time := this.GetString("end_time")
29
-	keyword := this.GetString("keyword")
30
-	item_type, _ := this.GetInt64("type")
31
-	patient_id, _ := this.GetInt64("patient_id")
32
-	adminUser := this.GetAdminUserInfo()
33
-
34
-	timeLayout := "2006-01-02"
35
-	loc, _ := time.LoadLocation("Local")
36
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
37
-	if err != nil {
38
-
39
-	}
40
-	startRecordDateTime := startTime.Unix()
41
-
42
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
43
-	if err != nil {
44
-
45
-	}
46
-	endRecordDateTime := endTime.Unix()
47
-
48
-	list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
49
-	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
50
-
51
-	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
52
-
53
-	order, _ := service.GetHisLastOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
54
-
55
-	his_record_patient, _ := service.GetHisSummaryPatientInfoSix(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
56
-
57
-	//获取所有的科室
58
-	hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
59
-
60
-	//获取个人支付总额
61
-	orderList, _ := service.GetAllHisOrderList(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
62
-	if err == nil {
63
-		this.ServeSuccessJSON(map[string]interface{}{
64
-			"list":               list,
65
-			"patient":            patient,
66
-			"his_patient":        his_patient,
67
-			"hisDepatment":       hisDepatment,
68
-			"order":              order,
69
-			"his_record_patient": his_record_patient,
70
-			"orderList":          orderList,
71
-		})
72
-		return
73
-	} else {
74
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
75
-		return
76
-
77
-	}
78
-}
79
-
80
-func (this *HisSummaryApiController) GetGatherDetaiList() {
81
-
82
-	start_time := this.GetString("start_time")
83
-	end_time := this.GetString("end_time")
84
-	keyword := this.GetString("keyword")
85
-	item_type, _ := this.GetInt64("type")
86
-	patient_id, _ := this.GetInt64("patient_id")
87
-	adminUser := this.GetAdminUserInfo()
88
-
89
-	timeLayout := "2006-01-02"
90
-	loc, _ := time.LoadLocation("Local")
91
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
92
-	if err != nil {
93
-
94
-	}
95
-	startRecordDateTime := startTime.Unix()
96
-
97
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
98
-	if err != nil {
99
-
100
-	}
101
-	endRecordDateTime := endTime.Unix()
102
-
103
-	list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
104
-	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
105
-
106
-	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
107
-
108
-	order, _ := service.GetHisLastOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
109
-
110
-	his_record_patient, _ := service.GetHisSummaryPatientInfoSix(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
111
-
112
-	//获取所有的科室
113
-	hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
114
-
115
-	var medicalInsuranceLevel = "医保等级"
116
-	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
117
-	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, adminUser.CurrentOrgId)
118
-	var drugType = "药品类型"
119
-	drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
120
-	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminUser.CurrentOrgId)
121
-	var costClassify = "费用类别"
122
-	costClassifyParent, _ := service.GetDrugDataConfig(0, costClassify)
123
-	costClassifyList, _ := service.GetParentDataConfig(costClassifyParent.ID, adminUser.CurrentOrgId)
124
-	doctorlist, _ := service.GetAllDoctorSix(adminUser.CurrentOrgId, adminUser.CurrentAppId)
125
-
126
-	//获取最后一次排班
127
-	schedule, _ := service.GetHisSchedule(patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
128
-	bedNumber, _ := service.GetAllBedNumberSix(adminUser.CurrentOrgId)
129
-	orderInfo, _ := service.GetHisLastOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
130
-
131
-	//获取个人支付总额
132
-	orderList, _ := service.GetAllHisOrderList(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
133
-
134
-	if err == nil {
135
-		this.ServeSuccessJSON(map[string]interface{}{
136
-			"list":                      list,
137
-			"patient":                   patient,
138
-			"his_patient":               his_patient,
139
-			"hisDepatment":              hisDepatment,
140
-			"order":                     order,
141
-			"his_record_patient":        his_record_patient,
142
-			"medicalInsuranceLevelList": medicalInsuranceLevelList,
143
-			"drugTypeList":              drugTypeList,
144
-			"costClassifyList":          costClassifyList,
145
-			"doctorlist":                doctorlist,
146
-			"schedule":                  schedule,
147
-			"bedNumber":                 bedNumber,
148
-			"orderInfo":                 orderInfo,
149
-			"orderList":                 orderList,
150
-		})
151
-		return
152
-	} else {
153
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
154
-		return
155
-
156
-	}
157
-}
158
-
159
-//func (this *HisSummaryApiController) GetGatherDetaiList() {
160
-//
161
-//	start_time := this.GetString("start_time")
162
-//	end_time := this.GetString("end_time")
163
-//	keyword := this.GetString("keyword")
164
-//	item_type, _ := this.GetInt64("type")
165
-//	patient_id, _ := this.GetInt64("patient_id")
166
-//	adminUser := this.GetAdminUserInfo()
167
-//
168
-//	timeLayout := "2006-01-02"
169
-//	loc, _ := time.LoadLocation("Local")
170
-//	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
171
-//	if err != nil {
172
-//
173
-//	}
174
-//	startRecordDateTime := startTime.Unix()
175
-//
176
-//	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
177
-//	if err != nil {
178
-//
179
-//	}
180
-//	endRecordDateTime := endTime.Unix()
181
-//
182
-//	//查询该病人这段时间的记录单号
183
-//	orderInfo, _ := service.GetGatherHisOrder(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
184
-//
185
-//	org_id := this.GetAdminUserInfo().CurrentOrgId
186
-//	appid := this.GetAdminUserInfo().CurrentAppId
187
-//	var order_info []*service.HisOrderInfo
188
-//
189
-//	var MdtrtId string
190
-//
191
-//	patient, _ := service.GetPatientByID(org_id, patient_id)
192
-//	for _, item := range orderInfo {
193
-//		orderinfo, _ := service.GetHisOrderDetailByNumber(item.Number, org_id)
194
-//		MdtrtId = item.MdtrtId
195
-//		for _, it := range orderinfo {
196
-//
197
-//			order_info = append(order_info, it)
198
-//		}
199
-//	}
200
-//	his, _ := service.GetHisPatientInfoFive(org_id, patient_id, startRecordDateTime, endRecordDateTime)
201
-//
202
-//	record, _ := service.GetInHospitalRecordByNumber(MdtrtId)
203
-//
204
-//	//获取所有客户
205
-//	adminInfo, _ := service.GetAllDoctorSix(org_id, appid)
206
-//
207
-//	//获取最后一次排班
208
-//	schedule, _ := service.GetHisSchedule(patient_id, org_id, startRecordDateTime, endRecordDateTime)
209
-//
210
-//	bedNumber, _ := service.GetAllBedNumberSix(org_id)
211
-//	var bedCostTotal float64 = 0 //床位总费
212
-//
213
-//	var operationCostTotal float64 = 0 //手术费
214
-//
215
-//	var otherCostTotal float64 = 0 //其他费用
216
-//
217
-//	var materialCostTotal float64 = 0 //材料费
218
-//
219
-//	var westernMedicineCostTotal float64 = 0 //西药费
220
-//
221
-//	var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
222
-//
223
-//	var checkCostTotal float64 = 0 //检查费
224
-//
225
-//	var laboratoryCostTotal float64 = 0 //化验费
226
-//
227
-//	var treatCostTotal float64 = 0 //治疗费用
228
-//
229
-//	var zhenChaCostTotal float64 = 0 //其他费用
230
-//
231
-//	decimal.DivisionPrecision = 2
232
-//	var BalanceAccountsType int64
233
-//	if his.ID > 0 {
234
-//		BalanceAccountsType = his.BalanceAccountsType
235
-//	} else {
236
-//		BalanceAccountsType = record.BalanceAccountsType
237
-//	}
238
-//
239
-//	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
240
-//
241
-//	//获取所有的科室
242
-//	hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
243
-//
244
-//	//统计
245
-//	prescription, _ := service.GetHisPrescriptionTenty(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, keyword, item_type)
246
-//
247
-//	//orderlist, _ := service.GetHisChargeOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, keyword, item_type)
248
-//
249
-//	var medicalInsuranceLevel = "医保等级"
250
-//	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
251
-//	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, adminUser.CurrentOrgId)
252
-//	if BalanceAccountsType != 2 && BalanceAccountsType > 0 {
253
-//		for _, item := range order_info {
254
-//			if org_id == 10215 {
255
-//				if item.MedChrgitmType == "01" { //床位费
256
-//					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
257
-//				}
258
-//				if item.MedChrgitmType == "02" { //诊察费
259
-//					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
260
-//
261
-//				}
262
-//				if item.MedChrgitmType == "03" { //检查费
263
-//					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
264
-//
265
-//				}
266
-//
267
-//				if item.MedChrgitmType == "04" { //化验费
268
-//					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
269
-//				}
270
-//
271
-//				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
272
-//					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
273
-//
274
-//				}
275
-//
276
-//				if item.MedChrgitmType == "06" { //手术费
277
-//					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
278
-//				}
279
-//
280
-//				if item.MedChrgitmType == "08" { //材料费
281
-//					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
282
-//				}
283
-//
284
-//				if item.MedChrgitmType == "09" { //西药费
285
-//					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
286
-//				}
287
-//
288
-//				if item.MedChrgitmType == "11" { //中成费
289
-//					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
290
-//				}
291
-//
292
-//				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
293
-//					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
294
-//				}
295
-//
296
-//			} else if org_id == 10188 || org_id == 10217 {
297
-//				if item.MedChrgitmType == "01" { //床位费
298
-//					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
299
-//
300
-//				}
301
-//				if item.MedChrgitmType == "02" { //诊察费
302
-//					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
303
-//				}
304
-//				if item.MedChrgitmType == "03" { //检查费
305
-//					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
306
-//				}
307
-//
308
-//				if item.MedChrgitmType == "04" { //化验费
309
-//					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
310
-//				}
311
-//
312
-//				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
313
-//					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
314
-//				}
315
-//
316
-//				if item.MedChrgitmType == "06" { //手术费
317
-//					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
318
-//				}
319
-//
320
-//				if item.MedChrgitmType == "08" { //材料费
321
-//					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
322
-//				}
323
-//
324
-//				if item.MedChrgitmType == "09" { //西药费
325
-//					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
326
-//				}
327
-//
328
-//				if item.MedChrgitmType == "11" { //中成费
329
-//					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
330
-//				}
331
-//
332
-//				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
333
-//					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
334
-//				}
335
-//
336
-//			} else {
337
-//
338
-//				if item.MedChrgitmType == "01" { //床位费
339
-//					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
340
-//
341
-//				}
342
-//
343
-//				if item.MedChrgitmType == "03" { //检查费
344
-//					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
345
-//				}
346
-//
347
-//				if item.MedChrgitmType == "04" { //化验费
348
-//					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
349
-//
350
-//				}
351
-//
352
-//				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
353
-//					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
354
-//				}
355
-//
356
-//				if item.MedChrgitmType == "06" { //手术费
357
-//					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
358
-//				}
359
-//
360
-//				if item.MedChrgitmType == "08" { //材料费
361
-//					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
362
-//				}
363
-//
364
-//				if item.MedChrgitmType == "09" { //西药费
365
-//					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
366
-//				}
367
-//
368
-//				if item.MedChrgitmType == "11" { //中成费
369
-//					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
370
-//				}
371
-//
372
-//				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
373
-//					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
374
-//
375
-//				}
376
-//
377
-//			}
378
-//		}
379
-//		this.ServeSuccessJSON(map[string]interface{}{
380
-//			"order":                               orderInfo,
381
-//			"order_info":                          order_info,
382
-//			"patient":                             patient,
383
-//			"admin_info":                          adminInfo,
384
-//			"his_hospital":                        record,
385
-//			"bedCostTotal":                        bedCostTotal,
386
-//			"operationCostTotal":                  operationCostTotal,
387
-//			"otherCostTotal":                      otherCostTotal,
388
-//			"materialCostTotal":                   materialCostTotal,
389
-//			"westernMedicineCostTotal":            westernMedicineCostTotal,
390
-//			"chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
391
-//			"checkCostTotal":                      checkCostTotal,
392
-//			"zhenChaCostTotal":                    zhenChaCostTotal,
393
-//			"laboratoryCostTotal":                 laboratoryCostTotal,
394
-//			"treatCostTotal":                      treatCostTotal,
395
-//			"his_patient":                         his_patient,
396
-//			"hisDepatment":                        hisDepatment,
397
-//			"prescription":                        prescription,
398
-//			"schedule":                            schedule,
399
-//			"bedNumber":                           bedNumber,
400
-//		})
401
-//	} else {
402
-//		for _, item := range order_info {
403
-//
404
-//			item.FulamtOwnpayAmt = item.DetItemFeeSumamt
405
-//			if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
406
-//				item.MedChrgitmType = "09"
407
-//			}
408
-//			if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
409
-//				if item.HisPrescriptionProject.Type == 2 {
410
-//					if this.GetAdminUserInfo().CurrentOrgId == 10215 {
411
-//						switch item.HisPrescriptionProject.VMHisProject.CostClassify {
412
-//						case 0:
413
-//							item.MedChrgitmType = "0"
414
-//							break
415
-//						case 1:
416
-//							item.MedChrgitmType = "14"
417
-//							break
418
-//						case 2:
419
-//							item.MedChrgitmType = "05"
420
-//
421
-//							break
422
-//						case 3:
423
-//							item.MedChrgitmType = "03"
424
-//
425
-//							break
426
-//						case 4:
427
-//							item.MedChrgitmType = "03"
428
-//
429
-//							break
430
-//						case 5:
431
-//							item.MedChrgitmType = "08"
432
-//
433
-//							break
434
-//						case 6:
435
-//							item.MedChrgitmType = "14"
436
-//
437
-//							break
438
-//						case 7:
439
-//							item.MedChrgitmType = "14"
440
-//
441
-//							break
442
-//						case 8:
443
-//							item.MedChrgitmType = "03"
444
-//							break
445
-//						case 9:
446
-//							item.MedChrgitmType = "14"
447
-//							break
448
-//						case 10:
449
-//							item.MedChrgitmType = "14"
450
-//							break
451
-//						case 11:
452
-//							item.MedChrgitmType = "06"
453
-//							break
454
-//						case 12:
455
-//							item.MedChrgitmType = "12"
456
-//							break
457
-//						case 13:
458
-//							item.MedChrgitmType = "01"
459
-//							break
460
-//						case 14:
461
-//							item.MedChrgitmType = "04"
462
-//							break
463
-//						case 15:
464
-//							item.MedChrgitmType = "14"
465
-//							break
466
-//
467
-//						}
468
-//
469
-//					} else {
470
-//						switch item.HisPrescriptionProject.VMHisProject.CostClassify {
471
-//
472
-//						case 1:
473
-//							item.MedChrgitmType = "14"
474
-//							break
475
-//						case 2:
476
-//							item.MedChrgitmType = "05"
477
-//
478
-//							break
479
-//						case 3:
480
-//							item.MedChrgitmType = "04"
481
-//
482
-//							break
483
-//						case 4:
484
-//							item.MedChrgitmType = "14"
485
-//
486
-//							break
487
-//						case 5:
488
-//							item.MedChrgitmType = "08"
489
-//
490
-//							break
491
-//						case 6:
492
-//							item.MedChrgitmType = "14"
493
-//
494
-//							break
495
-//						case 7:
496
-//							item.MedChrgitmType = "14"
497
-//
498
-//							break
499
-//						case 8:
500
-//							item.MedChrgitmType = "03"
501
-//							break
502
-//						case 9:
503
-//							item.MedChrgitmType = "14"
504
-//							break
505
-//						}
506
-//					}
507
-//				} else if item.HisPrescriptionProject.Type == 3 {
508
-//					item.MedChrgitmType = "08"
509
-//				}
510
-//			}
511
-//		}
512
-//
513
-//		for _, item := range order_info {
514
-//			if org_id == 10215 {
515
-//				if item.MedChrgitmType == "01" { //床位费
516
-//					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
517
-//				}
518
-//				if item.MedChrgitmType == "02" { //诊察费
519
-//					zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
520
-//				}
521
-//
522
-//				if item.MedChrgitmType == "03" { //检查费
523
-//					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
524
-//				}
525
-//
526
-//				if item.MedChrgitmType == "04" { //化验费
527
-//					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
528
-//				}
529
-//
530
-//				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
531
-//					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
532
-//				}
533
-//
534
-//				if item.MedChrgitmType == "06" { //手术费
535
-//					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
536
-//				}
537
-//
538
-//				if item.MedChrgitmType == "08" { //材料费
539
-//					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
540
-//				}
541
-//
542
-//				if item.MedChrgitmType == "09" { //西药费
543
-//					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
544
-//				}
545
-//
546
-//				if item.MedChrgitmType == "11" { //中成费
547
-//					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
548
-//				}
549
-//
550
-//				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
551
-//					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
552
-//				}
553
-//
554
-//			} else {
555
-//
556
-//				if item.MedChrgitmType == "01" { //床位费
557
-//					bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
558
-//				}
559
-//
560
-//				if item.MedChrgitmType == "03" { //检查费
561
-//					checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
562
-//				}
563
-//
564
-//				if item.MedChrgitmType == "04" { //化验费
565
-//					laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
566
-//				}
567
-//
568
-//				if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
569
-//					treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
570
-//				}
571
-//
572
-//				if item.MedChrgitmType == "06" { //手术费
573
-//					operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
574
-//				}
575
-//
576
-//				if item.MedChrgitmType == "08" { //材料费
577
-//					materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
578
-//				}
579
-//
580
-//				if item.MedChrgitmType == "09" { //西药费
581
-//					westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
582
-//				}
583
-//
584
-//				if item.MedChrgitmType == "11" { //中成费
585
-//					chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
586
-//				}
587
-//
588
-//				if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
589
-//					otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
590
-//				}
591
-//
592
-//			}
593
-//
594
-//		}
595
-//
596
-//		this.ServeSuccessJSON(map[string]interface{}{
597
-//			"order":                               orderInfo,
598
-//			"order_info":                          order_info,
599
-//			"patient":                             patient,
600
-//			"admin_info":                          adminInfo,
601
-//			"his_hospital":                        record,
602
-//			"bedCostTotal":                        bedCostTotal,
603
-//			"operationCostTotal":                  operationCostTotal,
604
-//			"otherCostTotal":                      otherCostTotal,
605
-//			"materialCostTotal":                   materialCostTotal,
606
-//			"westernMedicineCostTotal":            westernMedicineCostTotal,
607
-//			"chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
608
-//			"checkCostTotal":                      checkCostTotal,
609
-//			"zhenChaCostTotal":                    zhenChaCostTotal,
610
-//			"laboratoryCostTotal":                 laboratoryCostTotal,
611
-//			"treatCostTotal":                      treatCostTotal,
612
-//			"his_patient":                         his_patient,
613
-//			"hisDepatment":                        hisDepatment,
614
-//			"prescription":                        prescription,
615
-//			"balanceAccountsType":                 BalanceAccountsType,
616
-//			"medicalInsuranceLevelList":           medicalInsuranceLevelList,
617
-//			"schedule":                            schedule,
618
-//			"bedNumber":                           bedNumber,
619
-//		})
620
-//
621
-//	}
622
-//}
623
-
624
-func (this *HisSummaryApiController) GetDetailPatients() {
625
-
626
-	keyword := this.GetString("keyword")
627
-	orgId := this.GetAdminUserInfo().CurrentOrgId
628
-	patients, err := service.GetDetailPatients(keyword, orgId)
629
-	if err == nil {
630
-		this.ServeSuccessJSON(map[string]interface{}{
631
-			"patient": patients,
632
-		})
633
-		return
634
-	} else {
635
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
636
-		return
637
-
638
-	}
639
-}
640
-
641
-func (this *HisSummaryApiController) GetHisOrderList() {
642
-
643
-	patient_id, _ := this.GetInt64("patient_id")
644
-	start_time := this.GetString("start_time")
645
-	end_time := this.GetString("end_time")
646
-	timeLayout := "2006-01-02"
647
-	loc, _ := time.LoadLocation("Local")
648
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
649
-	if err != nil {
650
-
651
-	}
652
-	startRecordDateTime := startTime.Unix()
653
-
654
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
655
-	if err != nil {
656
-
657
-	}
658
-	endRecordDateTime := endTime.Unix()
659
-	orgId := this.GetAdminUserInfo().CurrentOrgId
660
-	groupList, _ := service.GetOrderInfoList(patient_id, startRecordDateTime, endRecordDateTime, orgId)
661
-	fmt.Println("groupList32332323232232332322323", groupList)
662
-	//list, err := service.GetHisOrderListTwenty(patient_id, startRecordDateTime, endRecordDateTime, orgId)
663
-	if err == nil {
664
-		this.ServeSuccessJSON(map[string]interface{}{
665
-			"groupList": groupList,
666
-			//   "list": list,
667
-
668
-		})
669
-		return
670
-	} else {
671
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
672
-		return
673
-
674
-	}
675
-}
676
-
677
-func (this *HisSummaryApiController) GetHisAdviceOrderList() {
678
-
679
-	patient_id, _ := this.GetInt64("patient_id")
680
-	start_time := this.GetString("start_time")
681
-	end_time := this.GetString("end_time")
682
-	timeLayout := "2006-01-02"
683
-	loc, _ := time.LoadLocation("Local")
684
-	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
685
-	if err != nil {
686
-
687
-	}
688
-	startRecordDateTime := startTime.Unix()
689
-
690
-	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
691
-	if err != nil {
692
-
693
-	}
694
-	endRecordDateTime := endTime.Unix()
695
-	orgId := this.GetAdminUserInfo().CurrentOrgId
696
-
697
-	list, err := service.GetOrderInfoList(patient_id, startRecordDateTime, endRecordDateTime, orgId)
698
-
699
-	//drugList, err := service.GetAllDrugLibList(orgId)
700
-	//
701
-	//goodList, err := service.GetAllGoodList(orgId)
702
-
703
-	if err == nil {
704
-		this.ServeSuccessJSON(map[string]interface{}{
705
-			"list": list,
706
-			//"drugList":drugList,
707
-			//"goodList":goodList,
708
-		})
709
-		return
710
-	} else {
711
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
712
-		return
713
-
714
-	}
715
-}

+ 0 - 812
controllers/inspection_api_controller.go Просмотреть файл

@@ -1,812 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"encoding/json"
9
-	"fmt"
10
-	"github.com/astaxie/beego"
11
-	"strconv"
12
-	"strings"
13
-	"time"
14
-)
15
-
16
-type InspectionApiController struct {
17
-	BaseAuthAPIController
18
-}
19
-
20
-func InspectionApiRegistRouters() {
21
-	beego.Router("/api/patient/inspection/list", &InspectionApiController{}, "Get:GetPatientInspections")
22
-	beego.Router("/api/patient/inspection/reference", &InspectionApiController{}, "Get:PatientInspectionReference")
23
-	beego.Router("/api/patient/inspection/create", &InspectionApiController{}, "Post:CreatePatientInspection")
24
-	beego.Router("/api/patient/inspection/edit", &InspectionApiController{}, "Put:EditPatientInspection")
25
-	beego.Router("/api/patient/inspection/delete", &InspectionApiController{}, "Delete:DeletePatientInspection")
26
-
27
-	beego.Router("/api/patient/inspection/get", &InspectionApiController{}, "Get:GetAllPatientInspection")
28
-	beego.Router("/api/patient/inspectioninit/get", &InspectionApiController{}, "Get:GetInitInsepction")
29
-
30
-	beego.Router("/api/patient/pic_inspection/create", &InspectionApiController{}, "Post:CreatePatientPicInspection")
31
-	beego.Router("/api/patient/pic_inspection/edit", &InspectionApiController{}, "Post:EditPatientPicInspection")
32
-
33
-}
34
-
35
-// PatientInspectionReference 请求检验检查大小项目
36
-// [get]: /api/patient/inspection/reference
37
-func (c *InspectionApiController) PatientInspectionReference() {
38
-	patient, _ := c.GetInt64("patient")
39
-	inspect_type, _ := c.GetInt64("type")
40
-
41
-	if patient <= 0 {
42
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
43
-		return
44
-	}
45
-
46
-	adminUserInfo := c.GetAdminUserInfo()
47
-
48
-	references, err := service.GetInspectionReference(adminUserInfo.CurrentOrgId, inspect_type)
49
-	if err != nil {
50
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
51
-		return
52
-	}
53
-
54
-	patient_info, _ := service.GetPatientByID(adminUserInfo.CurrentOrgId, patient)
55
-
56
-	counts, err := service.GetPatientInspectionProjectCount(adminUserInfo.CurrentOrgId, patient)
57
-	if err != nil {
58
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
59
-		return
60
-	}
61
-	countsMap := make(map[int64]int64, 0)
62
-	for _, count := range counts {
63
-		countsMap[count.ProjectId] = count.Count
64
-	}
65
-
66
-	referenceMap := make(map[string]*models.InspectionReferenceMap, 0)
67
-
68
-	for _, reference := range references {
69
-		if _, exist := referenceMap[reference.Project]; !exist {
70
-			referenceMap[reference.Project] = new(models.InspectionReferenceMap)
71
-			referenceMap[reference.Project].Project = reference.Project
72
-			referenceMap[reference.Project].ProjectId = reference.ProjectId
73
-			referenceMap[reference.Project].ProjectName = reference.ProjectName
74
-			if _, cexit := countsMap[reference.ProjectId]; cexit {
75
-				referenceMap[reference.Project].Count = countsMap[reference.ProjectId]
76
-			}
77
-			referenceMap[reference.Project].InspectionReference = make([]models.InspectionReference, 0)
78
-		}
79
-		referenceMap[reference.Project].InspectionReference = append(referenceMap[reference.Project].InspectionReference, *reference)
80
-
81
-	}
82
-
83
-	reference := make([]*models.InspectionReferenceMap, 0)
84
-	for _, item := range referenceMap {
85
-		reference = append(reference, item)
86
-	}
87
-
88
-	rl := len(reference)
89
-	for index := 0; index < rl-1; index++ {
90
-		for jndex := 0; jndex < rl-1-index; jndex++ {
91
-			if reference[jndex].ProjectId > reference[jndex+1].ProjectId {
92
-				var item models.InspectionReferenceMap
93
-				item = *reference[jndex]
94
-				reference[jndex] = reference[jndex+1]
95
-				reference[jndex+1] = &item
96
-			}
97
-		}
98
-	}
99
-
100
-	list, err := service.GetInspectionReferenceByOrgId(0)
101
-	c.ServeSuccessJSON(map[string]interface{}{
102
-		"reference":    reference,
103
-		"patient_info": patient_info,
104
-		"list":         list,
105
-	})
106
-	return
107
-
108
-}
109
-
110
-func (c *InspectionApiController) CreatePatientInspection() {
111
-	patient, _ := c.GetInt64("patient", 0)
112
-	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
113
-
114
-	if patient <= 0 {
115
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
116
-		return
117
-	}
118
-
119
-	adminUserInfo := c.GetAdminUserInfo()
120
-	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
121
-	if patientInfo.ID == 0 {
122
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
123
-		return
124
-	}
125
-
126
-	var from models.InepectionForm
127
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
128
-	if err != nil {
129
-		utils.ErrorLog("%v", err)
130
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
131
-		return
132
-	}
133
-
134
-	timeLayout := "2006-01-02 15:04"
135
-	loc, _ := time.LoadLocation("Local")
136
-
137
-	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
138
-	if err != nil {
139
-		utils.ErrorLog(err.Error())
140
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
141
-		return
142
-	}
143
-
144
-	if len(from.FormItem) == 0 {
145
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未填写项目")
146
-		return
147
-	}
148
-
149
-	date := theTime.Unix()
150
-	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, from.ProjectId)
151
-	if err != nil {
152
-		utils.ErrorLog("%v", err)
153
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
154
-		return
155
-	}
156
-	if len(insp) > 0 {
157
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDateExit)
158
-		return
159
-	}
160
-
161
-	inspections := make([]models.Inspection, 0)
162
-	for _, item := range from.FormItem {
163
-		var inspection models.Inspection
164
-		inspection.OrgId = adminUserInfo.CurrentOrgId
165
-		inspection.PatientId = patient
166
-		inspection.ProjectId = from.ProjectId
167
-		inspection.ItemId = item.ItemId
168
-		inspection.ItemName = item.ItemName
169
-		inspection.ProjectName = item.ProjectName
170
-		inspection.InspectType = item.RangeType
171
-		inspection.InspectValue = item.Value
172
-		inspection.InspectDate = date
173
-		inspection.Status = 1
174
-		inspection.CreatedTime = time.Now().Unix()
175
-		inspection.UpdatedTime = time.Now().Unix()
176
-		inspections = append(inspections, inspection)
177
-	}
178
-
179
-	err = service.CreatePatientInspection(inspections)
180
-	if err != nil {
181
-		utils.ErrorLog("%v", err)
182
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
183
-		return
184
-	}
185
-
186
-	if remind_cycle > 0 {
187
-		infectiousRecord, _ := service.FindLastRecordDate(adminUserInfo.CurrentOrgId, patient, 14)
188
-		fmt.Println(infectiousRecord.InspectDate)
189
-		var record_time int64
190
-		switch remind_cycle {
191
-		case 1: //1个月
192
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
193
-			record_time = ts.AddDate(0, 1, 0).Unix()
194
-			fmt.Println(record_time)
195
-			break
196
-		case 2: //2个月
197
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
198
-			record_time = ts.AddDate(0, 2, 0).Unix()
199
-			fmt.Println(record_time)
200
-
201
-			break
202
-		case 3: //3个月
203
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
204
-			record_time = ts.AddDate(0, 3, 0).Unix()
205
-			fmt.Println(record_time)
206
-
207
-			break
208
-		case 4: //6个月
209
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
210
-			record_time = ts.AddDate(0, 6, 0).Unix()
211
-			fmt.Println(record_time)
212
-
213
-			break
214
-		case 5: //12个月
215
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
216
-			record_time = ts.AddDate(0, 12, 0).Unix()
217
-			fmt.Println(record_time)
218
-
219
-			break
220
-		}
221
-
222
-		errs := service.UpDateInfectiousRecordTime(adminUserInfo.CurrentOrgId, patient, record_time, remind_cycle)
223
-		if errs != nil {
224
-			utils.ErrorLog("更新日期出错:%v", errs)
225
-		}
226
-	}
227
-
228
-	c.ServeSuccessJSON(map[string]interface{}{
229
-		"inspections":  inspections,
230
-		"remind_cycle": remind_cycle,
231
-	})
232
-	return
233
-}
234
-func (c *InspectionApiController) CreatePatientPicInspection() {
235
-	patient, _ := c.GetInt64("patient", 0)
236
-	if patient <= 0 {
237
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
238
-		return
239
-	}
240
-
241
-	adminUserInfo := c.GetAdminUserInfo()
242
-	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
243
-	if patientInfo.ID == 0 {
244
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
245
-		return
246
-	}
247
-
248
-	var from models.InepectionPICForm
249
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
250
-	if err != nil {
251
-		utils.ErrorLog("%v", err)
252
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
253
-		return
254
-	}
255
-
256
-	timeLayout := "2006-01-02 15:04"
257
-	loc, _ := time.LoadLocation("Local")
258
-
259
-	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
260
-	if err != nil {
261
-		utils.ErrorLog(err.Error())
262
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
263
-		return
264
-	}
265
-	if len(from.Imags) == 0 {
266
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未上传图片")
267
-		return
268
-	}
269
-
270
-	date := theTime.Unix()
271
-	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, from.ProjectId)
272
-	if err != nil {
273
-		utils.ErrorLog("%v", err)
274
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
275
-		return
276
-	}
277
-	if len(insp) > 0 {
278
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDateExit)
279
-		return
280
-	}
281
-
282
-	inspection_re, _ := service.GetInspectionReferenceTwo(from.ProjectId)
283
-
284
-	inspections := make([]models.Inspection, 0)
285
-	for index, item := range from.Imags {
286
-		var inspection models.Inspection
287
-		inspection.OrgId = adminUserInfo.CurrentOrgId
288
-		inspection.PatientId = patient
289
-		inspection.ProjectId = from.ProjectId
290
-		inspection.ItemId = inspection_re[index].ID
291
-		inspection.ItemName = item.Desc
292
-		inspection.ProjectName = ""
293
-		inspection.InspectType = 3
294
-		inspection.InspectValue = item.ImgUrl
295
-		inspection.InspectDesc = item.Desc
296
-		inspection.InspectDate = date
297
-		inspection.Status = 1
298
-		inspection.CreatedTime = time.Now().Unix()
299
-		inspection.UpdatedTime = time.Now().Unix()
300
-		inspections = append(inspections, inspection)
301
-	}
302
-	err = service.CreatePatientInspection(inspections)
303
-	if err != nil {
304
-		utils.ErrorLog("%v", err)
305
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
306
-		return
307
-	}
308
-	c.ServeSuccessJSON(map[string]interface{}{
309
-		"inspections": inspections,
310
-	})
311
-	return
312
-}
313
-func (c *InspectionApiController) EditPatientPicInspection() {
314
-	patient, _ := c.GetInt64("patient", 0)
315
-	if patient <= 0 {
316
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
317
-		return
318
-	}
319
-
320
-	adminUserInfo := c.GetAdminUserInfo()
321
-	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
322
-	if patientInfo.ID == 0 {
323
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
324
-		return
325
-	}
326
-
327
-	var from models.InepectionPICForm
328
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
329
-	if err != nil {
330
-		utils.ErrorLog("%v", err)
331
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
332
-		return
333
-	}
334
-
335
-	timeLayout := "2006-01-02 15:04"
336
-	loc, _ := time.LoadLocation("Local")
337
-
338
-	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
339
-	if err != nil {
340
-		utils.ErrorLog(err.Error())
341
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
342
-		return
343
-	}
344
-	if len(from.Imags) == 0 {
345
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未上传图片")
346
-		return
347
-	}
348
-
349
-	date := theTime.Unix()
350
-	inspection_re, _ := service.GetInspectionReferenceTwo(from.ProjectId)
351
-	inspections := make([]models.Inspection, 0)
352
-	for index, item := range from.Imags {
353
-		if item.ID == 0 {
354
-			var inspection models.Inspection
355
-			inspection.OrgId = adminUserInfo.CurrentOrgId
356
-			inspection.PatientId = patient
357
-			inspection.ProjectId = from.ProjectId
358
-			inspection.ItemId = inspection_re[index].ID
359
-			inspection.ItemName = item.Desc
360
-			inspection.ProjectName = ""
361
-			inspection.InspectType = 3
362
-			inspection.InspectValue = item.ImgUrl
363
-			inspection.InspectDesc = item.Desc
364
-			inspection.InspectDate = date
365
-			inspection.Status = 1
366
-			inspection.CreatedTime = time.Now().Unix()
367
-			inspection.UpdatedTime = time.Now().Unix()
368
-			inspections = append(inspections, inspection)
369
-
370
-		} else {
371
-			var inspection models.Inspection
372
-			inspection.ID = item.ID
373
-			inspection.OrgId = adminUserInfo.CurrentOrgId
374
-			inspection.PatientId = patient
375
-			inspection.ProjectId = from.ProjectId
376
-			inspection.ItemId = inspection_re[index].ID
377
-			inspection.ItemName = item.Desc
378
-			inspection.ProjectName = ""
379
-			inspection.InspectType = 3
380
-			inspection.InspectValue = item.ImgUrl
381
-			inspection.InspectDesc = item.Desc
382
-			inspection.InspectDate = date
383
-			inspection.Status = 1
384
-			inspection.CreatedTime = time.Now().Unix()
385
-			inspection.UpdatedTime = time.Now().Unix()
386
-			err = service.SavePatientInspection(inspection)
387
-		}
388
-
389
-	}
390
-
391
-	for _, item := range from.DeleteImg {
392
-		service.DeleteInspectionTwo(item.ID)
393
-	}
394
-	if len(inspections) > 0 {
395
-		err = service.CreatePatientInspection(inspections)
396
-	}
397
-	if err != nil {
398
-		utils.ErrorLog("%v", err)
399
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionAddFail)
400
-		return
401
-	}
402
-	c.ServeSuccessJSON(map[string]interface{}{
403
-		"inspections": inspections,
404
-	})
405
-	return
406
-}
407
-
408
-func (c *InspectionApiController) EditPatientInspection() {
409
-	patient, _ := c.GetInt64("patient", 0)
410
-	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
411
-	// dates := c.GetString("dates")
412
-	// projectid := c.GetString("projectid")
413
-
414
-	if patient <= 0 {
415
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
416
-		return
417
-	}
418
-
419
-	adminUserInfo := c.GetAdminUserInfo()
420
-	patientInfo, _ := service.FindPatientById(adminUserInfo.CurrentOrgId, patient)
421
-	if patientInfo.ID == 0 {
422
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
423
-		return
424
-	}
425
-
426
-	var from models.InepectionForm
427
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &from)
428
-	if err != nil {
429
-		utils.ErrorLog("%v", err)
430
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
431
-		return
432
-	}
433
-
434
-	timeLayout := "2006-01-02 15:04"
435
-	loc, _ := time.LoadLocation("Local")
436
-
437
-	theTime, err := time.ParseInLocation(timeLayout, from.InspectDate, loc)
438
-	if err != nil {
439
-		utils.ErrorLog(err.Error())
440
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
441
-		return
442
-	}
443
-
444
-	oldTime, olderr := time.ParseInLocation(timeLayout, from.OldInspectDate, loc)
445
-	if olderr != nil {
446
-		utils.ErrorLog(olderr.Error())
447
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
448
-		return
449
-	}
450
-
451
-	if len(from.FormItem) == 0 {
452
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "未填写项目")
453
-		return
454
-	}
455
-
456
-	date := theTime.Unix()
457
-	oldDate := oldTime.Unix()
458
-	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, oldDate, from.ProjectId)
459
-	if err != nil {
460
-		utils.ErrorLog("%v", err)
461
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
462
-		return
463
-	}
464
-	if len(insp) == 0 {
465
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDateNotExit)
466
-		return
467
-	}
468
-	inspMap := make(map[int64]*models.Inspection)
469
-	for _, item := range insp {
470
-		inspMap[item.ID] = item
471
-	}
472
-
473
-	addinsp := make([]models.Inspection, 0)
474
-	editinsp := make([]models.Inspection, 0)
475
-	noMap := make([]int64, 0)
476
-	fmt.Println(from.FormItem)
477
-
478
-	for _, item := range from.FormItem {
479
-		fmt.Println(item.ID)
480
-		if item.ID == 0 {
481
-			var inspection models.Inspection
482
-			inspection.OrgId = adminUserInfo.CurrentOrgId
483
-			inspection.PatientId = patient
484
-			inspection.ProjectId = from.ProjectId
485
-			inspection.ItemId = item.ItemId
486
-			inspection.ItemName = item.ItemName
487
-			inspection.ProjectName = item.ProjectName
488
-			inspection.InspectType = item.RangeType
489
-			inspection.InspectValue = item.Value
490
-			inspection.InspectDate = date
491
-			inspection.Status = 1
492
-			inspection.CreatedTime = time.Now().Unix()
493
-			inspection.UpdatedTime = time.Now().Unix()
494
-			addinsp = append(addinsp, inspection)
495
-		} else {
496
-			inspection := *inspMap[item.ID]
497
-			inspection.InspectValue = item.Value
498
-			inspection.InspectDate = date
499
-			inspection.UpdatedTime = time.Now().Unix()
500
-			editinsp = append(editinsp, inspection)
501
-			noMap = append(noMap, item.ID)
502
-		}
503
-
504
-	}
505
-
506
-	err = service.EditPatientInspection(addinsp, editinsp, noMap, patient, adminUserInfo.CurrentOrgId, from.ProjectId, date)
507
-	if err != nil {
508
-		utils.ErrorLog("%v", err)
509
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionEditFail)
510
-		return
511
-	}
512
-
513
-	inspections := make([]models.Inspection, 0)
514
-	inspections = append(inspections, editinsp...)
515
-	inspections = append(inspections, addinsp...)
516
-
517
-	if remind_cycle > 0 {
518
-		infectiousRecord, _ := service.FindLastRecordDate(adminUserInfo.CurrentOrgId, patient, 14)
519
-		fmt.Println(infectiousRecord.InspectDate)
520
-		var record_time int64
521
-		switch remind_cycle {
522
-		case 1: //1个月
523
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
524
-			record_time = ts.AddDate(0, 1, 0).Unix()
525
-
526
-			break
527
-		case 2: //2个月
528
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
529
-			record_time = ts.AddDate(0, 2, 0).Unix()
530
-			break
531
-		case 3: //3个月
532
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
533
-			record_time = ts.AddDate(0, 3, 0).Unix()
534
-			break
535
-		case 4: //6个月
536
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
537
-			record_time = ts.AddDate(0, 6, 0).Unix()
538
-			break
539
-		case 5: //12个月
540
-			ts := time.Unix(infectiousRecord.InspectDate, 0)
541
-			record_time = ts.AddDate(0, 12, 0).Unix()
542
-			break
543
-		}
544
-		fmt.Println(record_time)
545
-		errs := service.UpDateInfectiousRecordTime(adminUserInfo.CurrentOrgId, patient, record_time, remind_cycle)
546
-		if errs != nil {
547
-			utils.ErrorLog("更新日期出错:%v", errs)
548
-		}
549
-	}
550
-
551
-	c.ServeSuccessJSON(map[string]interface{}{
552
-		"inspections":  inspections,
553
-		"remind_cycle": remind_cycle,
554
-	})
555
-	return
556
-}
557
-
558
-func (c *InspectionApiController) DeletePatientInspection() {
559
-	patient, _ := c.GetInt64("patient", 0)
560
-	ProjectId, _ := c.GetInt64("project_id", 0)
561
-	InspectDate := c.GetString("date")
562
-	if patient <= 0 || ProjectId <= 0 || len(InspectDate) < 10 {
563
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
564
-		return
565
-	}
566
-
567
-	timeLayout := "2006-01-02 15:04"
568
-	loc, _ := time.LoadLocation("Local")
569
-
570
-	theTime, err := time.ParseInLocation(timeLayout, InspectDate, loc)
571
-	if err != nil {
572
-		utils.ErrorLog(err.Error())
573
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "检验日期不正确")
574
-		return
575
-	}
576
-
577
-	adminUserInfo := c.GetAdminUserInfo()
578
-
579
-	date := theTime.Unix()
580
-	insp, err := service.GetPatientInspectionByDate(adminUserInfo.CurrentOrgId, patient, date, ProjectId)
581
-	if err != nil {
582
-		utils.ErrorLog("%v", err)
583
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
584
-		return
585
-	}
586
-	if len(insp) == 0 {
587
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDateNotExit)
588
-		return
589
-	}
590
-
591
-	err = service.DeletePatientInspection(adminUserInfo.CurrentOrgId, patient, ProjectId, date)
592
-	if err != nil {
593
-		utils.ErrorLog("%v", err)
594
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeInspectionDeleteFail)
595
-		return
596
-	}
597
-
598
-	c.ServeSuccessJSON(map[string]interface{}{
599
-		"msg": "ok",
600
-	})
601
-	return
602
-}
603
-
604
-func (c *InspectionApiController) GetPatientInspections() {
605
-	patient, _ := c.GetInt64("patient", 0)
606
-	projectId, _ := c.GetInt64("project_id", 0)
607
-	if patient <= 0 || projectId <= 0 {
608
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
609
-		return
610
-	}
611
-	page, _ := c.GetInt64("page", 0)
612
-	if page <= 0 {
613
-		page = 1
614
-	}
615
-
616
-	adminUserInfo := c.GetAdminUserInfo()
617
-	inspections, total, dateTime, err := service.GetPatientInspections(adminUserInfo.CurrentOrgId, patient, projectId, page)
618
-	if err != nil {
619
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
620
-		return
621
-	}
622
-
623
-	date := ""
624
-	if len(inspections) > 0 {
625
-		date = time.Unix(dateTime, 0).Format("2006-01-02 15:04")
626
-	}
627
-
628
-	c.ServeSuccessJSON(map[string]interface{}{
629
-		"inspections": inspections,
630
-		"total":       total,
631
-		"date":        date,
632
-	})
633
-	return
634
-
635
-}
636
-
637
-func (c *InspectionApiController) GetAllPatientInspection() {
638
-	patient, _ := c.GetInt64("patient", 0)
639
-	projectStr := c.GetString("project")
640
-	start_time, _ := c.GetInt64("start_time")
641
-	end_time, _ := c.GetInt64("end_time")
642
-	upload_type, _ := c.GetInt64("type")
643
-
644
-	ids := strings.Split(projectStr, "-")
645
-
646
-	if patient <= 0 {
647
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
648
-		return
649
-	}
650
-	page, _ := c.GetInt64("page", 0)
651
-	if page <= 0 {
652
-		page = 1
653
-	}
654
-
655
-	adminUserInfo := c.GetAdminUserInfo()
656
-
657
-	switch upload_type {
658
-	case 1:
659
-		var inspections []*models.Inspection
660
-
661
-		for _, item := range ids {
662
-			id, _ := strconv.ParseInt(item, 10, 64)
663
-			inspection, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id, start_time, end_time)
664
-			//fmt.Println(err)
665
-			//if err != nil {
666
-			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
667
-			//	return
668
-			//}
669
-			for _, inspection_item := range inspection {
670
-				inspections = append(inspections, inspection_item)
671
-			}
672
-		}
673
-
674
-		c.ServeSuccessJSON(map[string]interface{}{
675
-			"inspections": inspections,
676
-			"type":        upload_type,
677
-		})
678
-		break
679
-
680
-	case 2:
681
-		id_one, _ := strconv.ParseInt(ids[0], 10, 64)
682
-		id_two, _ := strconv.ParseInt(ids[1], 10, 64)
683
-		id_three, _ := strconv.ParseInt(ids[2], 10, 64)
684
-		inspection_one, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_one, start_time, end_time)
685
-		inspection_two, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_two, start_time, end_time)
686
-		inspection_three, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_three, start_time, end_time)
687
-
688
-		c.ServeSuccessJSON(map[string]interface{}{
689
-			"inspections_one":   inspection_one,
690
-			"inspections_two":   inspection_two,
691
-			"inspections_three": inspection_three,
692
-			"type":              upload_type,
693
-		})
694
-
695
-		break
696
-	case 3:
697
-		var inspections []*models.Inspection
698
-
699
-		for _, item := range ids {
700
-			id, _ := strconv.ParseInt(item, 10, 64)
701
-			inspection, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id, start_time, end_time)
702
-			//fmt.Println(err)
703
-			//if err != nil {
704
-			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
705
-			//	return
706
-			//}
707
-			for _, inspection_item := range inspection {
708
-				inspections = append(inspections, inspection_item)
709
-			}
710
-		}
711
-
712
-		c.ServeSuccessJSON(map[string]interface{}{
713
-			"inspections": inspections,
714
-			"type":        upload_type,
715
-		})
716
-
717
-		break
718
-	case 4:
719
-		id_one, _ := strconv.ParseInt(ids[0], 10, 64)
720
-		id_two, _ := strconv.ParseInt(ids[1], 10, 64)
721
-		id_three, _ := strconv.ParseInt(ids[2], 10, 64)
722
-		id_four, _ := strconv.ParseInt(ids[3], 10, 64)
723
-		id_five, _ := strconv.ParseInt(ids[4], 10, 64)
724
-
725
-		inspection_one, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_one, start_time, end_time)
726
-		inspection_two, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_two, start_time, end_time)
727
-		inspection_three, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_three, start_time, end_time)
728
-		inspection_four, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_four, start_time, end_time)
729
-		inspection_five, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_five, start_time, end_time)
730
-
731
-		c.ServeSuccessJSON(map[string]interface{}{
732
-			"inspections_one":   inspection_one,
733
-			"inspections_two":   inspection_two,
734
-			"inspections_three": inspection_three,
735
-			"inspections_four":  inspection_four,
736
-			"inspections_five":  inspection_five,
737
-			"type":              upload_type,
738
-		})
739
-
740
-		break
741
-	case 5:
742
-		id_one, _ := strconv.ParseInt(ids[0], 10, 64)
743
-		id_two, _ := strconv.ParseInt(ids[1], 10, 64)
744
-		inspection_one, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_one, start_time, end_time)
745
-		inspection_two, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id_two, start_time, end_time)
746
-
747
-		c.ServeSuccessJSON(map[string]interface{}{
748
-			"inspections_one": inspection_one,
749
-			"inspections_two": inspection_two,
750
-			"type":            upload_type,
751
-		})
752
-
753
-		break
754
-	case 6:
755
-		var inspections []*models.Inspection
756
-
757
-		for _, item := range ids {
758
-			id, _ := strconv.ParseInt(item, 10, 64)
759
-			inspection, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id, start_time, end_time)
760
-			//fmt.Println(err)
761
-			//if err != nil {
762
-			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
763
-			//	return
764
-			//}
765
-			for _, inspection_item := range inspection {
766
-				inspections = append(inspections, inspection_item)
767
-			}
768
-		}
769
-
770
-		c.ServeSuccessJSON(map[string]interface{}{
771
-			"inspections": inspections,
772
-			"type":        upload_type,
773
-		})
774
-
775
-		break
776
-	case 7:
777
-		var inspections []*models.Inspection
778
-
779
-		for _, item := range ids {
780
-			id, _ := strconv.ParseInt(item, 10, 64)
781
-			inspection, _, _ := service.GetAllPatientInspection(adminUserInfo.CurrentOrgId, patient, page, id, start_time, end_time)
782
-			//fmt.Println(err)
783
-			//if err != nil {
784
-			//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
785
-			//	return
786
-			//}
787
-			for _, inspection_item := range inspection {
788
-				inspections = append(inspections, inspection_item)
789
-			}
790
-		}
791
-
792
-		c.ServeSuccessJSON(map[string]interface{}{
793
-			"inspections": inspections,
794
-			"type":        upload_type,
795
-		})
796
-
797
-		break
798
-
799
-	}
800
-
801
-	return
802
-
803
-}
804
-
805
-func (c *InspectionApiController) GetInitInsepction() {
806
-	references, _ := service.GetAllInspectionReference(0)
807
-	c.ServeSuccessJSON(map[string]interface{}{
808
-		"references": references,
809
-	})
810
-	return
811
-
812
-}

+ 0 - 437
controllers/integration_config_api_controller.go Просмотреть файл

@@ -1,437 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"github.com/astaxie/beego"
8
-	"time"
9
-)
10
-
11
-type IntegrationConfigApiController struct {
12
-	BaseAuthAPIController
13
-}
14
-
15
-func IntegrationConfigRegistRouters() {
16
-
17
-	beego.Router("/api/integration/patients", &IntegrationConfigApiController{}, "get:GetPatientsList")
18
-	beego.Router("/api/patienthis/edit", &IntegrationConfigApiController{}, "post:EditPatientHis")
19
-	beego.Router("/api/patienthis/create", &IntegrationConfigApiController{}, "post:CreatePatientHis")
20
-
21
-	beego.Router("/api/integration/admin", &IntegrationConfigApiController{}, "get:GetAdminsList")
22
-	beego.Router("/api/adminhis/edit", &IntegrationConfigApiController{}, "post:EditAdminHis")
23
-	beego.Router("/api/adminhis/create", &IntegrationConfigApiController{}, "post:CreateAdminHis")
24
-
25
-	beego.Router("/api/patienthis/getinterface", &IntegrationConfigApiController{}, "post:GetInterface")
26
-	beego.Router("/api/patienthis/saveinterface", &IntegrationConfigApiController{}, "post:SaveInterface")
27
-	beego.Router("/api/integration/synclist", &IntegrationConfigApiController{}, "get:GetSyncList")
28
-	beego.Router("/api/integration/sysinspectionlist", &IntegrationConfigApiController{}, "get:GetSysInspectionList")
29
-	beego.Router("/api/patienthis/saveinspectionsysitemid", &IntegrationConfigApiController{}, "post:SaveInspectionSysItemId")
30
-}
31
-
32
-func (c *IntegrationConfigApiController) SaveInspectionSysItemId() {
33
-	adminUserInfo := c.GetAdminUserInfo()
34
-	org_id,_ := c.GetInt64("org_id",0)
35
-	sys_item_id,_ := c.GetInt64("sys_item_id",0)
36
-	id,_ := c.GetInt64("id",0)
37
-	if org_id != adminUserInfo.CurrentOrgId || sys_item_id<= 0 || id <= 0 {
38
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
39
-	}
40
-
41
-	inspection_reference := &models.InspectionReference{
42
-		ID : id,
43
-		SysItemId : sys_item_id,
44
-		UpdatedTime : time.Now().Unix(),
45
-	}
46
-	err := service.UpdateSysItemIdByID(inspection_reference)
47
-	if err != nil {
48
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
49
-	}
50
-	c.ServeSuccessJSON(map[string]interface{}{
51
-		"inspection_reference":  inspection_reference,
52
-	})
53
-	return
54
-}
55
-
56
-func (c *IntegrationConfigApiController) GetSysInspectionList() {
57
-	adminUserInfo := c.GetAdminUserInfo()
58
-	sysInspection,ownerInspection,err := service.GetSysInspectionList(adminUserInfo.CurrentOrgId)
59
-	if err != nil {
60
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
61
-	}
62
-
63
-	type InspectionStruce struct {
64
-		ProjectName string  `gorm:"-" json:"project_name" form:"project_name"`
65
-		ProjectId int64 `gorm:"-" json:"project_id" form:"project_id"`
66
-		InspectionReference []*models.InspectionReference  `gorm:"-" json:"inspection_reference" form:"inspection_reference"`
67
-	}
68
-
69
-	sysInspec := make(map[int64]*InspectionStruce, 0)
70
-	ownerInspec := make(map[int64]*InspectionStruce, 0)
71
-
72
-	
73
-
74
-	for _, item := range sysInspection {
75
-		result := sysInspec[item.ProjectId]
76
-		if result == nil {
77
-			result = new(InspectionStruce)
78
-			result.ProjectName = item.ProjectName
79
-			result.ProjectId = item.ProjectId
80
-		}
81
-		result.InspectionReference = append(result.InspectionReference, item)
82
-		sysInspec[item.ProjectId] = result
83
-	}
84
-
85
-	for _, oitem := range ownerInspection {
86
-		oresult := ownerInspec[oitem.ProjectId]
87
-		if oresult == nil {
88
-			oresult = new(InspectionStruce)
89
-			oresult.ProjectName = oitem.ProjectName
90
-			oresult.ProjectId = oitem.ProjectId
91
-		}
92
-		oresult.InspectionReference = append(oresult.InspectionReference, oitem)
93
-		ownerInspec[oitem.ProjectId] = oresult
94
-	}
95
-
96
-	c.ServeSuccessJSON(map[string]interface{}{
97
-		"sysInspec":  sysInspec,
98
-		"ownerInspec": ownerInspec,
99
-	})
100
-	return
101
-}
102
-
103
-func (c *IntegrationConfigApiController) GetSyncList() {
104
-	page, _ := c.GetInt64("page", 1)
105
-	limit, _ := c.GetInt64("limit", 10)
106
-
107
-	if page <= 0 {
108
-		page = 1
109
-	}
110
-	if limit <= 0 {
111
-		limit = 10
112
-	}
113
-
114
-	adminUserInfo := c.GetAdminUserInfo()
115
-	patients, total, _ := service.GetSyncList(adminUserInfo.CurrentOrgId, page, limit)
116
-
117
-	c.ServeSuccessJSON(map[string]interface{}{
118
-		"list":  patients,
119
-		"total": total,
120
-	})
121
-	return
122
-}
123
-
124
-func (c *IntegrationConfigApiController) SaveInterface() {
125
-	adminUserInfo := c.GetAdminUserInfo()
126
-	ID,_ := c.GetInt64("id",0)
127
-	OrgId := adminUserInfo.CurrentOrgId
128
-	Creater := adminUserInfo.AdminUser.Id 
129
-	Pattern,_ := c.GetInt("pattern",0)		
130
-	Dbhost := c.GetString("dbhost") 
131
-	Dbuser := c.GetString("dbuser")
132
-	Dbpassword := c.GetString("dbpassword") 
133
-	Dbname := c.GetString("dbname")
134
-	InterfaceUrl := c.GetString("interface_url") 
135
-	InterFaceToken := c.GetString("interface_token")
136
-	AllowIp := c.GetString("allow_ip")
137
-	AllowToken := c.GetString("allow_token")		
138
-	SyncFrequency,_ := c.GetInt("sync_frequency")
139
-	Status := 1
140
-	UpdatedTime :=  time.Now().Unix()
141
-	interfaceinfo := &models.MiddleInterface{
142
-		ID  		: ID,
143
-	OrgId   		: OrgId	,
144
-	Creater   		: Creater	,
145
-	Pattern 		: Pattern	,
146
-	Dbhost 			: Dbhost	,
147
-	Dbuser 			: Dbuser	,
148
-	Dbpassword 		: Dbpassword	,
149
-	Dbname 			: Dbname	,
150
-	InterfaceUrl 	: InterfaceUrl	,
151
-	InterFaceToken 	: InterFaceToken	,
152
-	AllowIp 		: AllowIp	,
153
-	AllowToken 		: AllowToken	,
154
-	SyncFrequency 	: SyncFrequency	,
155
-	Status			: Status	,
156
-	UpdatedTime     : UpdatedTime	,
157
-	}
158
-	if ID <= 0 {
159
-		interfaceinfo.CreatedTime =  time.Now().Unix()
160
-	}
161
-	err:= service.SaveInterface(interfaceinfo)
162
-
163
-	if err == nil {
164
-		c.ServeSuccessJSON(map[string]interface{}{
165
-			"interfaceinfo":  interfaceinfo,
166
-		})
167
-	} else {
168
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
169
-	}
170
-	return
171
-}
172
-
173
-func (c *IntegrationConfigApiController) GetInterface() {
174
-	adminUserInfo := c.GetAdminUserInfo()
175
-	interfaceinfo, _ := service.GetInterface(adminUserInfo.CurrentOrgId)
176
-	c.ServeSuccessJSON(map[string]interface{}{
177
-		"interfaceinfo":  interfaceinfo,
178
-	})
179
-	return
180
-
181
-}
182
-
183
-func (c *IntegrationConfigApiController) GetPatientsList() {
184
-	page, _ := c.GetInt64("page", 1)
185
-	limit, _ := c.GetInt64("limit", 10)
186
-
187
-	if page <= 0 {
188
-		page = 1
189
-	}
190
-	if limit <= 0 {
191
-		limit = 10
192
-	}
193
-
194
-	adminUserInfo := c.GetAdminUserInfo()
195
-	patients, total, _ := service.GetIntegrationPatientList(adminUserInfo.CurrentOrgId, page, limit)
196
-
197
-	c.ServeSuccessJSON(map[string]interface{}{
198
-		"list":  patients,
199
-		"total": total,
200
-	})
201
-	return
202
-}
203
-
204
-func (c *IntegrationConfigApiController) EditPatientHis() {
205
-	his_user_id := c.GetString("his_user_id")
206
-	id, _ := c.GetInt64("id", 0)
207
-
208
-	adminUserInfo := c.GetAdminUserInfo()
209
-
210
-	total, _ := service.FindHisPatientByHisId(adminUserInfo.CurrentOrgId, his_user_id)
211
-
212
-	if total > 0 {
213
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisIdExist)
214
-		return
215
-
216
-	}
217
-
218
-	err := service.UpdatePatientsHis(adminUserInfo.CurrentOrgId, his_user_id, id)
219
-	if err == nil {
220
-		c.ServeSuccessJSON(map[string]interface{}{
221
-			"his_user_id": his_user_id,
222
-		})
223
-	} else {
224
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
225
-
226
-	}
227
-	return
228
-
229
-}
230
-
231
-func (c *IntegrationConfigApiController) CreatePatientHis() {
232
-	his_user_id := c.GetString("his_user_id")
233
-	id, _ := c.GetInt64("id", 0)
234
-
235
-	adminUserInfo := c.GetAdminUserInfo()
236
-	patient, _ := service.FindVMPatientById(adminUserInfo.CurrentOrgId, id)
237
-
238
-	total, _ := service.FindHisPatientByHisId(adminUserInfo.CurrentOrgId, his_user_id)
239
-
240
-	if total > 0 {
241
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisIdExist)
242
-		return
243
-
244
-	}
245
-
246
-	hisPatient := &models.HisPatients{
247
-		UserOrgId:          adminUserInfo.CurrentOrgId,
248
-		UserId:             patient.UserId,
249
-		Avatar:             patient.Avatar,
250
-		PatientType:        patient.PatientType,
251
-		DialysisNo:         patient.DialysisNo,
252
-		AdmissionNumber:    patient.AdmissionNumber,
253
-		Source:             patient.Source,
254
-		Lapseto:            patient.Lapseto,
255
-		PartitionId:        patient.PartitionId,
256
-		BedId:              patient.BedId,
257
-		Name:               patient.Name,
258
-		Alias:              patient.Alias,
259
-		Gender:             patient.Gender,
260
-		Nation:             patient.Nation,
261
-		NativePlace:        patient.NativePlace,
262
-		MaritalStatus:      patient.MaritalStatus,
263
-		IdCardNo:           patient.IdCardNo,
264
-		Birthday:           patient.Birthday,
265
-		ReimbursementWayId: patient.ReimbursementWayId,
266
-		HealthCareType:     patient.HealthCareType,
267
-		HealthCareNo:       patient.HealthCareNo,
268
-		HealthCareDueDate:  patient.HealthCareDueDate,
269
-		Height:             patient.Height,
270
-		BloodType:          patient.BloodType,
271
-		Rh:                 patient.Rh,
272
-		HealthCareDueAlertDate:       patient.HealthCareDueAlertDate,
273
-		EducationLevel:               patient.EducationLevel,
274
-		Profession:                   patient.Profession,
275
-		Phone:                        patient.Phone,
276
-		HomeTelephone:                patient.HomeTelephone,
277
-		RelativePhone:                patient.RelativePhone,
278
-		HomeAddress:                  patient.HomeAddress,
279
-		WorkUnit:                     patient.WorkUnit,
280
-		UnitAddress:                  patient.UnitAddress,
281
-		ReceivingDate:                patient.ReceivingDate,
282
-		IsHospitalFirstDialysis:      patient.IsHospitalFirstDialysis,
283
-		FirstDialysisDate:            patient.FirstDialysisDate,
284
-		FirstDialysisHospital:        patient.FirstDialysisHospital,
285
-		PredialysisCondition:         patient.PredialysisCondition,
286
-		PreHospitalDialysisFrequency: patient.PreHospitalDialysisFrequency,
287
-		PreHospitalDialysisTimes:     patient.PreHospitalDialysisTimes,
288
-		HospitalFirstDialysisDate:    patient.HospitalFirstDialysisDate,
289
-		InductionPeriod:              patient.InductionPeriod,
290
-		InitialDialysis:              patient.InitialDialysis,
291
-		TotalDialysis:                patient.TotalDialysis,
292
-		AttendingDoctorId:            patient.AttendingDoctorId,
293
-		HeadNurseId:                  patient.HeadNurseId,
294
-		Evaluate:                     patient.Evaluate,
295
-		Diagnose:                     patient.Diagnose,
296
-		Remark:                       patient.Remark,
297
-		RegistrarsId:                 patient.RegistrarsId,
298
-		Registrars:                   patient.Registrars,
299
-		QrCode:                       patient.QrCode,
300
-		BindingState:                 patient.BindingState,
301
-		PatientComplains:             patient.PatientComplains,
302
-		PresentHistory:               patient.PresentHistory,
303
-		PastHistory:                  patient.PastHistory,
304
-		Temperature:                  patient.Temperature,
305
-		Pulse:                        patient.Pulse,
306
-		Respiratory:                  patient.Respiratory,
307
-		Sbp:                          patient.SBP,
308
-		Dbp:                          patient.DBP,
309
-		Status:                       1,
310
-		CreatedTime:                  time.Now().Unix(),
311
-		UpdatedTime:                  time.Now().Unix(),
312
-		Age:                          patient.Age,
313
-		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
314
-		IsInfectious:             patient.IsInfectious,
315
-		RemindCycle:              patient.RemindCycle,
316
-		ResponseResult:           patient.ResponseResult,
317
-		IsOpenRemind:             patient.IsOpenRemind,
318
-		DialysisAge:              patient.DialysisAge,
319
-		ExpenseKind:              patient.ExpenseKind,
320
-		TellPhone:                patient.TellPhone,
321
-		FirstTreatmentDate:       patient.FirstTreatmentDate,
322
-		ContactName:              patient.ContactName,
323
-		HisUserId:                his_user_id,
324
-		XtPatientId:              patient.ID,
325
-	}
326
-
327
-	err := service.CreatePatientsHis(hisPatient)
328
-	if err == nil {
329
-		c.ServeSuccessJSON(map[string]interface{}{
330
-			"patient": hisPatient,
331
-		})
332
-	} else {
333
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
334
-
335
-	}
336
-	return
337
-
338
-}
339
-
340
-func (c *IntegrationConfigApiController) GetAdminsList() {
341
-	page, _ := c.GetInt("page", 1)
342
-	limit, _ := c.GetInt("limit", 10)
343
-
344
-	if page <= 0 {
345
-		page = 1
346
-	}
347
-	if limit <= 0 {
348
-		limit = 10
349
-	}
350
-
351
-	adminUserInfo := c.GetAdminUserInfo()
352
-
353
-	viewModels, total, getAdminsErr := service.GetAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, page, limit)
354
-	if getAdminsErr != nil {
355
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
356
-		return
357
-	}
358
-	c.ServeSuccessJSON(map[string]interface{}{
359
-		"admins":      viewModels,
360
-		"total_count": total,
361
-	})
362
-
363
-	return
364
-
365
-}
366
-
367
-func (c *IntegrationConfigApiController) EditAdminHis() {
368
-	his_user_id := c.GetString("his_user_id")
369
-	id, _ := c.GetInt64("id", 0)
370
-
371
-	adminUserInfo := c.GetAdminUserInfo()
372
-
373
-	total, _ := service.FindHisAdminByHisId(adminUserInfo.CurrentOrgId, his_user_id, adminUserInfo.CurrentAppId)
374
-
375
-	if total > 0 {
376
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisIdExist)
377
-		return
378
-
379
-	}
380
-
381
-	err := service.UpdateAdminsHis(adminUserInfo.CurrentOrgId, his_user_id, id)
382
-	if err == nil {
383
-		c.ServeSuccessJSON(map[string]interface{}{
384
-			"his_user_id": his_user_id,
385
-		})
386
-	} else {
387
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
388
-
389
-	}
390
-	return
391
-
392
-}
393
-
394
-func (c *IntegrationConfigApiController) CreateAdminHis() {
395
-	his_user_id := c.GetString("his_user_id")
396
-	id, _ := c.GetInt64("id", 0)
397
-
398
-	adminUserInfo := c.GetAdminUserInfo()
399
-	adminRole, _ := service.FindVMAdminRoleById(adminUserInfo.CurrentOrgId, id, adminUserInfo.CurrentAppId)
400
-
401
-	total, _ := service.FindHisAdminByHisId(adminUserInfo.CurrentOrgId, his_user_id, adminUserInfo.CurrentAppId)
402
-
403
-	if total > 0 {
404
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisIdExist)
405
-		return
406
-
407
-	}
408
-
409
-	hisAdminRole := &models.HisUserAdminRole{
410
-		OrgId:       adminUserInfo.CurrentOrgId,
411
-		AdminUserId: adminRole.AdminUserId,
412
-		AppId:       adminRole.AppId,
413
-		RoleId:      adminRole.RoleId,
414
-		UserName:    adminRole.UserName,
415
-		Avatar:      adminRole.Avatar,
416
-		UserType:    adminRole.UserType,
417
-		UserTitle:   adminRole.UserTitle,
418
-		Intro:       adminRole.Intro,
419
-		Status:      1,
420
-		Ctime:       time.Now().Unix(),
421
-		Mtime:       time.Now().Unix(),
422
-		XtRoleId:    adminRole.ID,
423
-		HisUserId:   his_user_id,
424
-	}
425
-
426
-	err := service.CreateAdminsHis(hisAdminRole)
427
-	if err == nil {
428
-		c.ServeSuccessJSON(map[string]interface{}{
429
-			"his_role": hisAdminRole,
430
-		})
431
-	} else {
432
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
433
-
434
-	}
435
-	return
436
-
437
-}

+ 0 - 164
controllers/invoice_api_controller.go Просмотреть файл

@@ -1,164 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"encoding/json"
8
-	"fmt"
9
-	"github.com/astaxie/beego"
10
-	"regexp"
11
-	"strconv"
12
-	"strings"
13
-	"time"
14
-)
15
-
16
-type InvoiceApiController struct {
17
-	BaseServeAPIController
18
-}
19
-
20
-func InvoiceApiRegistRouters() {
21
-	beego.Router("/api/invoice/applies", &InvoiceApiController{}, "Get:GetApplies")
22
-	beego.Router("/api/invoice/apply", &InvoiceApiController{}, "Post:CreateInvoice")
23
-	beego.Router("/api/invoice/noinvorders", &InvoiceApiController{}, "Get:GetNoInvOrders")
24
-	beego.Router("/api/invoices", &InvoiceApiController{}, "Get:GetInvoices")
25
-}
26
-
27
-func (c *InvoiceApiController) GetApplies() {
28
-	orders := c.GetString("orders")
29
-	if len(orders) == 0 {
30
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
31
-		return
32
-	}
33
-
34
-	if match, _ := regexp.MatchString("^([0-9]+[,])*([0-9]+)$", orders); !match {
35
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
36
-		return
37
-	}
38
-
39
-	adminUserInfo := c.GetAdminUserInfo()
40
-
41
-	ordersIDSlipe := make([]int64, 0)
42
-	ordersSlipe := strings.Split(orders, ",")
43
-	for index := range ordersSlipe {
44
-		orderid, _ := strconv.ParseInt(ordersSlipe[index], 10, 64)
45
-		if orderid > 0 {
46
-			ordersIDSlipe = append(ordersIDSlipe, orderid)
47
-		}
48
-	}
49
-	if len(ordersIDSlipe) == 0 {
50
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
51
-		return
52
-	}
53
-
54
-	has, nos, err := service.FindServeOrdersByIDs(adminUserInfo.CurrentOrgId, ordersIDSlipe)
55
-	if err != nil {
56
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
57
-		return
58
-	}
59
-
60
-	c.ServeSuccessJSON(map[string]interface{}{
61
-		"has": has,
62
-		"nos": nos,
63
-	})
64
-}
65
-
66
-func (c *InvoiceApiController) CreateInvoice() {
67
-	orders := c.GetString("orders")
68
-	if len(orders) == 0 {
69
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
70
-		return
71
-	}
72
-
73
-	if match, _ := regexp.MatchString("^([0-9]+[,])*([0-9]+)$", orders); !match {
74
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
75
-		return
76
-	}
77
-
78
-	adminUserInfo := c.GetAdminUserInfo()
79
-
80
-	ordersIDSlipe := make([]int64, 0)
81
-	ordersSlipe := strings.Split(orders, ",")
82
-	for index := range ordersSlipe {
83
-		orderid, _ := strconv.ParseInt(ordersSlipe[index], 10, 64)
84
-		if orderid > 0 {
85
-			ordersIDSlipe = append(ordersIDSlipe, orderid)
86
-		}
87
-	}
88
-	if len(ordersIDSlipe) == 0 {
89
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
90
-		return
91
-	}
92
-
93
-	_, nos, err := service.FindServeOrdersByIDs(adminUserInfo.CurrentOrgId, ordersIDSlipe)
94
-	if err != nil {
95
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
96
-		return
97
-	}
98
-	if len(nos) == 0 {
99
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
100
-		return
101
-	}
102
-
103
-	var invoiceData models.ServeInvoice
104
-	err = json.Unmarshal(c.Ctx.Input.RequestBody, &invoiceData)
105
-	if err != nil {
106
-		fmt.Println(err)
107
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
108
-		return
109
-	}
110
-
111
-	inds := make([]string, 0)
112
-	var inc float64
113
-	for index := range nos {
114
-		inds = append(inds, strconv.FormatInt(nos[index].ID, 10))
115
-		inc += nos[index].PayableAmount
116
-	}
117
-
118
-	invoiceData.OrgId = adminUserInfo.CurrentOrgId
119
-	invoiceData.Status = 1
120
-	invoiceData.CreatedTime = time.Now().Unix()
121
-	invoiceData.UpdatedTime = time.Now().Unix()
122
-	invoiceData.InvoiceAmountGross = inc
123
-	orders = "," + strings.Join(inds, ",") + ","
124
-	invoiceData.Orders = orders
125
-	invoiceData.InvoiceStatus = 1
126
-
127
-	err = service.CreateInvoice(&invoiceData)
128
-	if err != nil {
129
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeApplyInvoiceFail)
130
-		return
131
-	}
132
-
133
-	c.ServeSuccessJSON(map[string]interface{}{
134
-		"invoice": invoiceData,
135
-	})
136
-}
137
-
138
-func (c *InvoiceApiController) GetNoInvOrders() {
139
-	adminUserInfo := c.GetAdminUserInfo()
140
-
141
-	orders, err := service.FindUnInvoiceOrders(adminUserInfo.CurrentOrgId)
142
-	if err != nil {
143
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
144
-		return
145
-	}
146
-
147
-	c.ServeSuccessJSON(map[string]interface{}{
148
-		"orders": orders,
149
-	})
150
-}
151
-
152
-func (c *InvoiceApiController) GetInvoices() {
153
-	adminUserInfo := c.GetAdminUserInfo()
154
-
155
-	invoices, err := service.FindInvoices(adminUserInfo.CurrentOrgId)
156
-	if err != nil {
157
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
158
-		return
159
-	}
160
-
161
-	c.ServeSuccessJSON(map[string]interface{}{
162
-		"invoices": invoices,
163
-	})
164
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 5410
controllers/manage_api_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 2316
controllers/manager_center_api_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 8493
controllers/mobile_api_controllers/dialysis_api_controller.go


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

@@ -1,635 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"fmt"
9
-	"github.com/jinzhu/gorm"
10
-	"strconv"
11
-	"time"
12
-)
13
-
14
-// /m/api/monitor/add [post]
15
-// @param patient_id:int
16
-// @param order_id?:int 透析记录 ID
17
-// @param date?:int 日期(10位时间戳)
18
-// @param operate_time?:int 实际测量日期(10位时间戳)
19
-// @param time?:string 时间(hh:mm) 废弃
20
-// @param pulse_frequency?:float 脉率(P)(次/min)
21
-// @param breathing_rated?:float 呼吸频率(R)(次/min)
22
-// @param systolic_bp?:float 收缩压
23
-// @param diastolic_bp?:float 舒张压
24
-// @param bp_type?:int 血压测量类型
25
-// @param blood_flow_volume?:float 血流量(ml/min)
26
-// @param venous_pressure?:float 静脉压
27
-// @param venous_pressure_unit?:string 静脉压单位
28
-// @param arterial_pressure?:float 动脉压
29
-// @param transmembrane_pressure?:float 跨膜压
30
-// @param transmembrane_pressure_unit?:string 跨膜压单位
31
-// @param ultrafiltration_rate?:float 超滤率(ml/h)
32
-// @param ultrafiltration_volume?:float 超滤量(ml)
33
-// @param sodium_concentration?:float 钠浓度(mmol/L)
34
-// @param dialysate_temperature?:float 透析液温度(℃)
35
-// @param replacement_rate?:float 置换率(ml/min)
36
-// @param displacement_quantity?:float 置换量(L)
37
-// @param ktv?:float KT/V(在线)
38
-// @param symptom?:string 症状
39
-// @param dispose?:string 处理
40
-// @param result?:string 结果
41
-// @param monitoring_nurse?:int 监测人
42
-func (this *DialysisAPIController) AddMonitorRecord() {
43
-	patientID, _ := this.GetInt64("patient_id")
44
-	if patientID <= 0 {
45
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
46
-		return
47
-	}
48
-	orderID, _ := this.GetInt64("order_id")
49
-	if orderID < 0 {
50
-		orderID = 0
51
-	}
52
-	date, _ := this.GetInt64("date")
53
-	operateTime, _ := this.GetInt64("operate_time")
54
-
55
-	// recordTime := this.GetString("time")
56
-	if date <= 0 || operateTime <= 0 {
57
-		date = 0
58
-		operateTime = 0
59
-		// recordTime = ""
60
-	}
61
-	fmt.Println(date)
62
-	fmt.Println(operateTime)
63
-
64
-	pulseFrequency, _ := this.GetFloat("pulse_frequency")
65
-	//breathingRated, _ := this.GetFloat("breathing_rated")
66
-	breathingRated := this.GetString("breathing_rated")
67
-	systolicBP, _ := this.GetFloat("systolic_bp")
68
-	diastolicBP, _ := this.GetFloat("diastolic_bp")
69
-	BPType, _ := this.GetInt("bp_type")
70
-	bloodFlowVolume, _ := this.GetFloat("blood_flow_volume")
71
-	venousPressure, _ := this.GetFloat("venous_pressure")
72
-	venousPressureType, _ := this.GetInt64("venous_pressure_type", 1)
73
-	arterialPressure, _ := this.GetFloat("arterial_pressure")
74
-	arterialPressureType, _ := this.GetInt64("arterial_pressure_type", 1)
75
-	transmembranePressure, _ := this.GetFloat("transmembrane_pressure", 0)
76
-	transmembranePressureType, _ := this.GetInt64("transmembrane_pressure_type", 1)
77
-	ultrafiltrationRate, _ := this.GetFloat("ultrafiltration_rate")
78
-	ultrafiltrationVolume, _ := this.GetFloat("ultrafiltration_volume")
79
-	sodiumConcentration, _ := this.GetFloat("sodium_concentration")
80
-	dialysateTemperature, _ := this.GetFloat("dialysate_temperature")
81
-	temperature, _ := this.GetFloat("temperature")
82
-	replacementRate, _ := this.GetFloat("replacement_rate")
83
-	displacementQuantity, _ := this.GetFloat("displacement_quantity")
84
-	ktv, _ := this.GetFloat("ktv")
85
-
86
-	symptom := this.GetString("symptom")
87
-	dispose := this.GetString("dispose")
88
-	conductivity, _ := this.GetFloat("conductivity")
89
-	displacement_flow_quantity, _ := this.GetFloat("displacement_flow_quantity")
90
-	blood_oxygen_saturation := this.GetString("blood_oxygen_saturation")
91
-	result := this.GetString("result")
92
-	monitoringNurse, _ := this.GetInt64("monitoring_nurse")
93
-	heparin, _ := this.GetFloat("heparin")
94
-	dialysate_flow, _ := this.GetFloat("dialysate_flow")
95
-	urr := this.GetString("urr")
96
-	blood_sugar, _ := this.GetFloat("blood_sugar")
97
-	monitor_anticoagulant, _ := this.GetInt64("monitor_anticoagulant")
98
-	monitor_anticoagulant_value := this.GetString("monitor_anticoagulant_value")
99
-	heparin_amount, _ := this.GetFloat("heparin_amount")
100
-	blood_pressure_monitoring_site, _ := this.GetInt64("blood_pressure_monitoring_site")
101
-	complication, _ := this.GetInt64("complication")
102
-	accumulated_blood_volume, _ := this.GetFloat("accumulated_blood_volume")
103
-	blood_temperature, _ := this.GetFloat("blood_temperature")
104
-	urea_monitoring, _ := this.GetFloat("urea_monitoring")
105
-	blood_thickness, _ := this.GetFloat("blood_thickness")
106
-	blood_monitor, _ := this.GetFloat("blood_monitor")
107
-	dehydration, _ := this.GetFloat("dehydration")
108
-	filter_pressure := this.GetString("filter_pressure")
109
-	adminInfo := this.GetMobileAdminUserInfo()
110
-	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
111
-	if getPatientErr != nil {
112
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
113
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
114
-		return
115
-	} else if patient == nil {
116
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
117
-		return
118
-	}
119
-
120
-	record := models.MonitoringRecord{
121
-		UserOrgId:       adminInfo.Org.Id,
122
-		PatientId:       patientID,
123
-		DialysisOrderId: orderID,
124
-		MonitoringDate:  date,
125
-		OperateTime:     operateTime,
126
-		// MonitoringTime:            recordTime,
127
-		PulseFrequency:              pulseFrequency,
128
-		BreathingRate:               breathingRated,
129
-		SystolicBloodPressure:       systolicBP,
130
-		DiastolicBloodPressure:      diastolicBP,
131
-		BloodPressureType:           int64(BPType),
132
-		BloodFlowVolume:             bloodFlowVolume,
133
-		VenousPressure:              venousPressure,
134
-		VenousPressureType:          venousPressureType,
135
-		ArterialPressure:            arterialPressure,
136
-		ArterialPressureType:        arterialPressureType,
137
-		TransmembranePressure:       transmembranePressure,
138
-		TransmembranePressureType:   transmembranePressureType,
139
-		UltrafiltrationRate:         ultrafiltrationRate,
140
-		UltrafiltrationVolume:       ultrafiltrationVolume,
141
-		SodiumConcentration:         sodiumConcentration,
142
-		DialysateTemperature:        dialysateTemperature,
143
-		Temperature:                 temperature,
144
-		ReplacementRate:             replacementRate,
145
-		DisplacementQuantity:        displacementQuantity,
146
-		Ktv:                         ktv,
147
-		Symptom:                     symptom,
148
-		Dispose:                     dispose,
149
-		Result:                      result,
150
-		MonitoringNurse:             monitoringNurse,
151
-		Status:                      1,
152
-		CreatedTime:                 time.Now().Unix(),
153
-		UpdatedTime:                 time.Now().Unix(),
154
-		Conductivity:                conductivity,
155
-		DisplacementFlowQuantity:    displacement_flow_quantity,
156
-		BloodOxygenSaturation:       blood_oxygen_saturation,
157
-		Creator:                     adminInfo.AdminUser.Id,
158
-		Modify:                      0,
159
-		Heparin:                     heparin,
160
-		DialysateFlow:               dialysate_flow,
161
-		Urr:                         urr,
162
-		BloodSugar:                  blood_sugar,
163
-		MonitorAnticoagulant:        monitor_anticoagulant,
164
-		MonitorAnticoagulantValue:   monitor_anticoagulant_value,
165
-		BloodPressureMonitoringSite: blood_pressure_monitoring_site,
166
-		Complication:                complication,
167
-		AccumulatedBloodVolume:      accumulated_blood_volume,
168
-		BloodTemperature:            blood_temperature,
169
-		UreaMonitoring:              urea_monitoring,
170
-		BloodThickness:              blood_thickness,
171
-		BloodMonitor:                blood_monitor,
172
-		HeparinAmount:               heparin_amount,
173
-		Dehydration:                 dehydration,
174
-		FilterPressure:              filter_pressure,
175
-	}
176
-
177
-	err := service.CreateMonitor(&record)
178
-	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_records"
179
-	redis := service.RedisClient()
180
-	//清空key 值
181
-	redis.Set(key, "", time.Second)
182
-	keyOne := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_record_list_all"
183
-	redis.Set(keyOne, "", time.Second)
184
-	defer redis.Close()
185
-	if err != nil {
186
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorCreate)
187
-		return
188
-	}
189
-
190
-	this.ServeSuccessJSON(map[string]interface{}{
191
-		"monitor": record,
192
-	})
193
-}
194
-
195
-// /m/api/monitor/edit [post]
196
-// @param patient_id:int
197
-// @param order_id?:int 透析记录 ID
198
-// @param date?:int 日期(10位时间戳)
199
-// @param operate_time?:int 实际测量日期(10位时间戳)
200
-// @param time?:string 时间(hh:mm)废弃
201
-// @param pulse_frequency?:float 脉率(P)(次/min)
202
-// @param breathing_rated?:float 呼吸频率(R)(次/min)
203
-// @param systolic_bp?:float 收缩压
204
-// @param diastolic_bp?:float 舒张压
205
-// @param bp_type?:int 血压测量类型
206
-// @param blood_flow_volume?:float 血流量(ml/min)
207
-// @param venous_pressure?:float 静脉压
208
-// @param venous_pressure_unit?:string 静脉压单位
209
-// @param arterial_pressure?:float 动脉压
210
-// @param transmembrane_pressure?:float 跨膜压
211
-// @param transmembrane_pressure_unit?:string 跨膜压单位
212
-// @param ultrafiltration_rate?:float 超滤率(ml/h)
213
-// @param ultrafiltration_volume?:float 超滤量(ml)
214
-// @param sodium_concentration?:float 钠浓度(mmol/L)
215
-// @param dialysate_temperature?:float 透析液温度(℃)
216
-// @param replacement_rate?:float 置换率(ml/min)
217
-// @param displacement_quantity?:float 置换量(L)
218
-// @param ktv?:float KT/V(在线)
219
-// @param symptom?:string 症状
220
-// @param dispose?:string 处理
221
-// @param result?:string 结果
222
-// @param monitoring_nurse?:int 监测人
223
-func (this *DialysisAPIController) EditMonitorRecord() {
224
-	patientID, _ := this.GetInt64("patient_id")
225
-	if patientID <= 0 {
226
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
227
-		return
228
-	}
229
-	id, _ := this.GetInt64("id")
230
-	if id <= 0 {
231
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
232
-		return
233
-	}
234
-	orderID, _ := this.GetInt64("order_id")
235
-	if orderID < 0 {
236
-		orderID = 0
237
-	}
238
-	date, _ := this.GetInt64("date")
239
-	operateTime, _ := this.GetInt64("operate_time")
240
-	if date <= 0 {
241
-		date = 0
242
-		operateTime = 0
243
-	}
244
-	pulseFrequency, _ := this.GetFloat("pulse_frequency")
245
-	//breathingRated, _ := this.GetFloat("breathing_rated")
246
-	breathingRated := this.GetString("breathing_rated")
247
-	systolicBP, _ := this.GetFloat("systolic_bp")
248
-	diastolicBP, _ := this.GetFloat("diastolic_bp")
249
-	BPType, _ := this.GetInt("bp_type")
250
-	bloodFlowVolume, _ := this.GetFloat("blood_flow_volume")
251
-	venousPressure, _ := this.GetFloat("venous_pressure")
252
-	venousPressureType, _ := this.GetInt64("venous_pressure_type", 1)
253
-	arterialPressure, _ := this.GetFloat("arterial_pressure")
254
-	arterialPressureType, _ := this.GetInt64("arterial_pressure", 1)
255
-	transmembranePressure, _ := this.GetFloat("transmembrane_pressure")
256
-	transmembranePressureType, _ := this.GetInt64("transmembrane_pressure_type", 1)
257
-	ultrafiltrationRate, _ := this.GetFloat("ultrafiltration_rate")
258
-	ultrafiltrationVolume, _ := this.GetFloat("ultrafiltration_volume")
259
-	sodiumConcentration, _ := this.GetFloat("sodium_concentration")
260
-	dialysateTemperature, _ := this.GetFloat("dialysate_temperature")
261
-	temperature, _ := this.GetFloat("temperature")
262
-	replacementRate, _ := this.GetFloat("replacement_rate")
263
-	displacementQuantity, _ := this.GetFloat("displacement_quantity")
264
-	ktv, _ := this.GetFloat("ktv")
265
-	symptom := this.GetString("symptom")
266
-	dispose := this.GetString("dispose")
267
-	result := this.GetString("result")
268
-	blood_oxygen_saturation := this.GetString("blood_oxygen_saturation")
269
-	monitoringNurse, _ := this.GetInt64("monitoring_nurse")
270
-	conductivity, _ := this.GetFloat("conductivity")
271
-	displacement_flow_quantity, _ := this.GetFloat("displacement_flow_quantity")
272
-	heparin, _ := this.GetFloat("heparin")
273
-	dialysate_flow, _ := this.GetFloat("dialysate_flow")
274
-	urr := this.GetString("urr")
275
-	blood_sugar, _ := this.GetFloat("blood_sugar")
276
-	adminInfo := this.GetMobileAdminUserInfo()
277
-	monitor_anticoagulant, _ := this.GetInt64("monitor_anticoagulant")
278
-	monitor_anticoagulant_value := this.GetString("monitor_anticoagulant_value")
279
-	blood_pressure_monitoring_site, _ := this.GetInt64("blood_pressure_monitoring_site")
280
-	complication, _ := this.GetInt64("complication")
281
-	accumulated_blood_volume, _ := this.GetFloat("accumulated_blood_volume")
282
-	blood_temperature, _ := this.GetFloat("blood_temperature")
283
-	urea_monitoring, _ := this.GetFloat("urea_monitoring")
284
-	blood_thickness, _ := this.GetFloat("blood_thickness")
285
-	blood_monitor, _ := this.GetFloat("blood_monitor")
286
-	heparin_amount, _ := this.GetFloat("heparin_amount")
287
-	dehydration, _ := this.GetFloat("dehydration")
288
-	filter_pressure := this.GetString("filter_pressure")
289
-	monitor, err := service.GetMonitor(adminInfo.Org.Id, patientID, id)
290
-	if err != nil {
291
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
292
-		return
293
-	}
294
-	if monitor == nil {
295
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorNotExist)
296
-		return
297
-	}
298
-
299
-	monitor.Conductivity = conductivity
300
-	monitor.DialysisOrderId = orderID
301
-	monitor.MonitoringDate = date
302
-	monitor.OperateTime = operateTime
303
-	monitor.PulseFrequency = pulseFrequency
304
-	monitor.BreathingRate = breathingRated
305
-	monitor.SystolicBloodPressure = systolicBP
306
-	monitor.DiastolicBloodPressure = diastolicBP
307
-	monitor.BloodPressureType = int64(BPType)
308
-	monitor.BloodFlowVolume = bloodFlowVolume
309
-	monitor.VenousPressure = venousPressure
310
-	monitor.VenousPressureType = venousPressureType
311
-	monitor.ArterialPressure = arterialPressure
312
-	monitor.ArterialPressureType = arterialPressureType
313
-	monitor.TransmembranePressure = transmembranePressure
314
-	monitor.TransmembranePressureType = transmembranePressureType
315
-	monitor.UltrafiltrationRate = ultrafiltrationRate
316
-	monitor.UltrafiltrationVolume = ultrafiltrationVolume
317
-	monitor.SodiumConcentration = sodiumConcentration
318
-	monitor.DialysateTemperature = dialysateTemperature
319
-	monitor.Temperature = temperature
320
-	monitor.ReplacementRate = replacementRate
321
-	monitor.DisplacementQuantity = displacementQuantity
322
-	monitor.Ktv = ktv
323
-	monitor.Symptom = symptom
324
-	monitor.Dispose = dispose
325
-	monitor.Result = result
326
-	monitor.MonitoringNurse = monitoringNurse
327
-	monitor.Status = 1
328
-	monitor.UpdatedTime = time.Now().Unix()
329
-	monitor.DisplacementFlowQuantity = displacement_flow_quantity
330
-	monitor.BloodOxygenSaturation = blood_oxygen_saturation
331
-	monitor.Modify = adminInfo.AdminUser.Id
332
-	monitor.Heparin = heparin
333
-	monitor.DialysateFlow = dialysate_flow
334
-	monitor.Urr = urr
335
-	monitor.BloodSugar = blood_sugar
336
-	monitor.MonitorAnticoagulant = monitor_anticoagulant
337
-	monitor.MonitorAnticoagulantValue = monitor_anticoagulant_value
338
-	monitor.BloodPressureMonitoringSite = blood_pressure_monitoring_site
339
-	monitor.Complication = complication
340
-	monitor.AccumulatedBloodVolume = accumulated_blood_volume
341
-	monitor.BloodMonitor = blood_monitor
342
-	monitor.UreaMonitoring = urea_monitoring
343
-	monitor.BloodThickness = blood_thickness
344
-	monitor.BloodTemperature = blood_temperature
345
-	monitor.HeparinAmount = heparin_amount
346
-	monitor.Dehydration = dehydration
347
-	monitor.FilterPressure = filter_pressure
348
-	err = service.UpdateMonitor(monitor)
349
-	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_records"
350
-	redis := service.RedisClient()
351
-	//清空key 值
352
-	redis.Set(key, "", time.Second)
353
-	keyOne := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_record_list_all"
354
-	redis.Set(keyOne, "", time.Second)
355
-
356
-	defer redis.Close()
357
-
358
-	if err != nil {
359
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorUpdate)
360
-		return
361
-	}
362
-
363
-	this.ServeSuccessJSON(map[string]interface{}{
364
-		"monitor": monitor,
365
-	})
366
-}
367
-
368
-// /m/api/monitor/delete [post]
369
-// @param record_id:int
370
-// @param patient_id:int
371
-func (this *DialysisAPIController) DeleteMonitor() {
372
-	recordID, _ := this.GetInt64("record_id")
373
-	patientID, _ := this.GetInt64("patient_id")
374
-	if recordID <= 0 || patientID <= 0 {
375
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
376
-		return
377
-	}
378
-	adminInfo := this.GetMobileAdminUserInfo()
379
-	patient, getPatientErr := service.MobileGetPatientById(adminInfo.Org.Id, patientID)
380
-	if getPatientErr != nil {
381
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
382
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
383
-		return
384
-	} else if patient == nil {
385
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
386
-		return
387
-	}
388
-
389
-	monitor, getMonitorErr := service.GetMonitor(adminInfo.Org.Id, patientID, recordID)
390
-	if getMonitorErr != nil {
391
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
392
-		return
393
-	}
394
-	err := service.DisableMonitor(adminInfo.Org.Id, patientID, recordID, adminInfo.AdminUser.Id)
395
-	orgid := this.GetMobileAdminUserInfo().Org.Id
396
-	redis := service.RedisClient()
397
-	key := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(monitor.MonitoringDate, 10) + ":monitor_record_list_all"
398
-	redis.Set(key, "", time.Second)
399
-	keyOne := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(monitor.MonitoringDate, 10) + ":monitor_records"
400
-	redis.Set(keyOne, "", time.Second)
401
-	fmt.Println("keyo呢32332322332332232332", keyOne)
402
-	redis.Close()
403
-
404
-	if err != nil {
405
-		this.ErrorLog("删除透析监测记录失败:%v", err)
406
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBDelete)
407
-		return
408
-	}
409
-	this.ServeSuccessJSON(map[string]interface{}{
410
-		"record_id": monitor.ID,
411
-	})
412
-}
413
-
414
-// /m/api/schedule/urgentinit [get]
415
-func (this *DialysisAPIController) UrgentScheduleInitData() {
416
-	schedule_type, _ := this.GetInt("type", 0)
417
-	adminUserInfo := this.GetMobileAdminUserInfo()
418
-	today := utils.ZeroHourTimeOfDay(time.Now())
419
-	//获取所有病人且没有上机记录的病人
420
-	patients, getPatientsErr := service.MobileGetAllPatientsForUrgentSchedule(adminUserInfo.Org.Id, today.Unix())
421
-	if getPatientsErr != nil {
422
-		this.ErrorLog("获取所有患者失败:%v", getPatientsErr)
423
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
424
-		return
425
-	}
426
-	modes, getModesErr := service.MobileGetAllTrearmentModesForUrgentSchedule()
427
-	if getModesErr != nil {
428
-		this.ErrorLog("获取所有治疗模式失败:%v", getModesErr)
429
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
430
-		return
431
-	}
432
-	deviceNumbers, getDeviceNumbersErr := service.GetAllAvaildDeviceNumbers(adminUserInfo.Org.Id, today.Unix(), schedule_type)
433
-	if getDeviceNumbersErr != nil {
434
-		this.ErrorLog("获取所有床位失败:%v", getDeviceNumbersErr)
435
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
436
-		return
437
-	}
438
-	schedules, getSchedulesErr := service.MobileGetOtherSchedulesForUrgentSchedule(adminUserInfo.Org.Id, today.Unix(), schedule_type)
439
-	if getSchedulesErr != nil {
440
-		this.ErrorLog("获取所有排班失败:%v", getSchedulesErr)
441
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
442
-		return
443
-	}
444
-
445
-	this.ServeSuccessJSON(map[string]interface{}{
446
-		"patients":       patients,
447
-		"modes":          modes,
448
-		"device_numbers": deviceNumbers,
449
-		"schedules":      schedules,
450
-	})
451
-}
452
-
453
-// /m/api/schedule/urgentadd [post]
454
-// @param patient_id:int
455
-// @param schedule_type:int
456
-// @param mode:int
457
-// @param bed:int
458
-func (this *DialysisAPIController) AddUrgentSchedule() {
459
-	patientID, _ := this.GetInt64("patient_id")
460
-	scheduleType, _ := this.GetInt64("schedule_type")
461
-	modeID, _ := this.GetInt64("mode")
462
-	bedID, _ := this.GetInt64("bed")
463
-	if patientID <= 0 || scheduleType < 1 || scheduleType > 3 || modeID < 1 || modeID > 14 || bedID <= 0 {
464
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
465
-		return
466
-	}
467
-
468
-	adminUserInfo := this.GetMobileAdminUserInfo()
469
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.Org.Id, patientID)
470
-	if getPatientErr != nil {
471
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
472
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
473
-		return
474
-	} else if patient == nil {
475
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
476
-		return
477
-	}
478
-
479
-	deviceNumber, getDeviceNumberErr := service.GetDeviceNumberByID(adminUserInfo.Org.Id, bedID)
480
-	if getDeviceNumberErr != nil {
481
-		this.ErrorLog("获取床位失败:%v", getDeviceNumberErr)
482
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
483
-		return
484
-	} else if deviceNumber == nil {
485
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDeviceNumberNotExist)
486
-		return
487
-	}
488
-
489
-	scheduleDate := utils.ZeroHourTimeOfDay(time.Now())
490
-	weekday := int64(scheduleDate.Weekday())
491
-	if weekday == 0 {
492
-		weekday = 7
493
-	}
494
-
495
-	//判断这个人今天是否有排班
496
-	daySchedule, dayScheduleErr := service.GetDayScheduleTwo(adminUserInfo.Org.Id, scheduleDate.Unix(), patientID)
497
-
498
-	//判断当前时段该床位是否有排班
499
-	schedule, err := service.GetDayScheduleByBedid(adminUserInfo.Org.Id, scheduleDate.Unix(), bedID, scheduleType)
500
-	if dayScheduleErr == gorm.ErrRecordNotFound { //今天没有排班
501
-		if err == gorm.ErrRecordNotFound { //空床位
502
-			// 创建排班数据
503
-			newSchedule := &models.Schedule{
504
-				UserOrgId:    adminUserInfo.Org.Id,
505
-				PartitionId:  deviceNumber.ZoneID,
506
-				BedId:        deviceNumber.ID,
507
-				PatientId:    patientID,
508
-				ScheduleDate: scheduleDate.Unix(),
509
-				ScheduleType: scheduleType,
510
-				ScheduleWeek: weekday,
511
-				ModeId:       modeID,
512
-				Status:       1,
513
-				CreatedTime:  time.Now().Unix(),
514
-				UpdatedTime:  time.Now().Unix(),
515
-				IsExport:     5,
516
-			}
517
-			createErr := service.CreateScheduleTwo(newSchedule)
518
-			redis := service.RedisClient()
519
-			timeStr := time.Now().Format("2006-01-02")
520
-			key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
521
-			redis.Set(key, "", time.Second)
522
-			//处方
523
-			keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":prescriptions_list_all"
524
-			redis.Set(keyOne, "", time.Second)
525
-
526
-			//医嘱
527
-			keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":advice_list_all"
528
-			redis.Set(keyTwo, "", time.Second)
529
-
530
-			keySix := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":assessment_befores_list_all"
531
-			redis.Set(keySix, "", time.Second)
532
-			keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":assessment_after_dislysis_list_all"
533
-			redis.Set(keyThree, "", time.Second)
534
-
535
-			keyFour := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":monitor_record_list_all"
536
-			redis.Set(keyFour, "", time.Second)
537
-
538
-			keyFive := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":treatment_summarys_list_all"
539
-			redis.Set(keyFive, "", time.Second)
540
-
541
-			keySeven := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(scheduleDate.Unix(), 10) + ":dialysis_orders_list_all"
542
-			redis.Set(keySeven, "", time.Second)
543
-			redis.Close()
544
-			if createErr != nil {
545
-				this.ErrorLog("紧急排班失败:%v", createErr)
546
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateScheduleFail)
547
-				return
548
-			} else {
549
-				this.ServeSuccessJSON(map[string]interface{}{
550
-					"schedule": newSchedule,
551
-					"patient":  patient,
552
-				})
553
-			}
554
-		} else if err == nil {
555
-			if schedule.ID > 0 && schedule.DialysisOrder.ID == 0 { //该床位有排班没上机记录
556
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorSchedualcRepeatBed)
557
-			} else if schedule.ID > 0 && schedule.DialysisOrder.ID > 0 { //有排班且有上机记录
558
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
559
-				return
560
-			}
561
-		} else if err != nil {
562
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
563
-			return
564
-		}
565
-
566
-	} else if dayScheduleErr == nil { //今天有排班
567
-
568
-		if daySchedule.ID > 0 && daySchedule.DialysisOrder.ID <= 0 { //今天有排班但是没上机
569
-
570
-			if err == gorm.ErrRecordNotFound { //空床位
571
-				// 修改了床位逻辑
572
-				daySchedule, _ := service.GetDayScheduleTwo(adminUserInfo.Org.Id, scheduleDate.Unix(), patientID)
573
-				if daySchedule.ID > 0 {
574
-					daySchedule.PartitionId = deviceNumber.ZoneID
575
-					daySchedule.BedId = bedID
576
-					daySchedule.ModeId = modeID
577
-					daySchedule.ScheduleType = scheduleType
578
-					daySchedule.UpdatedTime = time.Now().Unix()
579
-					err := service.UpdateSchedule(&daySchedule)
580
-					redis := service.RedisClient()
581
-
582
-					timeStr := time.Now().Format("2006-01-02")
583
-					key := "scheduals_" + timeStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
584
-					redis.Set(key, "", time.Second)
585
-					//处方
586
-					keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":prescriptions_list_all"
587
-					redis.Set(keyOne, "", time.Second)
588
-
589
-					//医嘱
590
-					keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":advice_list_all"
591
-					redis.Set(keyTwo, "", time.Second)
592
-
593
-					keySix := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":assessment_befores_list_all"
594
-					redis.Set(keySix, "", time.Second)
595
-					keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":assessment_after_dislysis_list_all"
596
-					redis.Set(keyThree, "", time.Second)
597
-
598
-					keyFour := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":monitor_record_list_all"
599
-					redis.Set(keyFour, "", time.Second)
600
-
601
-					keyFive := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":treatment_summarys_list_all"
602
-					redis.Set(keyFive, "", time.Second)
603
-
604
-					keySeven := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + ":dialysis_orders_list_all"
605
-					redis.Set(keySeven, "", time.Second)
606
-					redis.Close()
607
-					if err != nil {
608
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
609
-						return
610
-					}
611
-					this.ServeSuccessJSON(map[string]interface{}{
612
-						"schedule": daySchedule,
613
-						"patient":  patient,
614
-					})
615
-				}
616
-			} else if err == nil { //该床位被人霸占
617
-				if schedule.ID > 0 && schedule.DialysisOrder.ID == 0 { //霸占该床位的病人有排班没上机记录
618
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorSchedualcRepeatBed)
619
-					return
620
-				} else if schedule.ID > 0 && schedule.DialysisOrder.ID > 0 { //霸占该床位的病人有排班且有上机记录
621
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
622
-					return
623
-				}
624
-			} else if err != nil {
625
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
626
-				return
627
-			}
628
-
629
-		} else if daySchedule.ID > 0 && daySchedule.DialysisOrder.ID > 0 { //今天有排班且上机
630
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrder)
631
-			return
632
-		}
633
-	}
634
-
635
-}

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

@@ -1,208 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"fmt"
9
-	"strconv"
10
-	"time"
11
-)
12
-
13
-type DoctorAdviceAPIController struct {
14
-	MobileBaseAPIAuthController
15
-}
16
-
17
-// /m/api/schedule/advices [get]
18
-// @param date:string (yyyy-mm-dd)
19
-// @param advice_type:int 1长期医嘱 3临时医嘱 其他:全部
20
-func (this *DoctorAdviceAPIController) ScheduleAdvices() {
21
-
22
-	schedualDate := this.GetString("date")
23
-	adviceType, _ := this.GetInt("advice_type")
24
-	patientType, _ := this.GetInt("patient_type")
25
-	delivery_way := this.GetString("delivery_way")
26
-	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
27
-		adviceType = 0
28
-	}
29
-
30
-	if patientType != 1 && patientType != 2 && patientType != 3 && patientType != 4 {
31
-
32
-		patientType = 0
33
-	}
34
-
35
-	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
36
-	if parseDateErr != nil {
37
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
38
-		return
39
-	}
40
-
41
-	adminInfo := this.GetMobileAdminUserInfo()
42
-	orgID := adminInfo.Org.Id
43
-	redis := service.RedisClient()
44
-	key := strconv.FormatInt(orgID, 10) + ":" + ":patient_list_all"
45
-	redis.Set(key, "", time.Second)
46
-	scheduals, err := service.MobileGetScheduleDoctorAdvicesTwo(orgID, date.Unix(), adviceType, patientType, adminInfo.AdminUser.Id, delivery_way)
47
-
48
-	fmt.Println("scheduals00923923999233223", scheduals)
49
-	//获取所有的患者
50
-	blood_patients, _ := service.GetAllPatientListByListSeven(orgID)
51
-	//获取透析处方
52
-	blood_prescriptions, _ := service.GetAllPrescriptionByListOne(orgID, date.Unix())
53
-	//获取上机
54
-	blood_dialysisOrders, _ := service.GetAllDialysisOrdersByListSeven(orgID, date.Unix())
55
-
56
-	for key, schedule := range scheduals {
57
-		for _, patient := range blood_patients {
58
-			if schedule.PatientId == patient.ID {
59
-				scheduals[key].SchedualPatient = patient
60
-				break
61
-			}
62
-		}
63
-
64
-		for _, prescription := range blood_prescriptions {
65
-			if schedule.PatientId == prescription.PatientId {
66
-				scheduals[key].Prescription = prescription
67
-				break
68
-			}
69
-		}
70
-
71
-		//获取上机
72
-		for _, dialysisorder := range blood_dialysisOrders {
73
-			if schedule.PatientId == dialysisorder.PatientId {
74
-				scheduals[key].DialysisOrder = dialysisorder
75
-				break
76
-			}
77
-		}
78
-
79
-	}
80
-
81
-	config, _ := service.GetHisDoctorConfig(orgID)
82
-	project_config, _ := service.GetHisProjectConfig(orgID)
83
-
84
-	fmt.Println("project_config23323232322323", project_config.IsOpen)
85
-	if project_config.IsOpen == 1 || project_config.IsOpen == 2 {
86
-		//获取his医嘱数据
87
-		project, _ := service.GetMobileHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, adminInfo.AdminUser.Id)
88
-		//team_project, _ := service.GetMobileHisPrescriptionTeamProject(orgID, date.Unix(), delivery_way, patientType, adminInfo.AdminUser.Id)
89
-		for _, item := range project {
90
-			index := 0
91
-			for _, subItem := range item.HisPrescriptionTeamProject {
92
-
93
-				if subItem.HisProject.CostClassify != 3 {
94
-					subItem.IsCheckTeam = 2
95
-					item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
96
-				}
97
-
98
-				if subItem.HisProject.CostClassify == 3 {
99
-					subItem.IsCheckTeam = 1
100
-					index = index + 1
101
-					if index == 1 {
102
-						item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
103
-					}
104
-				}
105
-			}
106
-		}
107
-
108
-		//获取所有的患者
109
-		patients, _ := service.GetAllPatientListByListTwo(orgID)
110
-
111
-		//获取所有床位
112
-		numberList, _ := service.GetAllDeviceNumberByListOne(orgID)
113
-
114
-		//获取透析处方
115
-		prescriptions, _ := service.GetAllPrescriptionByListOne(orgID, date.Unix())
116
-
117
-		//获取上机
118
-		dialysisOrders, _ := service.GetAllDialysisOrdersByListSeven(orgID, date.Unix())
119
-
120
-		for key, item := range project {
121
-			for _, patient := range patients {
122
-				if item.PatientId == patient.ID {
123
-					project[key].SchedualPatient = patient
124
-					break
125
-				}
126
-			}
127
-			// 获取床位信息
128
-			for _, it := range numberList {
129
-				if item.BedId == it.ID {
130
-					project[key].DeviceNumber = it
131
-					break
132
-				}
133
-			}
134
-
135
-			// 获取处方
136
-			for _, it := range prescriptions {
137
-				if item.PatientId == it.PatientId {
138
-					project[key].Prescription = it
139
-					break
140
-				}
141
-			}
142
-
143
-			//获取上机
144
-			for _, it := range dialysisOrders {
145
-				if item.PatientId == it.PatientId {
146
-					project[key].DialysisOrder = it
147
-					break
148
-				}
149
-			}
150
-		}
151
-
152
-		hisAdvices, _ := service.GetHisDoctorAdvicesTwo(orgID, date.Unix(), delivery_way, patientType, adminInfo.AdminUser.Id)
153
-		adminUser, _ := service.GetAllAdminUsers(orgID, adminInfo.App.Id)
154
-		if err != nil {
155
-			this.ErrorLog("获取排班信息失败:%v", err)
156
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
157
-		} else {
158
-			filtedScheduals := []*service.MScheduleDoctorAdviceVMOne{}
159
-			for _, schedual := range scheduals {
160
-				if len(schedual.DoctorAdvices) > 0 || len(hisAdvices) > 0 {
161
-					filtedScheduals = append(filtedScheduals, schedual)
162
-				}
163
-			}
164
-			this.ServeSuccessJSON(map[string]interface{}{
165
-				"scheduals":      filtedScheduals,
166
-				"adminUser":      adminUser,
167
-				"config":         config,
168
-				"project":        project,
169
-				"project_config": project_config,
170
-				"hisAdvices":     hisAdvices,
171
-			})
172
-		}
173
-	} else {
174
-		adminUser, _ := service.GetAllAdminUsers(orgID, adminInfo.App.Id)
175
-		if err != nil {
176
-			this.ErrorLog("获取排班信息失败:%v", err)
177
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
178
-		} else {
179
-			filtedScheduals := []*service.MScheduleDoctorAdviceVMOne{}
180
-			for _, schedual := range scheduals {
181
-				if len(schedual.DoctorAdvices) > 0 {
182
-					filtedScheduals = append(filtedScheduals, schedual)
183
-				}
184
-			}
185
-			this.ServeSuccessJSON(map[string]interface{}{
186
-				"scheduals":      filtedScheduals,
187
-				"adminUser":      adminUser,
188
-				"config":         config,
189
-				"project_config": project_config,
190
-			})
191
-		}
192
-	}
193
-}
194
-
195
-func (c *DoctorAdviceAPIController) GetAdviceConfigs() {
196
-	advice_type, _ := c.GetInt64("type", 0)
197
-	adminUserInfo := c.GetMobileAdminUserInfo()
198
-	var drugs []models.DrugDic
199
-	drugways, _, _ := service.GetDrugWayDics(adminUserInfo.Org.Id)
200
-	efs, _, _ := service.GetExecutionFrequencyDics(adminUserInfo.Org.Id)
201
-	adviceTemplates, _ := service.FindAllAdviceTemplate(adminUserInfo.Org.Id, advice_type)
202
-	c.ServeSuccessJSON(map[string]interface{}{
203
-		"drugs":            drugs,
204
-		"drugways":         drugways,
205
-		"efs":              efs,
206
-		"advice_templates": adviceTemplates,
207
-	})
208
-}

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

@@ -1,29 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/service"
5
-)
6
-
7
-type DoctorsApiController struct {
8
-	MobileBaseAPIAuthController
9
-}
10
-
11
-func (c *DoctorsApiController) GetAllDoctorAndNurse() {
12
-	adminUserInfo := c.GetMobileAdminUserInfo()
13
-	doctors, nursers, _ := service.GetAllDoctorAndNurse(adminUserInfo.Org.Id, adminUserInfo.App.Id)
14
-	c.ServeSuccessJSON(map[string]interface{}{
15
-		"doctors": doctors,
16
-		"nursers": nursers,
17
-	})
18
-	return
19
-}
20
-
21
-func (c *DoctorsApiController) GetAllAdminUsers() {
22
-	//adminUserInfo := c.GetAdminUserInfo()
23
-	adminUserInfo := c.GetMobileAdminUserInfo()
24
-	users, _ := service.GetAllAdminUsers(adminUserInfo.Org.Id, adminUserInfo.App.Id)
25
-	c.ServeSuccessJSON(map[string]interface{}{
26
-		"users": users,
27
-	})
28
-	return
29
-}

+ 0 - 158
controllers/mobile_api_controllers/err_msg.json Просмотреть файл

@@ -1,158 +0,0 @@
1
-{
2
-  "msg": [
3
-    {
4
-      "url": "/m/api/solution?mode=1,/api/dialysis/soulution?mode=1,/api/patients/dialysissolution/create?mode=1",
5
-      "err_msg": "没有权限新增长期处方"
6
-    },{
7
-      "url": ",,/api/patients/dialysissolution/edit?mode=2",
8
-      "err_msg": "没有权限修改长期处方"
9
-    },{
10
-      "url": ",,/api/patients/dialysissolution/edit?mode=3",
11
-      "err_msg": "没有权限修改别人的长期处方"
12
-    },{
13
-      "url": "/m/api/dialysis/dialysisPrescription?mode=1,/api/dialysis/prescription?mode=1,",
14
-      "err_msg": "没有权限新增临时处方"
15
-    },{
16
-      "url": "/m/api/dialysis/dialysisPrescription?mode=3,/api/dialysis/prescription?mode=3,",
17
-      "err_msg": "没有权限修改他人的临时处方"
18
-    },{
19
-      "url": "/m/api/dialysis/acceptsAssessment?mode=1,/api/dialysis/accepts?mode=1,",
20
-      "err_msg": "没有权限新增接诊评估"
21
-    },{
22
-      "url": "/m/api/dialysis/acceptsAssessment?mode=2,/api/dialysis/accepts?mode=2,",
23
-      "err_msg": "没有权限修改接诊评估"
24
-    },{
25
-      "url": "/m/api/dialysis/acceptsAssessment?mode=3,/api/dialysis/accepts?mode=3,",
26
-      "err_msg": "没有权限修改别人接诊评估"
27
-    },{
28
-      "url": "/m/api/assessmentbefore/commit?mode=1,/api/dialysis/assessmentbeforedislysis?mode=1,",
29
-      "err_msg": "没有权限新增透前评估"
30
-    },{
31
-      "url": "/m/api/assessmentbefore/commit?mode=2,/api/dialysis/assessmentbeforedislysis?mode=2,",
32
-      "err_msg": "没有权限修改透前评估"
33
-    },{
34
-      "url": "/m/api/assessmentbefore/commit?mode=3,/api/dialysis/assessmentbeforedislysis?mode=3,",
35
-      "err_msg": "没有权限修改别人透前评估"
36
-    },{
37
-      "url": "/m/api/dialysis/start?mode=1,/api/dialysis/start_record?mode=1,",
38
-      "err_msg": "没有权限执行上机"
39
-    },{
40
-      "url": "/m/api/startOrder/edit?mode=2,/api/start_dialysis/modify?mode=2,",
41
-      "err_msg": "没有权限修改执行上机"
42
-    },{
43
-      "url": "/m/api/startOrder/edit?mode=3,/api/start_dialysis/modify?mode=3,",
44
-      "err_msg": "没有权限修改他人执行上机"
45
-    },{
46
-      "url": "/m/api/monitor/add?mode=1,/api/dislysis/monitor/edit?mode=1,",
47
-      "err_msg": "没有权限新增透析监测"
48
-    },{
49
-      "url": "/m/api/monitor/edit?mode=2,/api/dislysis/monitor/edit?mode=2,",
50
-      "err_msg": "没有权限修改透析监测"
51
-    },{
52
-      "url": "/m/api/monitor/edit?mode=3,/api/dislysis/monitor/edit?mode=3,",
53
-      "err_msg": "没有权限修改他人透析监测"
54
-    },{
55
-      "url": "/m/api/monitor/delete?mode=4,/api/dialysis/monitor/del?mode=4,",
56
-      "err_msg": "没有权限删除透析监测"
57
-    },{
58
-      "url": "/m/api/monitor/delete?mode=5,/api/dialysis/monitor/del?mode=5,",
59
-      "err_msg": "没有权限删除他人透析监测"
60
-    },{
61
-      "url": "/m/api/dialysis/finish?mode=1,/api/dialysis/finish?mode=1,",
62
-      "err_msg": "没有权限执行下机"
63
-    },{
64
-      "url": "/m/api/finishOrder/edit?mode=2,/api/finish_dialysis/modify?mode=2,",
65
-      "err_msg": "没有权限修改执行下机"
66
-    },{
67
-      "url": "/m/api/finishOrder/edit?mode=3,/api/finish_dialysis/modify?mode=3,",
68
-      "err_msg": "没有权限修改他人执行下机"
69
-    },{
70
-      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=1,/api/dialysis/assessmentafterdislysis?mode=1,",
71
-      "err_msg": "没有权限新增透后评估"
72
-    },{
73
-      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=2,/api/dialysis/assessmentafterdislysis?mode=2,",
74
-      "err_msg": "没有权限修改透后评估"
75
-    },{
76
-      "url": "/m/api/dialysis/assessmentAfterDislysis?mode=3,/api/dialysis/assessmentafterdislysis?mode=3,",
77
-      "err_msg": "没有权限修改他人透后评估"
78
-    },{
79
-      "url": "/m/api/dialysis/treatmentSummary?mode=1,/api/dialysis/treatmentsummary?mode=1,",
80
-      "err_msg": "没有权限新增治疗小结"
81
-    },{
82
-      "url": "/m/api/dialysis/treatmentSummary?mode=2,/api/dialysis/treatmentsummary?mode=2,",
83
-      "err_msg": "没有权限修改治疗小结"
84
-    },{
85
-      "url": "/m/api/dialysis/treatmentSummary?mode=3,/api/dialysis/treatmentsummary?mode=3,",
86
-      "err_msg": "没有权限修改他人治疗小结"
87
-    },{
88
-      "url": "/m/api/dryweight/commit?mode=1,/api/dryweight/commit?mode=1,/api/patient/updatedryweightdata?mode=1",
89
-      "err_msg": "没有权限新增干体重"
90
-    },{
91
-      "url": ",/api/patients/advice/create?mode=1-1,/api/patients/advice/creategroup?mode=1-1",
92
-      "err_msg": "没有权限新增临时医嘱"
93
-    },{
94
-      "url": ",/api/patients/advice/edit?mode=2-1,",
95
-      "err_msg": "没有权限修改临时医嘱"
96
-    },{
97
-      "url": ",/api/patients/advice/edit?mode=3-1,",
98
-      "err_msg": "没有权限修改他人临时医嘱"
99
-    },{
100
-      "url": ",/api/patients/advice/delete?mode=4-1,/api/patients/advice/deletegroup?mode=4-1",
101
-      "err_msg": "没有权限删除临时医嘱"
102
-    },{
103
-      "url": ",/api/patients/advice/delete?mode=5-1,/api/patients/advice/deletegroup?mode=5-1",
104
-      "err_msg": "没有权限删除他人开的临时医嘱"
105
-    },{
106
-      "url": ",/api/patients/advice/create?mode=1-2,/api/patients/advice/creategroup?mode=1-2",
107
-      "err_msg": "没有权限新增长期医嘱"
108
-    },{
109
-      "url": ",/api/patients/advice/edit?mode=1-3,",
110
-      "err_msg": "没有权限修改长期医嘱"
111
-    },{
112
-      "url": ",/api/patients/advice/edit?mode=1-4,",
113
-      "err_msg": "没有权限修改他人长期医嘱"
114
-    },{
115
-      "url": ",/api/patients/advice/stop?mode=1-5,",
116
-      "err_msg": "没有权限停止长期医嘱"
117
-    },{
118
-      "url": ",/api/patients/advice/delete?mode=1-6,/api/patients/advice/deletegroup?mode=1-6",
119
-      "err_msg": "没有权限删除长期医嘱"
120
-    },{
121
-      "url": ",/api/patients/advice/delete?mode=1-7,/api/patients/advice/deletegroup?mode=1-7",
122
-      "err_msg": "没有权限删除他人长期医嘱"
123
-    },{
124
-      "url": "/m/api/advice/creategroup?mode=1,/api/patients/advice/creategroup?mode=1,/api/patients/advice/create?mode=1",
125
-      "err_msg": "没有权限新增透析临时医嘱"
126
-    },{
127
-      "url": "/m/api/advice/edit?mode=2,/api/patients/advice/edit?mode=2,",
128
-      "err_msg": "没有权限修改透析临时医嘱"
129
-    },{
130
-      "url": "/m/api/advice/edit?mode=3,/api/patients/advice/edit?mode=3,",
131
-      "err_msg": "没有权限修改他人透析临时医嘱"
132
-    },{
133
-      "url": "/m/api/newadvice/delete?mode=4,/api/patients/advice/delete?mode=4,/api/patients/advice/deletegroup?mode=4",
134
-      "err_msg": "没有权限删除透析临时医嘱"
135
-    },{
136
-      "url": "/m/api/newadvice/delete?mode=5,/api/patients/advice/delete?mode=5,/api/patients/advice/deletegroup?mode=5",
137
-      "err_msg": "没有权限删除他人透析临时医嘱"
138
-    },{
139
-      "url": "/m/api/advice/exec?mode=6,/api/patients/advice/exec?mode=6,",
140
-      "err_msg": "没有权限执行透析临时医嘱"
141
-    },{
142
-      "url": "/m/api/advice/exec/modify?mode=8,,",
143
-      "err_msg": "没有权限修改已执行医嘱"
144
-    },{
145
-      "url": "/m/api/advice/check?mode=7,/api/patients/advice/check?mode=7,",
146
-      "err_msg": "没有权限核对透析临时医嘱"
147
-    },{
148
-      "url": ",/api/patients/advice/stop?mode=1-8,",
149
-      "err_msg": "没有权限停止他人长期医嘱"
150
-    },{
151
-      "url": ",/api/patients/advice/execgroup?mode=6-1,",
152
-      "err_msg": "没有权限执行医嘱"
153
-    },{
154
-      "url": ",/api/patients/advice/checkgroup?mode=7-1,",
155
-      "err_msg": "没有权限核对医嘱"
156
-    }
157
-  ]
158
-}

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

@@ -1,230 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"encoding/json"
9
-	"fmt"
10
-	"io/ioutil"
11
-	"net/http"
12
-	"net/url"
13
-	"strconv"
14
-
15
-	"github.com/astaxie/beego"
16
-)
17
-
18
-type LoginAPIController struct {
19
-	MobileBaseAPIController
20
-}
21
-
22
-// /m/api/login/pwd [post] LoginByPwd
23
-// @param mobile:string
24
-// @param password:string
25
-func (this *LoginAPIController) LoginByPwd() {
26
-	mobile := this.GetString("mobile")
27
-	pwd := this.GetString("password")
28
-	//var mobile = "15089497668"
29
-	//var pwd = "123456"
30
-	if len(mobile) == 0 || len(pwd) == 0 || utils.CellPhoneRegexp().MatchString(mobile) == false {
31
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
32
-		return
33
-	}
34
-	ip := utils.GetIP(this.Ctx.Request)
35
-	ssoDomain := beego.AppConfig.String("sso_domain")
36
-	//ssoDomain := "http://localhost:8091"
37
-	api := ssoDomain + "/m/login/pwd"
38
-	values := make(url.Values)
39
-	values.Set("mobile", mobile)
40
-	values.Set("password", pwd)
41
-	values.Set("app_type", "3")
42
-	values.Set("ip", ip)
43
-	resp, requestErr := http.PostForm(api, values)
44
-
45
-	if requestErr != nil {
46
-		utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
47
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
48
-		return
49
-	}
50
-	defer resp.Body.Close()
51
-	body, ioErr := ioutil.ReadAll(resp.Body)
52
-	if ioErr != nil {
53
-		utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
54
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
55
-		return
56
-	}
57
-	var respJSON map[string]interface{}
58
-	utils.InfoLog(string(body))
59
-	if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
60
-		utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
61
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
62
-		return
63
-	}
64
-
65
-	if respJSON["state"].(float64) != 1 {
66
-		msg := respJSON["msg"].(string)
67
-		utils.ErrorLog("SSO登录接口请求失败: %v", msg)
68
-		if int(respJSON["code"].(float64)) == 609 {
69
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
70
-			return
71
-		}
72
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
73
-		return
74
-	} else {
75
-		utils.SuccessLog("SSO登录成功")
76
-		// 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
77
-		userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
78
-		userJSONBytes, _ := json.Marshal(userJSON)
79
-		var adminUser models.AdminUser
80
-		if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
81
-			utils.ErrorLog("解析管理员失败:%v", err)
82
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
83
-			return
84
-		}
85
-
86
-		var org models.Org
87
-		if respJSON["data"].(map[string]interface{})["org"] != nil {
88
-			orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
89
-			orgJSONBytes, _ := json.Marshal(orgJSON)
90
-			if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
91
-				utils.ErrorLog("解析机构失败:%v", err)
92
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
93
-				return
94
-			}
95
-		}
96
-
97
-		var app models.OrgApp
98
-
99
-		if respJSON["data"].(map[string]interface{})["app"] != nil {
100
-			appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
101
-			appJSONBytes, _ := json.Marshal(appJSON)
102
-			if err := json.Unmarshal(appJSONBytes, &app); err != nil {
103
-				utils.ErrorLog("解析应用失败:%v", err)
104
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
105
-				return
106
-			}
107
-		}
108
-
109
-		var appRole models.App_Role
110
-
111
-		if respJSON["data"].(map[string]interface{})["app_role"] != nil {
112
-			appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
113
-			appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
114
-			if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
115
-				utils.ErrorLog("解析AppRole失败:%v", err)
116
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
117
-				return
118
-			}
119
-		}
120
-
121
-		var subscibe models.ServeSubscibe
122
-		if respJSON["data"].(map[string]interface{})["subscibe"] != nil {
123
-			subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
124
-			subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
125
-			if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
126
-				utils.ErrorLog("解析Subscibe失败:%v", err)
127
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
128
-				return
129
-			}
130
-
131
-		}
132
-
133
-		//service.GetOrgSubscibeState(&subscibe)
134
-		templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
135
-		mobileAdminUserInfo := &MobileAdminUserInfo{
136
-			AdminUser:    &adminUser,
137
-			Org:          &org,
138
-			App:          &app,
139
-			AppRole:      &appRole,
140
-			Subscibe:     &subscibe,
141
-			TemplateInfo: &templateInfo,
142
-		}
143
-		//设置seesion
144
-		this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
145
-
146
-		//设置cookie
147
-		mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
148
-		fmt.Println("mobile-------------------------------------------------------", mobile)
149
-		token := utils.GenerateLoginToken(mobile)
150
-		fmt.Println("token-------------------------------------------------------", token)
151
-		expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
152
-		this.Ctx.SetCookie("token_cookie", token, expiration, "/")
153
-
154
-		fmt.Println("cookie获取--------------------------------------------------", this.Ctx.GetCookie("token_cookie"))
155
-		var configList interface{}
156
-		var dict_config_list interface{}
157
-
158
-		var FiledList []*models.FiledConfig
159
-
160
-		if org.Id > 0 {
161
-			dict_config_list, _ = service.GetDictConfigList(org.Id)
162
-
163
-			configList, _ = service.GetConfigList(org.Id)
164
-			FiledList, _ = service.FindFiledByOrgId(org.Id)
165
-		}
166
-		if len(FiledList) == 0 {
167
-			var err error
168
-			if org.Id > 0 {
169
-				err = service.BatchInsertFiledConfig(org.Id)
170
-				if err == nil {
171
-					FiledList, _ = service.FindFiledByOrgId(org.Id)
172
-				} else {
173
-					utils.ErrorLog("字段批量插入失败:%v", err)
174
-				}
175
-			} else {
176
-				FiledList = make([]*models.FiledConfig, 0)
177
-			}
178
-		}
179
-		//产寻该机构是否有收缩压和舒张压
180
-		pressure, _ := service.GetDefaultSystolicPressure(org.Id)
181
-		//fmt.Println(err)
182
-		var err error
183
-		if len(pressure) == 0 {
184
-			err = service.BathInsertQualityControlTwo(org.Id)
185
-		} else {
186
-			utils.ErrorLog("字段批量插入失败:%v", err)
187
-		}
188
-
189
-		//批量插入质控达标统计配置
190
-		major, requestErr := service.GetInspectionMajor(org.Id)
191
-		if len(major) == 0 {
192
-			QualityeList, err := service.FindQualityByOrgId(org.Id)
193
-			if len(QualityeList) == 0 {
194
-				err = service.BatchInsertQualityControl(org.Id)
195
-			} else {
196
-				utils.ErrorLog("字段批量插入失败:%v", err)
197
-			}
198
-
199
-			//批量插入检验检查统计配置
200
-			InspectionList, err := service.FindeInspectionByOrgId(org.Id)
201
-			if len(InspectionList) == 0 {
202
-				err = service.BatchInspectionConfiguration(org.Id)
203
-			} else {
204
-				utils.ErrorLog("字段批量插入失败:%v", err)
205
-			}
206
-		} else {
207
-			utils.ErrorLog("字段批量插入失败:%v", requestErr)
208
-		}
209
-
210
-		this.ServeSuccessJSON(map[string]interface{}{
211
-			"admin": adminUser,
212
-			"user":  appRole,
213
-			"org":   org,
214
-			"template_info": map[string]interface{}{
215
-				"id":          templateInfo.ID,
216
-				"org_id":      templateInfo.OrgId,
217
-				"template_id": templateInfo.TemplateId,
218
-			},
219
-			"config_list":      configList,
220
-			"dict_config_list": dict_config_list,
221
-
222
-			"filed_list": FiledList,
223
-		})
224
-	}
225
-}
226
-
227
-// /m/api/login/code [post] LoginByCode
228
-func (this *LoginAPIController) LoginByCode() {
229
-
230
-}

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

@@ -1,304 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"bytes"
9
-	"encoding/json"
10
-	"fmt"
11
-	"log"
12
-	"os"
13
-	"path"
14
-	"regexp"
15
-	"runtime"
16
-	"strconv"
17
-	"strings"
18
-	"time"
19
-)
20
-
21
-type MobileBaseAPIController struct {
22
-	controllers.BaseAPIController
23
-}
24
-
25
-func (this *MobileBaseAPIController) Prepare() {
26
-	this.BaseAPIController.Prepare()
27
-
28
-	// beego.Trace("============================================================")
29
-	// beego.Trace("session ID: %v", this.Ctx.Input.Cookie("beegosessionID"))
30
-	// beego.Trace("session : %v", this.GetSession("info"))
31
-	// this.SetSession("info", time.Now().Format("2006/01/02 15:04:05"))
32
-	// beego.Trace("============================================================")
33
-}
34
-
35
-//
36
-
37
-func (this *MobileBaseAPIController) GetMobileAdminUserInfo() *MobileAdminUserInfo {
38
-	userInfo := this.GetSession("mobile_admin_user_info")
39
-	if userInfo == nil {
40
-		return nil
41
-	} else {
42
-		return userInfo.(*MobileAdminUserInfo)
43
-	}
44
-}
45
-
46
-type MobileAdminUserInfo struct {
47
-	AdminUser    *models.AdminUser
48
-	Org          *models.Org
49
-	App          *models.OrgApp
50
-	AppRole      *models.App_Role
51
-	Subscibe     *models.ServeSubscibe
52
-	TemplateInfo *models.GobalTemplate
53
-}
54
-
55
-type MobileBaseAPIAuthController struct {
56
-	MobileBaseAPIController
57
-}
58
-
59
-func (this *MobileBaseAPIAuthController) Prepare() {
60
-	token := this.Ctx.GetCookie("token_cookie")
61
-	logout_cookie := this.Ctx.GetCookie("logout_cookie")
62
-
63
-	//if len(token) == 0{
64
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
65
-	//	this.StopRun()
66
-	//}
67
-	this.MobileBaseAPIController.Prepare()
68
-	adminUserInfo := this.GetMobileAdminUserInfo()
69
-
70
-	if len(token) == 0 {
71
-		this.DelSession("mobile_admin_user_info")
72
-		// fmt.Println(logout_cookie)
73
-		if len(logout_cookie) == 1 {
74
-			this.Ctx.SetCookie("logout_cookie", "2")
75
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLogOut)
76
-			this.StopRun()
77
-		} else {
78
-
79
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
80
-			this.StopRun()
81
-		}
82
-
83
-	} else {
84
-		if adminUserInfo == nil {
85
-			this.DelSession("mobile_admin_user_info")
86
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
87
-			this.StopRun()
88
-		}
89
-	}
90
-
91
-	//if this.Ctx.Request.Method != "GET" {
92
-	//	err := service.GetOrgSubscibeState(adminUserInfo.Subscibe)
93
-	//	if err != nil || adminUserInfo.Subscibe.State == 3 {
94
-	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotSubscibe)
95
-	//		this.StopRun()
96
-	//	}
97
-	//}
98
-
99
-	if adminUserInfo.AppRole != nil {
100
-		if adminUserInfo.AppRole.Id > 0 {
101
-			app_role, _ := service.FindAppRoleById(adminUserInfo.AppRole.Id)
102
-			if app_role != nil {
103
-				if app_role.Status != 1 {
104
-					this.DelSession("mobile_admin_user_info")
105
-					this.Ctx.SetCookie("token_cookie", "")
106
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeForbidden)
107
-					this.StopRun()
108
-				}
109
-			}
110
-		}
111
-
112
-	}
113
-
114
-	if this.Ctx.Request.Header.Get("Permission") == "1" {
115
-		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator { //超级管理员不受此限制
116
-			err_msgs := LoadErrMsgConfig("./err_msg.json").Msgs
117
-
118
-			isPermission := false
119
-			adminUserInfo := this.GetMobileAdminUserInfo()
120
-			//该机构下该用户有多少个
121
-			redisClient := service.RedisClient()
122
-			defer redisClient.Close()
123
-			key2 := strconv.FormatInt(adminUserInfo.Org.Id, 10) + "_" + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10) + "_role_ids"
124
-			result, _ := redisClient.Get(key2).Result()
125
-			var role models.App_Role
126
-			var roles []string
127
-			if len(result) == 0 {
128
-				//该机构下该用户有多少个
129
-				role, _ = service.GetUserAllRole(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id)
130
-				redisClient.Set(key2, role, time.Second*60*60*18)
131
-				if len(role.RoleIds) > 0 { //该用户没有设置角色
132
-					roles = strings.Split(role.RoleIds, ",")
133
-				}
134
-			} else {
135
-				json.Unmarshal([]byte(result), &role)
136
-				if len(role.RoleIds) > 0 { //该用户没有设置角色
137
-					roles = strings.Split(role.RoleIds, ",")
138
-				}
139
-			}
140
-			//redis相关处理逻辑
141
-			redis := service.RedisClient()
142
-			defer redis.Close()
143
-
144
-			//redis key值
145
-			key := "purviews_" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + strconv.FormatInt(adminUserInfo.AdminUser.Id, 10)
146
-			purviews_json_str, _ := redis.Get(key).Result()
147
-			//获取该用户下所有角色的权限总集
148
-			var userRolePurviews string
149
-			var userRolePurviewsArr []string
150
-
151
-			fmt.Println("----redis 开始----")
152
-			fmt.Println(purviews_json_str)
153
-			fmt.Println("----redis 结束----")
154
-
155
-			if len(purviews_json_str) == 0 {
156
-				for _, item := range roles {
157
-					role_id, _ := strconv.ParseInt(item, 10, 64)
158
-					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
159
-					if len(userRolePurviews) == 0 {
160
-						userRolePurviews = purviews
161
-					} else {
162
-						userRolePurviews = userRolePurviews + "," + purviews
163
-					}
164
-				}
165
-				//该用户所拥有角色的权限的总集
166
-				userRolePurviewsArr = RemoveRepeatedPurviewElement(strings.Split(userRolePurviews, ","))
167
-				//缓存数据
168
-				purview_json, err := json.Marshal(userRolePurviewsArr)
169
-				if err == nil {
170
-					redis.Set(key, purview_json, time.Minute*60*60*24)
171
-				}
172
-			} else {
173
-				var dat []string
174
-				if err := json.Unmarshal([]byte(purviews_json_str), &dat); err == nil {
175
-
176
-				} else {
177
-
178
-				}
179
-				userRolePurviewsArr = dat
180
-			}
181
-
182
-			// fmt.Println(userRolePurviewsArr)
183
-
184
-			//系统所记录的权限列表
185
-			allPermission, _ := service.GetAllFunctionPurview()
186
-			for _, item := range allPermission {
187
-				//判断当前路由是否在权限路由列表里面
188
-				if strings.Split(item.Urlfor, ",")[0] == strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode") {
189
-
190
-					//获取该角色的所有权限
191
-					for _, items := range userRolePurviewsArr {
192
-						id, _ := strconv.ParseInt(items, 10, 64)
193
-
194
-						if id == item.ID {
195
-							isPermission = true
196
-						}
197
-					}
198
-					if !isPermission {
199
-						//msg, _ := service.FindErrorMsgByStr(strings.Split(this.Ctx.Request.RequestURI, "?")[0] + "?" + "mode=" + this.GetString("mode"))
200
-						var msg string
201
-						for _, item := range err_msgs {
202
-							if strings.Index(item.Url, strings.Split(this.Ctx.Request.RequestURI, "?")[0]+"?"+"mode="+this.GetString("mode")) != -1 {
203
-								msg = item.ErrMsg
204
-							}
205
-						}
206
-
207
-						json := make(map[string]interface{})
208
-						json["msg"] = msg
209
-						json["code"] = 0
210
-						json["state"] = 0
211
-						this.Data["json"] = json
212
-						this.ServeJSON()
213
-						this.StopRun()
214
-					}
215
-				}
216
-			}
217
-		}
218
-	}
219
-
220
-}
221
-
222
-func RemoveRepeatedPurviewElement(arr []string) (newArr []string) {
223
-	newArr = make([]string, 0)
224
-	for i := 0; i < len(arr); i++ {
225
-		repeat := false
226
-		for j := i + 1; j < len(arr); j++ {
227
-			if arr[i] == arr[j] {
228
-				repeat = true
229
-				break
230
-			}
231
-		}
232
-		if !repeat {
233
-			newArr = append(newArr, arr[i])
234
-		}
235
-	}
236
-	return
237
-}
238
-
239
-type AdminUserInfo struct {
240
-	AdminUser    *models.AdminUser                    `json:"user"`
241
-	CurrentOrgId int64                                `json:"current_org_id"`
242
-	CurrentAppId int64                                `json:"current_app_id"`
243
-	OrgIds       []int64                              `json:"org_ids"`
244
-	Orgs         map[int64]*models.Org                `json:"orgs"`
245
-	OrgAppIds    map[int64][]int64                    `json:"org_app_ids"`
246
-	OrgApps      map[int64](map[int64]*models.OrgApp) `json:"org_apps"`
247
-	App2OrgIds   map[int64]int64                      `json:"app_to_org_ids"`
248
-	AppRoles     map[int64]*models.App_Role           `json:"app_roles"`
249
-	AppPurviews  map[int64][]*models.Purview          `json:"app_purviews"`
250
-	AppUrlfors   map[int64][]string                   `json:"app_urlfors"`
251
-	Subscibes    map[int64]*models.ServeSubscibe      `json:"org_subscibes"`
252
-}
253
-
254
-type ErrMsgConfig struct {
255
-	Msgs []*models.ErrMsg "json:msg"
256
-}
257
-
258
-func LoadErrMsgConfig(dataFile string) *ErrMsgConfig {
259
-	var config ErrMsgConfig
260
-	_, filename, _, _ := runtime.Caller(1)
261
-	datapath := path.Join(path.Dir(filename), dataFile)
262
-	config_file, err := os.Open(datapath)
263
-	if err != nil {
264
-		emit("Failed to open config file '%s': %s\n", datapath, err)
265
-		return &config
266
-	}
267
-	fi, _ := config_file.Stat()
268
-	buffer := make([]byte, fi.Size())
269
-	_, err = config_file.Read(buffer)
270
-	buffer, err = StripComments(buffer) //去掉注释
271
-	if err != nil {
272
-		emit("Failed to strip comments from json: %s\n", err)
273
-		return &config
274
-	}
275
-	buffer = []byte(os.ExpandEnv(string(buffer))) //特殊
276
-	err = json.Unmarshal(buffer, &config)         //解析json格式数据
277
-	if err != nil {
278
-		emit("Failed unmarshalling json: %s\n", err)
279
-		return &config
280
-	}
281
-	return &config
282
-}
283
-
284
-func emit(msgfmt string, args ...interface{}) {
285
-	log.Printf(msgfmt, args...)
286
-}
287
-
288
-func StripComments(data []byte) ([]byte, error) {
289
-	data = bytes.Replace(data, []byte("\r"), []byte(""), 0) // Windows
290
-	lines := bytes.Split(data, []byte("\n"))                //split to muli lines
291
-	filtered := make([][]byte, 0)
292
-
293
-	for _, line := range lines {
294
-		match, err := regexp.Match(`^\s*#`, line)
295
-		if err != nil {
296
-			return nil, err
297
-		}
298
-		if !match {
299
-			filtered = append(filtered, line)
300
-		}
301
-	}
302
-
303
-	return bytes.Join(filtered, []byte("\n")), nil
304
-}

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

@@ -1,193 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"github.com/astaxie/beego"
5
-)
6
-
7
-// 平板端路由,以 /m/api 为前缀
8
-func MobileAPIControllersRegisterRouters() {
9
-	beego.Router("/m/api/login/pwd", &LoginAPIController{}, "post:LoginByPwd")
10
-
11
-	// beego.Router("/m/api/test", &DialysisTestAPIController{}, "get:Test")
12
-	beego.Router("/m/api/savebloodpressure", &CheckWeightApiController{}, "Post:SaveBloodPressure")
13
-	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14
-	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
15
-	beego.Router("/m/api/setsynctime", &CheckWeightApiController{}, "get:SetSyncTime")
16
-	beego.Router("/m/api/getschedulepatient", &CheckWeightApiController{}, "get:GetPatientListForSchedules")
17
-	beego.Router("/m/api/getschedulepatientfind", &CheckWeightApiController{}, "get:GetPatientListForSchedulesFind")
18
-	beego.Router("/m/api/getpatientinfo", &CheckWeightApiController{}, "get:GetPatientListById")
19
-	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
20
-	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")
21
-	beego.Router("/m/api/scheduals", &DialysisAPIController{}, "get:Scheduals")
22
-	beego.Router("/m/api/waiting_scheduals", &DialysisAPIController{}, "get:WaitingScheduals")
23
-
24
-	beego.Router("/m/api/solution/create", &PatientApiController{}, "Post:CreateDialysisSolution")
25
-	beego.Router("/m/api/solution/edit", &PatientApiController{}, "Post:EditDialysisSolution")
26
-	beego.Router("/m/api/assessmentbefore/commit", &PatientApiController{}, "Post:EditAssessmentBeforeDislysis")
27
-
28
-	beego.Router("/m/api/dialysisglobalconfig", &DialysisAPIController{}, "Get:GetDialysisGlobalConfig")
29
-	beego.Router("/m/api/dialysis/record", &DialysisAPIController{}, "get:DialysisRecord")
30
-
31
-	beego.Router("/m/api/dialysis/dialysisPrescription", &DialysisAPIController{}, "post:PostDialysisPrescription")
32
-	beego.Router("/m/api/dialysis/treatmentSummary", &DialysisAPIController{}, "post:PostAtreatmentInfo")
33
-	beego.Router("/m/api/dialysis/doublecheck", &DialysisAPIController{}, "post:PostDoubleCheck")
34
-	beego.Router("/m/api/dialysis/acceptsAssessment", &DialysisAPIController{}, "post:PostAcceptsAssessment")
35
-	beego.Router("/m/api/dialysis/assessmentAfterDislysis", &DialysisAPIController{}, "post:PostAssessmentAfterDislysis")
36
-	beego.Router("/m/api/dialysis/finish", &DialysisAPIController{}, "post:Finish")
37
-	beego.Router("/m/api/dialysis/allzone", &DialysisAPIController{}, "get:GetAllZone")
38
-	beego.Router("/m/api/dialysis/patients", &DialysisAPIController{}, "get:GetSchedualPatientsList")
39
-	beego.Router("/m/api/startOrder/edit", &DialysisAPIController{}, "post:ModifyStartDialysisOrder")
40
-	beego.Router("/m/api/finishOrder/edit", &DialysisAPIController{}, "post:ModifyFinishDialysisOrder")
41
-
42
-	beego.Router("/m/api/advice/create", &PatientApiController{}, "Post:CreateDoctorAdvice")
43
-	beego.Router("/m/api/advice/edit", &PatientApiController{}, "Put:EditDoctorAdvice")
44
-	beego.Router("/m/api/advice/stop", &PatientApiController{}, "Post:StopDoctorAdvice")
45
-	beego.Router("/m/api/advice/creategroup", &PatientApiController{}, "Post:CreateGroupAdvice")
46
-	beego.Router("/m/api/advice/group/modify_starttime", &PatientApiController{}, "Post:ModifyAdviceGroupStartTime")
47
-	beego.Router("/m/api/advice/delete", &PatientApiController{}, "Delete:DeleteDoctorAdvice")
48
-	beego.Router("/m/api/advice/exec", &PatientApiController{}, "Post:ExecDoctorAdvice")
49
-	beego.Router("/m/api/advice/exec/modify", &PatientApiController{}, "Post:ModifyExecDoctorAdvice")
50
-
51
-	beego.Router("/m/api/project/exec", &PatientApiController{}, "Post:ExecProject")
52
-	beego.Router("/m/api/project/check", &PatientApiController{}, "Post:CheckProject")
53
-
54
-	//beego.Router("/m/api/advice/ex/**/ec/modify", &PatientApiController{}, "Post:ModifyExecDoctorAdvice")
55
-
56
-	beego.Router("/m/api/advice/check", &PatientApiController{}, "Post:CheckDoctorAdvice")
57
-	beego.Router("/m/api/patient/info", &PatientApiController{}, "Get:GetPatientInfoWithDiseases")
58
-
59
-	beego.Router("/m/api/monitor/add", &DialysisAPIController{}, "post:AddMonitorRecord")
60
-	beego.Router("/m/api/monitor/edit", &DialysisAPIController{}, "post:EditMonitorRecord")
61
-	beego.Router("/m/api/monitor/delete", &DialysisAPIController{}, "post:DeleteMonitor")
62
-
63
-	beego.Router("/m/api/accepts/get", &DialysisAPIController{}, "Get:GetAcceptsAssessment")
64
-
65
-	beego.Router("/m/api/patient/education", &PatientApiController{}, "get:GetPatientEducation")
66
-	beego.Router("/m/api/patients/schedules", &PatientApiController{}, "Get:GetPatientSchedulesList")
67
-	beego.Router("/m/api/patients/record", &PatientApiController{}, "Get:GetRecords")
68
-	beego.Router("/m/api/patients/solutions", &PatientApiController{}, "Get:GetPatientDialysisSolutionList")
69
-	beego.Router("/m/api/patients/doctoradvices", &PatientApiController{}, "Get:GetDoctorAdvices")
70
-
71
-	beego.Router("/m/api/monitor", &PatientApiController{}, "Get:GetPatientMonitor")
72
-	beego.Router("/m/api/monitor/patient", &PatientApiController{}, "get:SearchMonitorPatient")
73
-
74
-	beego.Router("/m/api/alldoctors", &DoctorsApiController{}, "Get:GetAllDoctorAndNurse")
75
-	beego.Router("/m/api/admin/users", &DoctorsApiController{}, "Get:GetAllAdminUsers")
76
-
77
-	beego.Router("/m/api/solution", &DialysisAPIController{}, "Post:PostSolution")
78
-
79
-	beego.Router("/m/api/schedule/advices", &DoctorAdviceAPIController{}, "Get:ScheduleAdvices")
80
-
81
-	beego.Router("/m/api/dialysis/start", &DialysisAPIController{}, "Post:StartDialysis")
82
-
83
-	beego.Router("/m/api/getelectronicsignature", &AdminUserApiController{}, "Get:GetAdminUserElectronicSignature")
84
-	beego.Router("/m/api/savelectronicsignature", &AdminUserApiController{}, "Post:SaveAdminUserElectronicSignature")
85
-	beego.Router("/m/api/my", &AdminUserApiController{}, "Get:GetMyInfo")
86
-
87
-	beego.Router("/m/api/qiniu/uptoken", &QiNiuApiController{}, "get:GetQNUpToken")
88
-
89
-	beego.Router("/m/api/getadviceconfigs", &DoctorAdviceAPIController{}, "Get:GetAdviceConfigs")
90
-
91
-	beego.Router("/m/api/inspection/reference", &CheckApiController{}, "Get:GetInspectionReference")
92
-	beego.Router("/m/api/inspection/list", &CheckApiController{}, "Get:GetInspections")
93
-
94
-	beego.Router("/m/api/print/dialysisorder", &PatientApiController{}, "Get:GetPrintDialysisOrder")
95
-
96
-	beego.Router("/m/api/schedule/urgentinit", &DialysisAPIController{}, "Get:UrgentScheduleInitData")
97
-	beego.Router("/m/api/schedule/urgentadd", &DialysisAPIController{}, "Post:AddUrgentSchedule")
98
-
99
-	beego.Router("/m/api/dialysis/sign", &DialysisAPIController{}, "Post:PostSignInfo")
100
-
101
-	beego.Router("/m/api/monitor/get", &DialysisAPIController{}, "Get:GetLastMonitorRecord")
102
-	beego.Router("/m/api/monitor/gettodaylast", &DialysisAPIController{}, "Get:GetLastMonitorRecordTody")
103
-
104
-	beego.Router("/m/api/newadvice/delete", &PatientApiController{}, "Delete:DelDoctorAdvice")
105
-
106
-	beego.Router("/m/api/delete/subadvice", &PatientApiController{}, "Delete:DelSubDoctorAdvice")
107
-
108
-	beego.Router("/m/api/advice/unread", &PatientApiController{}, "Get:GetAdviceUnReadMessage")
109
-	beego.Router("/m/api/patients/search", &PatientApiController{}, "Post:GetPatientsByKeyWord")
110
-
111
-	beego.Router("/m/api/warehouse/query", &StockApiController{}, "get:GetWarehouse")
112
-
113
-	beego.Router("/m/api/dialysis/advice_remind", &DialysisAPIController{}, "Get:GetLongAdvice")
114
-	beego.Router("/m/api/dialysis/advice_remind/one", &DialysisAPIController{}, "Get:GetLongAdviceOne")
115
-	beego.Router("/m/api/advice_remind/create", &DialysisAPIController{}, "Post:CreateRemindDoctorAdvice")
116
-	beego.Router("/m/api/dryweight/commit", &DialysisAPIController{}, "Post:UploadDryWeight")
117
-
118
-	beego.Router("/m/api/solution/get", &DialysisAPIController{}, "Get:GetSolution")
119
-
120
-	beego.Router("/m/api/schedule/get", &DialysisAPIController{}, "Get:GetSchedule")
121
-
122
-	beego.Router("/m/api/getPatientid", &DialysisAPIController{}, "Get:GetPatientId")
123
-
124
-	beego.Router("/m/api/patient/search", &PatientApiController{}, "Get:GetSearchPatient")
125
-
126
-	beego.Router("/m/api/dialysis/schedule", &DialysisAPIController{}, "Get:Scheduals")
127
-
128
-	beego.Router("/m/api/doctoradvice/get", &DialysisAPIController{}, "Get:GetLastOrNextDoctorAdvice")
129
-
130
-	beego.Router("/m/api/dialysisbeforeprepare/create", &DialysisAPIController{}, "Post:CreateConsumables")
131
-	beego.Router("/m/api/dialysisbeforeprepare/edit", &DialysisAPIController{}, "Post:EditConsumables")
132
-
133
-	beego.Router("/m/api/stockout/create", &DialysisAPIController{}, "Post:CreateStockOutInfo")
134
-
135
-	beego.Router("/m/api/otherstockout/create", &DialysisAPIController{}, "Post:CreateOtherStockOutInfo")
136
-
137
-	beego.Router("/m/api/dialysisgoods/get", &DialysisAPIController{}, "Get:GetDialysisGoods")
138
-	beego.Router("/m/api/goodstatistics/get", &DialysisAPIController{}, "Get:GetDialysisGoodsStatistics")
139
-	beego.Router("/m/api/stockingood/get", &DialysisAPIController{}, "Get:GetStockInGoodInfo")
140
-
141
-	beego.Router("/m/api/drug/get", &DialysisAPIController{}, "Get:GetAllDrug")
142
-
143
-	beego.Router("/m/api/department/get", &DialysisAPIController{}, "Get:GetDepartment")
144
-
145
-	beego.Router("/m/api/getmobileprintstockgood", &DialysisAPIController{}, "Get:GetMobilePrintStockGood")
146
-
147
-	//批量删除监测
148
-	beego.Router("/m/api/batchdeletemonitor", &DialysisAPIController{}, "Get:BatchDeleteMonitor")
149
-	//获取单个患者1年的透析日期
150
-	beego.Router("/m/api/getPatientDialysisRecord", &DialysisAPIController{}, "Get:GetPatientDialysisRecordList")
151
-	//批量删除医嘱
152
-	beego.Router("/m/api/batchdeleteadvice", &DialysisAPIController{}, "Get:BathDeleteAdviceList")
153
-	//加减耗材数量
154
-	beego.Router("/m/api/updateautoreducedetail", &DialysisAPIController{}, "Get:UpdateAutoReduceDetail")
155
-	//删除数据
156
-	beego.Router("/m/api/deleteautoreducedetail", &DialysisAPIController{}, "Get:DeleteAutoReduceDetail")
157
-
158
-	//医嘱批量核对
159
-	beego.Router("/m/api/batchadvicecheck", &DialysisAPIController{}, "Get:BatchAdviceCheck")
160
-
161
-	//医嘱批量执行
162
-	beego.Router("/m/api/batchadviceexecution", &DialysisAPIController{}, "Get:BatchAdviceExecution")
163
-
164
-	beego.Router("/m/api/updatestockgoods", &DialysisAPIController{}, "Get:UpdateStockGoods")
165
-
166
-	//beego.Router("/m/api/getmobileschedulelist", &DialysisAPIController{}, "Get:GetMobileScheduleList")
167
-
168
-	beego.Router("/m/api/getrolelist", &DialysisAPIController{}, "Get:GetRoleList")
169
-
170
-	beego.Router("/m/api/savepatientsign", &DialysisAPIController{}, "Post:SavePatientSign")
171
-	beego.Router("/m/api/getpatientsign", &DialysisAPIController{}, "Get:GetPatientSign")
172
-
173
-	beego.Router("/m/api/patient/getschedulebypatient", &DialysisAPIController{}, "Get:GetScheduleByPatient")
174
-
175
-	beego.Router("/m/api/getdialysisrecordeorder", &DialysisAPIController{}, "Get:GetDialysisRecordOrder")
176
-
177
-	beego.Router("/m/api/getdialysisrecordeorder", &DialysisAPIController{}, "Get:GetDialysisRecordOrder")
178
-	beego.Router("/m/api/checksch/get", &DialysisAPIController{}, "Get:CheckSchedule")
179
-
180
-	//beego.Router("/m/api/getscheduletypebyidlist",&DialysisAPIController{},"Get:GetScheduleTypeByIdList")
181
-
182
-	beego.Router("/m/api/getscheduletypebyidlist", &DialysisAPIController{}, "Get:GetScheduleTypeByIdList")
183
-
184
-	beego.Router("/m/api/savepatientpicture", &DialysisAPIController{}, "Get:SavePatientPicture")
185
-
186
-	beego.Router("/m/api/exectionmobileadvice", &DialysisAPIController{}, "Get:ExectionMobileAdvice")
187
-
188
-	beego.Router("/m/api/settlemobileadvice", &DialysisAPIController{}, "Get:GetSettleMobileAdvice")
189
-
190
-	beego.Router("/m/api/checkmobileadvice", &DialysisAPIController{}, "Get:GetCheckMobileAdvice")
191
-
192
-	beego.Router("/m/api/getnewdoctorlisttoday", &DialysisAPIController{}, "Get:GetNewDoctorListToday")
193
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 4613
controllers/mobile_api_controllers/patient_api_controller.go


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

@@ -1,28 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-	"fmt"
7
-)
8
-
9
-type QiNiuApiController struct {
10
-	MobileBaseAPIAuthController
11
-}
12
-
13
-func (c *QiNiuApiController) GetQNUpToken() {
14
-	redisClient := service.RedisClient()
15
-	defer redisClient.Close()
16
-
17
-	token, err := redisClient.Get("qn_token").Result()
18
-	if err != nil {
19
-		defer fmt.Println(err)
20
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGetQiniuUpToken)
21
-		return
22
-	}
23
-
24
-	c.ServeSuccessJSON(map[string]interface{}{
25
-		"uptoken": token,
26
-	})
27
-	return
28
-}

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

@@ -1,73 +0,0 @@
1
-package mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-	"github.com/astaxie/beego"
7
-)
8
-
9
-type StockApiController struct {
10
-	MobileBaseAPIAuthController
11
-}
12
-
13
-func (this *StockApiController) GetWarehouse() {
14
-	adminInfo := this.GetMobileAdminUserInfo()
15
-	types, _ := this.GetInt64("type_id", 0)
16
-	var type_id int64
17
-	switch types {
18
-	case 1:
19
-		type_id, _ = beego.AppConfig.Int64("niprocart")
20
-
21
-		break
22
-	case 2:
23
-		type_id, _ = beego.AppConfig.Int64("jms")
24
-		break
25
-	case 3:
26
-		type_id, _ = beego.AppConfig.Int64("fistula_needle_set")
27
-
28
-		break
29
-	case 4:
30
-		type_id, _ = beego.AppConfig.Int64("fistula_needle_set_16")
31
-
32
-		break
33
-	case 5:
34
-		type_id, _ = beego.AppConfig.Int64("hemoperfusion")
35
-
36
-		break
37
-	case 6:
38
-		type_id, _ = beego.AppConfig.Int64("dialyser_sterilised")
39
-		break
40
-	case 7:
41
-		type_id, _ = beego.AppConfig.Int64("filtryzer")
42
-		break
43
-	case 8:
44
-		type_id, _ = beego.AppConfig.Int64("dialyzers")
45
-
46
-		break
47
-	case 9:
48
-		type_id, _ = beego.AppConfig.Int64("injector")
49
-		break
50
-	case 10:
51
-		type_id, _ = beego.AppConfig.Int64("bloodlines")
52
-		break
53
-	case 11:
54
-		type_id, _ = beego.AppConfig.Int64("tubingHemodialysis")
55
-		break
56
-	case 12:
57
-		type_id, _ = beego.AppConfig.Int64("package")
58
-		break
59
-	case 13:
60
-		type_id, _ = beego.AppConfig.Int64("aliquid")
61
-		break
62
-	}
63
-
64
-	info, err := service.FindWarehouseInfoByGoodType(type_id, adminInfo.Org.Id)
65
-	if err != nil {
66
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
67
-		return
68
-	}
69
-	this.ServeSuccessJSON(map[string]interface{}{
70
-		"list": info,
71
-	})
72
-
73
-}

+ 0 - 252
controllers/new_mobile_api_controllers/dialysis_parameter_api_controller.go Просмотреть файл

@@ -1,252 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/service"
7
-	"fmt"
8
-	"github.com/jinzhu/gorm"
9
-	"time"
10
-)
11
-
12
-type DialysisParamerterApiController struct {
13
-	mobile_api_controllers.MobileBaseAPIAuthController
14
-}
15
-
16
-func (this *DialysisParamerterApiController) GetAllMobileZon() {
17
-
18
-	adminUserInfo := this.GetMobileAdminUserInfo()
19
-	orgid := adminUserInfo.Org.Id
20
-	err, zone := service.GetAllDeviceZone(orgid)
21
-	if err == nil {
22
-		this.ServeSuccessJSON(map[string]interface{}{
23
-			"zone": zone,
24
-		})
25
-	}
26
-}
27
-
28
-func (this *DialysisParamerterApiController) GetMobileDialysisParameters() {
29
-	timeLayout := "2006-01-02"
30
-	loc, _ := time.LoadLocation("Local")
31
-	adminUserInfo := this.GetMobileAdminUserInfo()
32
-	orgid := adminUserInfo.Org.Id
33
-	keywords := this.GetString("keyword")
34
-	start_time := this.GetString("start_time")
35
-	limit, _ := this.GetInt64("limit")
36
-	page, _ := this.GetInt64("page")
37
-	partitionType, _ := this.GetInt64("partitionType")
38
-	scheduleType, _ := this.GetInt64("scheduleType")
39
-
40
-	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
41
-	if len(keywords) > 0 {
42
-
43
-		//dialysisSchedule, err, total := service.GetDialysisParametersByKeyword(orgid, keywords, scheduleType, partitionType, page, limit, theTime.Unix())
44
-		//查询今日排班的病人
45
-		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
46
-		var vlist []interface{}
47
-		var elist []interface{}
48
-		for _, item := range patient {
49
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
50
-			vlist = append(vlist, prescription)
51
-			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
52
-			elist = append(elist, dialysis)
53
-			if err == nil {
54
-				this.ServeSuccessJSON(map[string]interface{}{
55
-					//"schedule":     dialysisSchedule,
56
-					//"total":        total,
57
-					"prescription": vlist,
58
-					"dialysbefor":  elist,
59
-					"patient":      patient,
60
-				})
61
-			} else {
62
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
63
-			}
64
-		}
65
-	} else {
66
-		dialysisSchedule, err, total := service.GetDialysisParameter(orgid, theTime.Unix(), scheduleType, partitionType, page, limit)
67
-		//查询今日排班的病人
68
-		patient, err := service.GetDialysisTodaySchedulePatient(orgid, theTime.Unix(), page, limit, keywords, scheduleType, partitionType)
69
-		var vlist []interface{}
70
-		var elist []interface{}
71
-		for _, item := range patient {
72
-			prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgid, theTime.Unix())
73
-			vlist = append(vlist, prescription)
74
-			dialysis, _ := service.GetAssessmentBeforDialysisByStartime(item.PatientId, orgid, theTime.Unix())
75
-			elist = append(elist, dialysis)
76
-		}
77
-		if err == nil {
78
-			this.ServeSuccessJSON(map[string]interface{}{
79
-				"schedule":     dialysisSchedule,
80
-				"total":        total,
81
-				"prescription": vlist,
82
-				"dialysbefor":  elist,
83
-				"patient":      patient,
84
-			})
85
-		} else {
86
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
87
-		}
88
-	}
89
-}
90
-
91
-func (this *DialysisParamerterApiController) GetMobileWareHouseOutList() {
92
-
93
-	timeLayout := "2006-01-02"
94
-	loc, _ := time.LoadLocation("Local")
95
-	start_time := this.GetString("start_time")
96
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
97
-	end_time := this.GetString("end_time")
98
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
99
-	fmt.Println(start_time, end_time)
100
-	orgId := this.GetMobileAdminUserInfo().Org.Id
101
-	wareoutlist, err := service.GetWareHouseOutList(startime.Unix(), endtime.Unix(), orgId)
102
-	count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
103
-	if err == nil {
104
-		this.ServeSuccessJSON(map[string]interface{}{
105
-			"wareoutlist": wareoutlist,
106
-			"count":       count,
107
-		})
108
-	}
109
-
110
-}
111
-
112
-func (this *DialysisParamerterApiController) GetAllMobileMaterial() {
113
-
114
-	timeLayout := "2006-01-02"
115
-	loc, _ := time.LoadLocation("Local")
116
-	start_time := this.GetString("startime")
117
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
118
-	fmt.Println("开始时间", startime)
119
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 23:59:59", loc)
120
-	fmt.Println("结束时间", endtime)
121
-	adminUserInfo := this.GetMobileAdminUserInfo()
122
-	orgId := adminUserInfo.Org.Id
123
-	material, err := service.GetAllMaterial(startime.Unix(), endtime.Unix(), orgId)
124
-	if err == nil {
125
-		this.ServeSuccessJSON(map[string]interface{}{
126
-			"material": material,
127
-		})
128
-	}
129
-}
130
-
131
-func (this *DialysisParamerterApiController) GetMobileCollectList() {
132
-
133
-	timeLayout := "2006-01-02"
134
-	loc, _ := time.LoadLocation("Local")
135
-	limit, _ := this.GetInt64("limit")
136
-	fmt.Println(limit)
137
-	page, _ := this.GetInt64("page")
138
-	fmt.Println("page", page)
139
-	partitiontype, _ := this.GetInt64("partitionType")
140
-	fmt.Println(partitiontype)
141
-	scheduletype, _ := this.GetInt64("scheduleType")
142
-	fmt.Println(scheduletype)
143
-	start_time := this.GetString("start_time")
144
-	fmt.Println(start_time)
145
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
146
-	orgId := this.GetMobileAdminUserInfo().Org.Id
147
-	keyword := this.GetString("keyword")
148
-	//获取透析参数数据
149
-	//schedule, err, _ := service.GetCollectList(limit, page, partitiontype, scheduletype, startime.Unix(), orgId, keyword)
150
-	//查询今日排班的病人
151
-	patient, err := service.GetDialysisTodaySchedulePatient(orgId, startime.Unix(), page, limit, keyword, scheduletype, partitiontype)
152
-	var vlist []interface{}
153
-	var clist []interface{}
154
-	for _, item := range patient {
155
-		prescription, _ := service.GetDialysisPrescriptionList(item.PatientId, orgId, startime.Unix())
156
-		vlist = append(vlist, prescription)
157
-	}
158
-	_, errors := service.FindStockOutByIsSys(orgId, 1, startime.Unix())
159
-
160
-	goodTypes, _ := service.FindAllGoodType(orgId) //two, err, i := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
161
-
162
-	if errors == gorm.ErrRecordNotFound {
163
-		dialysisGoods, _, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
164
-		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
165
-			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, orgId, startime.Unix())
166
-			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, orgId, startime.Unix())
167
-			item.LastAutomaticReduceDetail = goodUser
168
-			item.LastDialysisBeforePrepare = lastGoodUserDetial
169
-		}
170
-		this.ServeSuccessJSON(map[string]interface{}{
171
-			"dialysis_goods": dialysisGoods,
172
-			"good_type":      goodTypes,
173
-			"total":          total,
174
-			//"schedule":       schedule,
175
-			"prescription": vlist,
176
-			"patient":      patient,
177
-		})
178
-		return
179
-
180
-	} else if err == nil {
181
-		//获取当天排班的每个患者的库存使用情况
182
-		dialysisGoods, err, total := service.PCGetDialysisGoodsTwo(orgId, startime.Unix(), scheduletype, partitiontype, page, limit, keyword)
183
-		for _, item := range dialysisGoods { //获取当天排班的每个患者的最后日期的库存使用情况
184
-			goodUser, _ := service.GetLastDialysisGoods(item.PatientId, orgId, startime.Unix())
185
-			lastGoodUserDetial, _ := service.GetLastDialysisBeforePrepare(item.PatientId, orgId, startime.Unix())
186
-
187
-			fmt.Println(goodUser)
188
-			fmt.Println(lastGoodUserDetial)
189
-
190
-			item.LastAutomaticReduceDetail = goodUser
191
-			item.LastDialysisBeforePrepare = lastGoodUserDetial
192
-		}
193
-		if err == nil {
194
-			this.ServeSuccessJSON(map[string]interface{}{
195
-				"dialysis_goods": dialysisGoods,
196
-				"good_type":      goodTypes,
197
-				"total":          total,
198
-				//"schedule":       schedule,
199
-				//"consumables":    consumables,
200
-				"prescription": vlist,
201
-				"reducelist":   clist,
202
-			})
203
-			return
204
-
205
-		} else {
206
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
207
-			return
208
-		}
209
-	} else if err != nil {
210
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
211
-		return
212
-
213
-	}
214
-	//if err == nil {
215
-	//	this.ServeSuccessJSON(map[string]interface{}{
216
-	//		"schedule":     schedule,
217
-	//		"total":        total,
218
-	//		"consumables":  consumables,
219
-	//		"prescription": vlist,
220
-	//		"reducelist":   clist,
221
-	//	})
222
-	//}
223
-}
224
-
225
-func (this *DialysisParamerterApiController) GetMobileGatherList() {
226
-
227
-	timeLayout := "2006-01-02"
228
-	loc, _ := time.LoadLocation("Local")
229
-	start_time := this.GetString("start_time")
230
-	end_time := this.GetString("end_time")
231
-	startime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
232
-	endtime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
233
-	adminUserInfo := this.GetMobileAdminUserInfo()
234
-	orgId := adminUserInfo.Org.Id
235
-	fmt.Println("开始时间", startime)
236
-	fmt.Println("结束时间", endtime)
237
-	warehouselist, err := service.GetWareHouseOutList(startime.Unix(), endtime.Unix(), orgId)
238
-
239
-	//获取透析耗材数据
240
-	consumables, err := service.GetDialysisConsumables(startime.Unix(), endtime.Unix(), orgId)
241
-
242
-	//统计抗凝剂数据
243
-	count, err := service.GetAnticoagulantCount(startime.Unix(), endtime.Unix(), orgId)
244
-
245
-	if err == nil {
246
-		this.ServeSuccessJSON(map[string]interface{}{
247
-			"warehouselist": warehouselist,
248
-			"consumables":   consumables,
249
-			"count":         count,
250
-		})
251
-	}
252
-}

+ 0 - 15
controllers/new_mobile_api_controllers/dialysis_parameter_api_router.go Просмотреть файл

@@ -1,15 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"github.com/astaxie/beego"
5
-)
6
-
7
-func DialysisParameterApiControllersRegisterRouters() {
8
-
9
-	beego.Router("/m/api/getallmobilezone", &DialysisParamerterApiController{}, "Get:GetAllMobileZon")
10
-	beego.Router("/m/api/getmobiledialysisparameters", &DialysisParamerterApiController{}, "Get:GetMobileDialysisParameters")
11
-	beego.Router("/m/api/getmobilewarehouseoutlist", &DialysisParamerterApiController{}, "Get:GetMobileWareHouseOutList")
12
-	beego.Router("/m/api/getallmobilematerial", &DialysisParamerterApiController{}, "Get:GetAllMobileMaterial")
13
-	beego.Router("/m/api/getmobilecollectlist", &DialysisParamerterApiController{}, "Get:GetMobileCollectList")
14
-	beego.Router("/m/api/getmobilegatherlist", &DialysisParamerterApiController{}, "Get:GetMobileGatherList")
15
-}

+ 0 - 7
controllers/new_mobile_api_controllers/dialysis_process_api_controller.go Просмотреть файл

@@ -1,7 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import "XT_New/controllers/mobile_api_controllers"
4
-
5
-type DialysisProcessApiController struct {
6
-	mobile_api_controllers.MobileBaseAPIController
7
-}

+ 0 - 260
controllers/new_mobile_api_controllers/forget_password_controller.go Просмотреть файл

@@ -1,260 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"XT_New/utils"
9
-	"encoding/json"
10
-	"fmt"
11
-	"github.com/astaxie/beego"
12
-	"io/ioutil"
13
-	"net/http"
14
-	"net/url"
15
-	"strconv"
16
-)
17
-
18
-type ForgetPwdController struct {
19
-	mobile_api_controllers.MobileBaseAPIController
20
-}
21
-
22
-func (this *ForgetPwdController) ModifyPassword() {
23
-	mobile := this.GetString("mobile")
24
-	code := this.GetString("code")
25
-	password := this.GetString("password")
26
-	checkErr := this.checkParams(mobile, code, password)
27
-	if checkErr != nil {
28
-		this.ServeFailJSONWithSGJErrorCode(checkErr.Code)
29
-		return
30
-	}
31
-
32
-	adminUser, _ := service.GetValidAdminUserByMobileReturnErr(mobile)
33
-
34
-	modifyErr := service.ModifyPassword(adminUser.Id, password)
35
-	if modifyErr != nil {
36
-		utils.ErrorLog("修改mobile=%v的用户的密码时失败: %v", mobile, modifyErr)
37
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
38
-		return
39
-	} else {
40
-		// 修改成功后验证码就要使其失效
41
-		redisClient := service.RedisClient()
42
-		defer redisClient.Close()
43
-		redisClient.Del("code_msg_" + mobile)
44
-
45
-		ip := utils.GetIP(this.Ctx.Request)
46
-		ssoDomain := beego.AppConfig.String("sso_domain")
47
-		api := ssoDomain + "/m/login/pwd"
48
-		values := make(url.Values)
49
-		values.Set("mobile", mobile)
50
-		values.Set("password", password)
51
-		values.Set("app_type", "3")
52
-		values.Set("ip", ip)
53
-		resp, requestErr := http.PostForm(api, values)
54
-
55
-		if requestErr != nil {
56
-			utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
57
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
58
-			return
59
-		}
60
-		defer resp.Body.Close()
61
-		body, ioErr := ioutil.ReadAll(resp.Body)
62
-		if ioErr != nil {
63
-			utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
64
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
65
-			return
66
-		}
67
-		var respJSON map[string]interface{}
68
-		utils.InfoLog(string(body))
69
-		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
70
-			utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
71
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
72
-			return
73
-		}
74
-
75
-		if respJSON["state"].(float64) != 1 {
76
-			msg := respJSON["msg"].(string)
77
-			utils.ErrorLog("SSO登录接口请求失败: %v", msg)
78
-			if int(respJSON["code"].(float64)) == 609 {
79
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
80
-				return
81
-			}
82
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
83
-			return
84
-		} else {
85
-			utils.SuccessLog("SSO登录成功")
86
-			// 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
87
-			userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
88
-			userJSONBytes, _ := json.Marshal(userJSON)
89
-			var adminUser models.AdminUser
90
-			if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
91
-				utils.ErrorLog("解析管理员失败:%v", err)
92
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
93
-				return
94
-			}
95
-
96
-			var org models.Org
97
-			if respJSON["data"].(map[string]interface{})["org"] != nil {
98
-				orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
99
-				orgJSONBytes, _ := json.Marshal(orgJSON)
100
-				if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
101
-					utils.ErrorLog("解析机构失败:%v", err)
102
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
103
-					return
104
-				}
105
-			}
106
-
107
-			var app models.OrgApp
108
-
109
-			if respJSON["data"].(map[string]interface{})["app"] != nil {
110
-				appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
111
-				appJSONBytes, _ := json.Marshal(appJSON)
112
-				if err := json.Unmarshal(appJSONBytes, &app); err != nil {
113
-					utils.ErrorLog("解析应用失败:%v", err)
114
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
115
-					return
116
-				}
117
-			}
118
-
119
-			var appRole models.App_Role
120
-
121
-			if respJSON["data"].(map[string]interface{})["app_role"] != nil {
122
-				appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
123
-				appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
124
-				if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
125
-					utils.ErrorLog("解析AppRole失败:%v", err)
126
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
127
-					return
128
-				}
129
-			}
130
-
131
-			var subscibe models.ServeSubscibe
132
-			if respJSON["data"].(map[string]interface{})["subscibe"] != nil {
133
-				subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
134
-				subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
135
-				if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
136
-					utils.ErrorLog("解析Subscibe失败:%v", err)
137
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
138
-					return
139
-				}
140
-
141
-			}
142
-			//service.GetOrgSubscibeState(&subscibe)
143
-			templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
144
-
145
-			mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
146
-				AdminUser:    &adminUser,
147
-				Org:          &org,
148
-				App:          &app,
149
-				AppRole:      &appRole,
150
-				Subscibe:     &subscibe,
151
-				TemplateInfo: &templateInfo,
152
-			}
153
-			//设置seesion
154
-			this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
155
-
156
-			//设置cookie
157
-			mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
158
-			token := utils.GenerateLoginToken(mobile)
159
-			expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
160
-			this.Ctx.SetCookie("token_cookie", token, expiration, "/")
161
-
162
-			var configList interface{}
163
-			var dict_configList interface{}
164
-
165
-			var FiledList []*models.FiledConfig
166
-
167
-			if org.Id > 0 {
168
-				configList, _ = service.GetConfigList(org.Id)
169
-				dict_configList, _ = service.GetDictConfigList(org.Id)
170
-
171
-				FiledList, _ = service.FindFiledByOrgId(org.Id)
172
-			}
173
-			if len(FiledList) == 0 {
174
-				var err error
175
-				if org.Id > 0 {
176
-					err = service.BatchInsertFiledConfig(org.Id)
177
-					if err == nil {
178
-						FiledList, _ = service.FindFiledByOrgId(org.Id)
179
-					} else {
180
-						utils.ErrorLog("字段批量插入失败:%v", err)
181
-					}
182
-				} else {
183
-					FiledList = make([]*models.FiledConfig, 0)
184
-				}
185
-			}
186
-
187
-			if org.Id > 0 {
188
-				//产寻该机构是否有收缩压和舒张压
189
-				pressure, err := service.GetDefaultSystolicPressure(org.Id)
190
-				fmt.Println(err)
191
-				if len(pressure) == 0 {
192
-					err = service.BathInsertQualityControlTwo(org.Id)
193
-				} else {
194
-					utils.ErrorLog("字段批量插入失败:%v", err)
195
-				}
196
-				major, requestErr := service.GetInspectionMajor(org.Id)
197
-				if len(major) == 0 {
198
-					QualityeList, err := service.FindQualityByOrgId(org.Id)
199
-					if len(QualityeList) == 0 {
200
-						err = service.BatchInsertQualityControl(org.Id)
201
-					} else {
202
-						utils.ErrorLog("字段批量插入失败:%v", err)
203
-					}
204
-
205
-					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
206
-					if len(InspectionList) == 0 {
207
-						err = service.BatchInspectionConfiguration(org.Id)
208
-					} else {
209
-						utils.ErrorLog("字段批量插入失败:%v", err)
210
-					}
211
-				} else {
212
-					utils.ErrorLog("字段批量插入失败:%v", requestErr)
213
-				}
214
-
215
-			}
216
-
217
-			this.ServeSuccessJSON(map[string]interface{}{
218
-				"admin": adminUser,
219
-				"user":  appRole,
220
-				"org":   org,
221
-				"template_info": map[string]interface{}{
222
-					"id":          templateInfo.ID,
223
-					"org_id":      templateInfo.OrgId,
224
-					"template_id": templateInfo.TemplateId,
225
-				},
226
-				"config_list":      configList,
227
-				"dict_config_list": dict_configList,
228
-
229
-				"filed_list": FiledList,
230
-			})
231
-		}
232
-
233
-		//this.ServeSuccessJSON(map[string]interface{}{
234
-		//	"msg":"修改成功",
235
-		//})
236
-		return
237
-	}
238
-}
239
-
240
-func (this *ForgetPwdController) checkParams(mobile string, code string, password string) *enums.SGJError {
241
-	if utils.CellPhoneRegexp().MatchString(mobile) == false {
242
-		return &enums.SGJError{Code: enums.ErrorCodeMobileFormat}
243
-	}
244
-	if len(code) == 0 {
245
-		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
246
-	}
247
-	if len(password) == 0 {
248
-		return &enums.SGJError{Code: enums.ErrorCodePasswordEmpty}
249
-	}
250
-	if service.IsMobileRegister(mobile) == false {
251
-		return &enums.SGJError{Code: enums.ErrorCodeMobileNotExit}
252
-	}
253
-	redisClient := service.RedisClient()
254
-	defer redisClient.Close()
255
-	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
256
-	if cache_code != code {
257
-		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
258
-	}
259
-	return nil
260
-}

+ 0 - 197
controllers/new_mobile_api_controllers/good_types.json Просмотреть файл

@@ -1,197 +0,0 @@
1
-{
2
-  "types": [
3
-    {
4
-      "id": 10000,
5
-      "type_code": "14000000",
6
-      "type_name": "穿刺针",
7
-      "remark": "",
8
-      "ctime": 0,
9
-      "mtime": 1568080321,
10
-      "creater": 0,
11
-      "modifier": 0,
12
-      "org_id": 0,
13
-      "status": 1,
14
-      "type": 1,
15
-      "number": 1,
16
-      "out_stock": 1
17
-    },
18
-    {
19
-      "id": 10001,
20
-      "type_code": "14000001",
21
-      "type_name": "透析器",
22
-      "remark": "",
23
-      "ctime": 0,
24
-      "mtime": 1568080335,
25
-      "creater": 0,
26
-      "modifier": 0,
27
-      "org_id": 0,
28
-      "status": 1,
29
-      "type": 1,
30
-      "number": 2,
31
-      "out_stock": 1,
32
-      "stock_attribute": 2,
33
-    },
34
-    {
35
-      "id": 10002,
36
-      "type_code": "14000002",
37
-      "type_name": "灌流器",
38
-      "remark": "",
39
-      "ctime": 0,
40
-      "mtime": 1568080349,
41
-      "creater": 0,
42
-      "modifier": 0,
43
-      "org_id": 0,
44
-      "status": 1,
45
-      "type": 1,
46
-      "number": 3,
47
-      "out_stock": 1,
48
-      "stock_attribute": 3,
49
-    },
50
-    {
51
-      "id": 10003,
52
-      "type_code": "14000003",
53
-      "type_name": "血路管",
54
-      "remark": "",
55
-      "ctime": 0,
56
-      "mtime": 1568080361,
57
-      "creater": 0,
58
-      "modifier": 0,
59
-      "org_id": 0,
60
-      "status": 1,
61
-      "type": 1,
62
-      "number": 4,
63
-      "out_stock": 1
64
-    },
65
-    {
66
-      "id": 10004,
67
-      "type_code": "14000004",
68
-      "type_name": "血滤补液管",
69
-      "remark": "",
70
-      "ctime": 0,
71
-      "mtime": 1568081853,
72
-      "creater": 0,
73
-      "modifier": 0,
74
-      "org_id": 0,
75
-      "status": 1,
76
-      "type": 1,
77
-      "number": 5,
78
-      "out_stock": 1
79
-    },
80
-    {
81
-      "id": 10005,
82
-      "type_code": "14000005",
83
-      "type_name": "注射器",
84
-      "remark": "",
85
-      "ctime": 0,
86
-      "mtime": 1568081870,
87
-      "creater": 0,
88
-      "modifier": 0,
89
-      "org_id": 13,
90
-      "status": 1,
91
-      "type": 1,
92
-      "number": 6,
93
-      "out_stock": 1
94
-    },
95
-    {
96
-      "id": 79,
97
-      "type_code": "14000006",
98
-      "type_name": "护理包(内瘘穿刺包)",
99
-      "remark": "",
100
-      "ctime": 0,
101
-      "mtime": 1559699564,
102
-      "creater": 0,
103
-      "modifier": 0,
104
-      "org_id": 0,
105
-      "status": 1,
106
-      "type": 1,
107
-      "number": 7,
108
-      "out_stock": 1
109
-    },
110
-    {
111
-      "id": 80,
112
-      "type_code": "14000007",
113
-      "type_name": "细菌过滤器",
114
-      "remark": "",
115
-      "ctime": 0,
116
-      "mtime": 1559699718,
117
-      "creater": 0,
118
-      "modifier": 0,
119
-      "org_id": 0,
120
-      "status": 1,
121
-      "type": 1,
122
-      "number": 8,
123
-      "out_stock": 1
124
-    },
125
-    {
126
-      "id": 81,
127
-      "type_code": "14000008",
128
-      "type_name": "血液透析干粉",
129
-      "remark": "",
130
-      "ctime": 0,
131
-      "mtime": 1559699621,
132
-      "creater": 0,
133
-      "modifier": 0,
134
-      "org_id": 0,
135
-      "status": 1,
136
-      "type": 1,
137
-      "number": 9,
138
-      "out_stock": 1
139
-    }, {
140
-      "id": 81,
141
-      "type_code": "14000009",
142
-      "type_name": "A液",
143
-      "remark": "",
144
-      "ctime": 0,
145
-      "mtime": 1559699621,
146
-      "creater": 0,
147
-      "modifier": 0,
148
-      "org_id": 0,
149
-      "status": 1,
150
-      "type": 1,
151
-      "number": 10,
152
-      "out_stock": 1
153
-    },{
154
-      "id": 81,
155
-      "type_code": "14000010",
156
-      "type_name": "B液",
157
-      "remark": "",
158
-      "ctime": 0,
159
-      "mtime": 1559699621,
160
-      "creater": 0,
161
-      "modifier": 0,
162
-      "org_id": 0,
163
-      "status": 1,
164
-      "type": 1,
165
-      "number": 11,
166
-      "out_stock": 1
167
-    },{
168
-      "id": 81,
169
-      "type_code": "14000011",
170
-      "type_name": "导管包",
171
-      "remark": "",
172
-      "ctime": 0,
173
-      "mtime": 1559699621,
174
-      "creater": 0,
175
-      "modifier": 0,
176
-      "org_id": 0,
177
-      "status": 1,
178
-      "type": 1,
179
-      "number": 12,
180
-      "out_stock": 1
181
-    },{
182
-      "id": 81,
183
-      "type_code": "14000012",
184
-      "type_name": "血液透析导管",
185
-      "remark": "",
186
-      "ctime": 0,
187
-      "mtime": 1559699621,
188
-      "creater": 0,
189
-      "modifier": 0,
190
-      "org_id": 0,
191
-      "status": 1,
192
-      "type": 1,
193
-      "number": 13,
194
-      "out_stock": 1
195
-    }
196
-  ]
197
-}

+ 0 - 844
controllers/new_mobile_api_controllers/home_api_controller.go Просмотреть файл

@@ -1,844 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"XT_New/utils"
9
-	"encoding/json"
10
-	"fmt"
11
-	"github.com/astaxie/beego"
12
-	"github.com/jinzhu/gorm"
13
-	"io/ioutil"
14
-	"net/http"
15
-	"net/url"
16
-	"strconv"
17
-	"strings"
18
-	"time"
19
-)
20
-
21
-//func InitGoodTypesConfig(org *models.Org){
22
-//
23
-//
24
-//}
25
-
26
-type HomeController struct {
27
-	NewMobileBaseAPIAuthController
28
-}
29
-
30
-func (this *HomeController) GetHomeData() {
31
-
32
-	adminUserInfo := this.GetMobileAdminUserInfo()
33
-	if adminUserInfo.Org != nil && adminUserInfo.Org.Id != 0 {
34
-		//获取该管理员所有机构列表
35
-		var orgs []*models.Org
36
-		adminUser, err := service.GetHomeData(adminUserInfo.AdminUser.Id)
37
-		if err != nil {
38
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
39
-			return
40
-		}
41
-		for _, item := range adminUser.Org {
42
-			orgs = append(orgs, item)
43
-		}
44
-		for _, item := range adminUser.VMApp_Role {
45
-			for _, subItem := range item.Org {
46
-				orgs = append(orgs, subItem)
47
-			}
48
-		}
49
-		orgs = RemoveRepeatedOrgElement(orgs)
50
-
51
-		var isSubSuperAdmin bool = false
52
-		if adminUserInfo.AppRole != nil && adminUserInfo.AppRole.Id > 0 {
53
-			app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
54
-			if len(app_role.RoleIds) > 0 {
55
-				role_ids := strings.Split(app_role.RoleIds, ",")
56
-				if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
57
-					for _, item := range role_ids {
58
-						id, _ := strconv.ParseInt(item, 10, 64)
59
-						if id > 0 {
60
-							role, _ := service.GetRoleByRoleID(id)
61
-							if role != nil {
62
-								if role.IsSystem == 1 && role.RoleName == "子管理员" {
63
-									isSubSuperAdmin = true
64
-								}
65
-							}
66
-						}
67
-					}
68
-				}
69
-			}
70
-		}
71
-
72
-		apps, err := service.GetAllApp(adminUserInfo.Org.Id)
73
-		if err != nil {
74
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
75
-			return
76
-		}
77
-
78
-		banners, err := service.GetSystemBanner()
79
-		if err != nil {
80
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
81
-			return
82
-		}
83
-
84
-		cretor := adminUserInfo.AdminUser.Id
85
-		//查询机构ID是否存在
86
-		_, errcode := service.GetOrgFollowIsExist(adminUserInfo.Org.Id)
87
-		if errcode == gorm.ErrRecordNotFound {
88
-			information, _ := service.GetAdminUserRoleInformation(0)
89
-			username, _ := service.GetMyOrgInformationFour(adminUserInfo.AdminUser.Id, adminUserInfo.Org.Id)
90
-			this.ServeSuccessJSON(map[string]interface{}{
91
-				"orgs":            orgs,
92
-				"apps":            apps,
93
-				"banners":         banners,
94
-				"isCreateOrg":     true,
95
-				"isSubSuperAdmin": isSubSuperAdmin,
96
-				"cretor":          cretor,
97
-				"information":     information,
98
-				"username":        username,
99
-			})
100
-		} else if errcode == nil {
101
-			information, _ := service.GetAdminUserRoleInformation(adminUserInfo.Org.Id)
102
-			username, _ := service.GetMyOrgInformationFour(adminUserInfo.AdminUser.Id, adminUserInfo.Org.Id)
103
-			this.ServeSuccessJSON(map[string]interface{}{
104
-				"orgs":            orgs,
105
-				"apps":            apps,
106
-				"banners":         banners,
107
-				"isCreateOrg":     true,
108
-				"isSubSuperAdmin": isSubSuperAdmin,
109
-				"cretor":          cretor,
110
-				"information":     information,
111
-				"username":        username,
112
-			})
113
-		}
114
-
115
-	} else {
116
-
117
-		apps, err := service.GetAllApp(0)
118
-		if err != nil {
119
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
120
-			return
121
-		}
122
-		banners, err := service.GetSystemBanner()
123
-		if err != nil {
124
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
125
-			return
126
-		}
127
-
128
-		_, errcode := service.GetOrgFollowIsExist(adminUserInfo.Org.Id)
129
-		if errcode == gorm.ErrRecordNotFound {
130
-			information, _ := service.GetAdminUserRoleInformation(0)
131
-			this.ServeSuccessJSON(map[string]interface{}{
132
-				"isCreateOrg":     false,
133
-				"apps":            apps,
134
-				"banners":         banners,
135
-				"isSubSuperAdmin": false,
136
-				"information":     information,
137
-			})
138
-		} else if errcode == nil {
139
-			information, _ := service.GetAdminUserRoleInformation(adminUserInfo.Org.Id)
140
-			this.ServeSuccessJSON(map[string]interface{}{
141
-				"isCreateOrg":     false,
142
-				"apps":            apps,
143
-				"banners":         banners,
144
-				"isSubSuperAdmin": false,
145
-				"information":     information,
146
-			})
147
-		}
148
-
149
-	}
150
-
151
-}
152
-
153
-func RemoveRepeatedOrgElement(orgs []*models.Org) (newOrgs []*models.Org) {
154
-	newOrgs = make([]*models.Org, 0)
155
-	for i := 0; i < len(orgs); i++ {
156
-		repeat := false
157
-		for j := i + 1; j < len(orgs); j++ {
158
-			if orgs[i].Id == orgs[j].Id {
159
-				repeat = true
160
-				break
161
-			}
162
-		}
163
-		if !repeat {
164
-			newOrgs = append(newOrgs, orgs[i])
165
-		}
166
-	}
167
-	return
168
-}
169
-
170
-func (this *HomeController) ChangeOrg() {
171
-	org_id, _ := this.GetInt64("org_id")
172
-	adminUserInfo := this.GetMobileAdminUserInfo()
173
-
174
-	tempOrg, err := service.GetOrgById(org_id)
175
-	if err != nil {
176
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
177
-		return
178
-	}
179
-
180
-	if tempOrg == nil {
181
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoExist)
182
-		return
183
-	}
184
-
185
-	mobile := adminUserInfo.AdminUser.Mobile
186
-	// 只取最近被创建的 admin_role
187
-	adminUser, getAdminErr := service.GetValidAdminUserByMobileReturnErr(mobile) //账号信息唯一值
188
-	if getAdminErr != nil {
189
-		utils.ErrorLog("获取管理员失败:%v", getAdminErr)
190
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
191
-		this.ServeJSON()
192
-		return
193
-	} else if adminUser == nil {
194
-		utils.ErrorLog("查找不到 mobile = %v 的用户", mobile)
195
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
196
-		this.ServeJSON()
197
-		return
198
-	} else {
199
-
200
-		var appRole *models.App_Role
201
-		var org *models.Org
202
-		var subscibe *models.ServeSubscibe
203
-		var app *models.OrgApp
204
-
205
-		//根据登录信息的机构和用户id,去获取对应用户信息和机构信息
206
-		tempApp, _ := service.GetOrgApp(tempOrg.Id, 3)
207
-		tempRole, _ := service.GetAppRole(tempOrg.Id, tempApp.Id, adminUser.Id)
208
-
209
-		tempSubscibe, getSubscibeErr := service.GetOrgServeSubscibe(tempOrg.Id)
210
-		if getSubscibeErr != nil {
211
-			utils.ErrorLog("获取机构订阅信息失败:%v", getSubscibeErr)
212
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
213
-			this.ServeJSON()
214
-			return
215
-		}
216
-
217
-		subscibe = tempSubscibe
218
-		org = tempOrg
219
-		appRole = tempRole
220
-		app = tempApp
221
-
222
-		templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
223
-
224
-		mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
225
-			AdminUser:    adminUser,
226
-			Org:          org,
227
-			App:          app,
228
-			AppRole:      appRole,
229
-			Subscibe:     subscibe,
230
-			TemplateInfo: &templateInfo,
231
-		}
232
-
233
-		if org != nil && appRole != nil {
234
-			// 插入一条登录记录
235
-			ip := this.GetString("ip")
236
-			loginLog := &models.AdminUserLoginLog{
237
-				AdminUserId: adminUser.Id,
238
-				OrgId:       org.Id,
239
-				AppId:       appRole.AppId,
240
-				IP:          ip,
241
-				OperateType: 3,
242
-				AppType:     3,
243
-				CreateTime:  time.Now().Unix(),
244
-			}
245
-			if insertErr := service.InsertLoginLog(loginLog); insertErr != nil {
246
-				utils.ErrorLog("为手机号为%v的用户插入一条登录记录失败:%v", mobile, insertErr)
247
-			}
248
-		}
249
-
250
-		//删除session和cookie
251
-		this.DelSession("mobile_admin_user_info")
252
-		this.Ctx.SetCookie("token_cookie", "")
253
-
254
-		//设置new seesion
255
-		this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
256
-		//设置new cookie
257
-		mobile := adminUser.Mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
258
-		token := utils.GenerateLoginToken(mobile)
259
-		expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
260
-		this.Ctx.SetCookie("token_cookie", token, expiration, "/")
261
-
262
-		var configList interface{}
263
-		var dict_config_list interface{}
264
-		var FiledList []*models.FiledConfig
265
-
266
-		if org.Id > 0 {
267
-			dict_config_list, _ = service.GetDictConfigList(org.Id)
268
-			configList, _ = service.GetConfigList(org.Id)
269
-			FiledList, _ = service.FindFiledByOrgId(org.Id)
270
-		}
271
-		if len(FiledList) == 0 {
272
-			var err error
273
-			if org.Id > 0 {
274
-				err = service.BatchInsertFiledConfig(org.Id)
275
-				if err == nil {
276
-					FiledList, _ = service.FindFiledByOrgId(org.Id)
277
-				} else {
278
-					utils.ErrorLog("字段批量插入失败:%v", err)
279
-				}
280
-			} else {
281
-				FiledList = make([]*models.FiledConfig, 0)
282
-			}
283
-
284
-			if org.Id > 0 {
285
-				//产寻该机构是否有收缩压和舒张压
286
-				pressure, err := service.GetDefaultSystolicPressure(org.Id)
287
-				fmt.Println(err)
288
-				if len(pressure) == 0 {
289
-					err = service.BathInsertQualityControlTwo(org.Id)
290
-				} else {
291
-					utils.ErrorLog("字段批量插入失败:%v", err)
292
-				}
293
-				major, err := service.GetInspectionMajor(org.Id)
294
-				if len(major) == 0 {
295
-					QualityeList, err := service.FindQualityByOrgId(org.Id)
296
-					if len(QualityeList) == 0 {
297
-						err = service.BatchInsertQualityControl(org.Id)
298
-					} else {
299
-						utils.ErrorLog("字段批量插入失败:%v", err)
300
-					}
301
-
302
-					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
303
-					if len(InspectionList) == 0 {
304
-						err = service.BatchInspectionConfiguration(org.Id)
305
-					} else {
306
-						utils.ErrorLog("字段批量插入失败:%v", err)
307
-					}
308
-				} else {
309
-					utils.ErrorLog("字段批量插入失败:%v", err)
310
-				}
311
-
312
-			}
313
-
314
-		}
315
-		this.ServeSuccessJSON(map[string]interface{}{
316
-			"admin": adminUser,
317
-			"user":  appRole,
318
-			"org":   org,
319
-			"template_info": map[string]interface{}{
320
-				"id":          templateInfo.ID,
321
-				"org_id":      templateInfo.OrgId,
322
-				"template_id": templateInfo.TemplateId,
323
-			},
324
-			"config_list":      configList,
325
-			"dict_config_list": dict_config_list,
326
-			"filed_list":       FiledList,
327
-		})
328
-	}
329
-
330
-}
331
-
332
-func (this *HomeController) CreateOrg() {
333
-
334
-	adminUserInfo := this.GetMobileAdminUserInfo()
335
-	adminUser := adminUserInfo.AdminUser
336
-
337
-	//if didCreateOrg, checkCreateOrgErr := service.DidAdminUserCreateOrg(adminUser.Id); checkCreateOrgErr != nil {
338
-	//	this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
339
-	//	this.ServeJSON()
340
-	//	return
341
-	//} else if didCreateOrg {
342
-	//	this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeRepeatCreateOrg)
343
-	//	this.ServeJSON()
344
-	//	return
345
-	//}
346
-
347
-	name := this.GetString("org_name")
348
-	shortName := name
349
-	provinceName := this.GetString("provinces_name")
350
-	cityName := this.GetString("city_name")
351
-	districtName := this.GetString("district_name")
352
-	address := this.GetString("address")
353
-	org_type := this.GetString("org_type")
354
-	contactName := this.GetString("contact_name")
355
-
356
-	openXT := true
357
-	openCDM := false
358
-	openSCRM := false
359
-	openMall := false
360
-
361
-	if len(name) == 0 || len(shortName) == 0 || len(contactName) == 0 || len(address) == 0 || len(provinceName) <= 0 || len(cityName) <= 0 || len(districtName) <= 0 || len(org_type) <= 0 {
362
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
363
-		this.ServeJSON()
364
-		return
365
-	}
366
-	orgPhone := this.GetString("telephone")
367
-
368
-	provinceID := 0
369
-	cityID := 0
370
-	districtID := 0
371
-
372
-	province, getProvinceErr := service.GetProvinceWithName(provinceName)
373
-	if getProvinceErr != nil {
374
-		utils.ErrorLog("查询省名失败:%v", getProvinceErr)
375
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
376
-		this.ServeJSON()
377
-		return
378
-	} else if province != nil {
379
-		provinceID = int(province.ID)
380
-		city, getCityErr := service.GetCityWithName(province.ID, cityName)
381
-		if getCityErr != nil {
382
-			utils.ErrorLog("查询城市名失败:%v", getCityErr)
383
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
384
-			this.ServeJSON()
385
-			return
386
-		} else if city != nil {
387
-			cityID = int(city.ID)
388
-			district, getDistrictErr := service.GetDistrictWithName(city.ID, districtName)
389
-			if getDistrictErr != nil {
390
-				utils.ErrorLog("查询区县名失败:%v", getDistrictErr)
391
-				this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
392
-				this.ServeJSON()
393
-				return
394
-			} else if district != nil {
395
-				districtID = int(district.ID)
396
-			}
397
-		}
398
-	}
399
-
400
-	var orgs []*models.Org
401
-	vmAdminUser, err := service.GetHomeData(adminUser.Id)
402
-	if err != nil {
403
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
404
-		return
405
-	}
406
-	for _, item := range vmAdminUser.Org {
407
-		orgs = append(orgs, item)
408
-	}
409
-	for _, item := range vmAdminUser.VMApp_Role {
410
-		for _, subItem := range item.Org {
411
-			orgs = append(orgs, subItem)
412
-		}
413
-	}
414
-	orgs = RemoveRepeatedOrgElement(orgs)
415
-
416
-	orgType := service.GetOrgTypeByName(org_type)
417
-
418
-	org := &models.Org{
419
-		Creator:      adminUser.Id,
420
-		OrgName:      name,
421
-		OrgShortName: shortName,
422
-		Province:     int64(provinceID),
423
-		City:         int64(cityID),
424
-		District:     int64(districtID),
425
-		Address:      address,
426
-		OrgType:      orgType.ID,
427
-		Telephone:    orgPhone,
428
-		ContactName:  contactName,
429
-		Claim:        1,
430
-		Evaluate:     5,
431
-		Status:       1,
432
-		CreateTime:   time.Now().Unix(),
433
-		ModifyTime:   time.Now().Unix(),
434
-	}
435
-
436
-	createErr := service.CreateOrg(org, adminUser.Name, openXT, openCDM, openSCRM, openMall) // 创建机构以及所有类型的 app,如果有新类型的平台,则需要在这个方法里面把创建这一新类型的 app 的代码加上
437
-
438
-	if createErr != nil {
439
-		utils.ErrorLog("mobile=%v的超级管理员创建机构失败:%v", adminUser.Mobile, createErr)
440
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
441
-		this.ServeJSON()
442
-	} else {
443
-
444
-		//初始化病人和排班相关数据
445
-		InitPatientAndSchedule(org)
446
-		//初始化透析方案
447
-		InitSystemPrescrption(org)
448
-		//初始化医嘱模版
449
-		//InitAdviceTemplate(org)
450
-		//初始化角色和权限
451
-		InitRoleAndPurviews(org)
452
-		//初始化设备管理
453
-		InitEquitMentInformation(org)
454
-		//初始化显示配置和打印模版
455
-		InitShowConfig(org)
456
-		//初始化商品类型
457
-		InitGoodTypesConfig(org)
458
-
459
-		if len(orgs) == 0 {
460
-			ip := utils.GetIP(this.Ctx.Request)
461
-			ssoDomain := beego.AppConfig.String("sso_domain")
462
-			api := ssoDomain + "/m/login/pwd"
463
-			values := make(url.Values)
464
-			values.Set("mobile", adminUser.Mobile)
465
-			values.Set("password", adminUser.Password)
466
-			values.Set("app_type", "3")
467
-			values.Set("ip", ip)
468
-			resp, requestErr := http.PostForm(api, values)
469
-
470
-			if requestErr != nil {
471
-				utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
472
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
473
-				return
474
-			}
475
-			defer resp.Body.Close()
476
-			body, ioErr := ioutil.ReadAll(resp.Body)
477
-			if ioErr != nil {
478
-				utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
479
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
480
-				return
481
-			}
482
-			var respJSON map[string]interface{}
483
-			utils.InfoLog(string(body))
484
-			if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
485
-				utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
486
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
487
-				return
488
-			}
489
-
490
-			if respJSON["state"].(float64) != 1 {
491
-				msg := respJSON["msg"].(string)
492
-				utils.ErrorLog("SSO登录接口请求失败: %v", msg)
493
-				if int(respJSON["code"].(float64)) == 609 {
494
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
495
-					return
496
-				}
497
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
498
-				return
499
-			} else {
500
-				utils.SuccessLog("SSO登录成功")
501
-				// 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
502
-				userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
503
-				userJSONBytes, _ := json.Marshal(userJSON)
504
-				var adminUser models.AdminUser
505
-				if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
506
-					utils.ErrorLog("解析管理员失败:%v", err)
507
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
508
-					return
509
-				}
510
-
511
-				var org models.Org
512
-				if respJSON["data"].(map[string]interface{})["org"] != nil {
513
-					orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
514
-					orgJSONBytes, _ := json.Marshal(orgJSON)
515
-					if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
516
-						utils.ErrorLog("解析机构失败:%v", err)
517
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
518
-						return
519
-					}
520
-				}
521
-
522
-				var app models.OrgApp
523
-
524
-				if respJSON["data"].(map[string]interface{})["app"] != nil {
525
-					appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
526
-					appJSONBytes, _ := json.Marshal(appJSON)
527
-					if err := json.Unmarshal(appJSONBytes, &app); err != nil {
528
-						utils.ErrorLog("解析应用失败:%v", err)
529
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
530
-						return
531
-					}
532
-				}
533
-
534
-				var appRole models.App_Role
535
-
536
-				if respJSON["data"].(map[string]interface{})["app_role"] != nil {
537
-					appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
538
-					appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
539
-					if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
540
-						utils.ErrorLog("解析AppRole失败:%v", err)
541
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
542
-						return
543
-					}
544
-				}
545
-
546
-				var subscibe models.ServeSubscibe
547
-				if respJSON["data"].(map[string]interface{})["subscibe"] != nil {
548
-					subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
549
-					subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
550
-					if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
551
-						utils.ErrorLog("解析Subscibe失败:%v", err)
552
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
553
-						return
554
-					}
555
-
556
-				}
557
-
558
-				//service.GetOrgSubscibeState(&subscibe)
559
-				templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
560
-
561
-				mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
562
-					AdminUser:    &adminUser,
563
-					Org:          &org,
564
-					App:          &app,
565
-					AppRole:      &appRole,
566
-					Subscibe:     &subscibe,
567
-					TemplateInfo: &templateInfo,
568
-				}
569
-				this.Ctx.SetCookie("token_cookie", "")
570
-
571
-				//设置seesion
572
-				this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
573
-
574
-				//设置cookie
575
-				mobile := adminUser.Mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
576
-				token := utils.GenerateLoginToken(mobile)
577
-				expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
578
-				this.Ctx.SetCookie("token_cookie", token, expiration, "/")
579
-
580
-				var configList interface{}
581
-				var dict_config_list interface{}
582
-
583
-				var FiledList []*models.FiledConfig
584
-
585
-				if org.Id > 0 {
586
-					dict_config_list, _ = service.GetDictConfigList(org.Id)
587
-
588
-					configList, _ = service.GetConfigList(org.Id)
589
-					FiledList, _ = service.FindFiledByOrgId(org.Id)
590
-				}
591
-				if len(FiledList) == 0 {
592
-					var err error
593
-					if org.Id > 0 {
594
-						err = service.BatchInsertFiledConfig(org.Id)
595
-						if err == nil {
596
-							FiledList, _ = service.FindFiledByOrgId(org.Id)
597
-						} else {
598
-							utils.ErrorLog("字段批量插入失败:%v", err)
599
-						}
600
-					} else {
601
-						FiledList = make([]*models.FiledConfig, 0)
602
-					}
603
-				}
604
-
605
-				if org.Id > 0 {
606
-					major, requestErr := service.GetInspectionMajor(org.Id)
607
-					if len(major) == 0 {
608
-						QualityeList, err := service.FindQualityByOrgId(org.Id)
609
-						if len(QualityeList) == 0 {
610
-							err = service.BatchInsertQualityControl(org.Id)
611
-						} else {
612
-							utils.ErrorLog("字段批量插入失败:%v", err)
613
-						}
614
-
615
-						InspectionList, err := service.FindeInspectionByOrgId(org.Id)
616
-						if len(InspectionList) == 0 {
617
-							err = service.BatchInspectionConfiguration(org.Id)
618
-						} else {
619
-							utils.ErrorLog("字段批量插入失败:%v", err)
620
-						}
621
-					} else {
622
-						utils.ErrorLog("字段批量插入失败:%v", requestErr)
623
-					}
624
-
625
-				}
626
-
627
-				this.ServeSuccessJSON(map[string]interface{}{
628
-					"admin": adminUser,
629
-					"user":  appRole,
630
-					"org":   org,
631
-					"template_info": map[string]interface{}{
632
-						"id":          templateInfo.ID,
633
-						"org_id":      templateInfo.OrgId,
634
-						"template_id": templateInfo.TemplateId,
635
-					},
636
-					"config_list":      configList,
637
-					"dict_config_list": dict_config_list,
638
-
639
-					"filed_list": FiledList,
640
-					"status":     1,
641
-				})
642
-			}
643
-
644
-		} else {
645
-			this.ServeSuccessJSON(map[string]interface{}{
646
-				"org":    org,
647
-				"status": 2,
648
-			})
649
-
650
-		}
651
-
652
-	}
653
-
654
-}
655
-
656
-func (this *HomeController) ModifyPsw() {
657
-	mobile := this.GetString("mobile")
658
-	code := this.GetString("code")
659
-	password := this.GetString("password")
660
-	checkErr := this.checkParam(mobile, code, password)
661
-	if checkErr != nil {
662
-		this.ServeFailJSONWithSGJErrorCode(checkErr.Code)
663
-		return
664
-	}
665
-	adminUser, _ := service.GetValidAdminUserByMobileReturnErr(mobile)
666
-	modifyErr := service.ModifyPassword(adminUser.Id, password)
667
-	if modifyErr != nil {
668
-		utils.ErrorLog("修改mobile=%v的用户的密码时失败: %v", mobile, modifyErr)
669
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
670
-		return
671
-	} else {
672
-		// 修改成功后验证码就要使其失效
673
-		redisClient := service.RedisClient()
674
-		defer redisClient.Close()
675
-		redisClient.Del("code_msg_" + mobile)
676
-		this.ServeSuccessJSON(map[string]interface{}{
677
-			"admin": adminUser,
678
-		})
679
-		return
680
-	}
681
-}
682
-
683
-func (this *HomeController) checkParam(mobile string, code string, password string) *enums.SGJError {
684
-	if utils.CellPhoneRegexp().MatchString(mobile) == false {
685
-		return &enums.SGJError{Code: enums.ErrorCodeMobileFormat}
686
-	}
687
-	if len(code) == 0 {
688
-		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
689
-	}
690
-	if len(password) == 0 {
691
-		return &enums.SGJError{Code: enums.ErrorCodePasswordEmpty}
692
-	}
693
-	if service.IsMobileRegister(mobile) == false {
694
-		return &enums.SGJError{Code: enums.ErrorCodeMobileNotExit}
695
-	}
696
-	redisClient := service.RedisClient()
697
-	defer redisClient.Close()
698
-	cache_code, _ := redisClient.Get("code_msg_" + mobile).Result()
699
-	if cache_code != code {
700
-		return &enums.SGJError{Code: enums.ErrorCodeVerificationCodeWrong}
701
-	}
702
-	return nil
703
-}
704
-
705
-func (this *HomeController) GetFuncPermission() {
706
-	adminUserInfo := this.GetMobileAdminUserInfo()
707
-	user_id := adminUserInfo.AdminUser.Id
708
-	app_id := adminUserInfo.App.Id
709
-	org_id := adminUserInfo.Org.Id
710
-	create_url := this.GetString("create_url")
711
-	modify_url := this.GetString("modify_url")
712
-	modify_other_url := this.GetString("modify_other_url")
713
-	del_url := this.GetString("del_url")
714
-	del_other_url := this.GetString("del_other_url")
715
-	exce_url := this.GetString("exce_url")
716
-	check_url := this.GetString("check_url")
717
-	modify_exce_url := this.GetString("modify_exce_url")
718
-	module, _ := this.GetInt64("module", 0)
719
-
720
-	app_role, _ := service.GetAppRole(org_id, app_id, user_id)
721
-	var is_has_create bool
722
-	var is_has_modify bool
723
-	var is_has_modify_other bool
724
-	var is_has_del bool
725
-	var is_has_del_other bool
726
-	var is_has_exce bool
727
-	var is_has_check bool
728
-	var is_has_modify_exce bool
729
-
730
-	if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
731
-
732
-		if app_role != nil {
733
-			if len(app_role.RoleIds) > 0 {
734
-				roles := strings.Split(app_role.RoleIds, ",")
735
-				var userRolePurviews string
736
-				for _, item := range roles {
737
-					role_id, _ := strconv.ParseInt(item, 10, 64)
738
-					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
739
-					if len(userRolePurviews) == 0 {
740
-						userRolePurviews = purviews
741
-					} else {
742
-						userRolePurviews = userRolePurviews + "," + purviews
743
-					}
744
-				}
745
-				userRolePurviewsArr := RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
746
-				funcPurviews, _ := service.FindAllFuncPurview(userRolePurviewsArr)
747
-				for _, item := range funcPurviews {
748
-					//for _, url := range strings.Split(item.Urlfor,","){
749
-					if strings.Split(item.Urlfor, ",")[0] == create_url {
750
-						is_has_create = true
751
-					}
752
-					if strings.Split(item.Urlfor, ",")[0] == modify_url {
753
-						is_has_modify = true
754
-					}
755
-					if strings.Split(item.Urlfor, ",")[0] == modify_other_url {
756
-						is_has_modify_other = true
757
-					}
758
-					if strings.Split(item.Urlfor, ",")[0] == del_url {
759
-						is_has_del = true
760
-					}
761
-					if strings.Split(item.Urlfor, ",")[0] == del_other_url {
762
-						is_has_del_other = true
763
-					}
764
-					if strings.Split(item.Urlfor, ",")[0] == exce_url {
765
-						is_has_exce = true
766
-					}
767
-					if strings.Split(item.Urlfor, ",")[0] == check_url {
768
-						is_has_check = true
769
-					}
770
-					if strings.Split(item.Urlfor, ",")[0] == modify_exce_url {
771
-						is_has_modify_exce = true
772
-					}
773
-
774
-				}
775
-			} else {
776
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRole)
777
-				return
778
-			}
779
-			this.ServeSuccessJSON(map[string]interface{}{
780
-				"is_has_create":       is_has_create,
781
-				"is_has_modify":       is_has_modify,
782
-				"is_has_modify_other": is_has_modify_other,
783
-				"is_has_del":          is_has_del,
784
-				"is_has_del_other":    is_has_del_other,
785
-				"is_has_exce":         is_has_exce,
786
-				"is_has_check":        is_has_check,
787
-				"is_has_modify_exce":  is_has_modify_exce,
788
-				"module":              module,
789
-			})
790
-		} else {
791
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserIsExit)
792
-			return
793
-
794
-		}
795
-
796
-	} else {
797
-		this.ServeSuccessJSON(map[string]interface{}{
798
-			"is_has_create":       true,
799
-			"is_has_modify":       true,
800
-			"is_has_modify_other": true,
801
-			"is_has_del":          true,
802
-			"is_has_del_other":    true,
803
-			"is_has_exce":         true,
804
-			"is_has_check":        true,
805
-			"is_has_modify_exce":  true,
806
-			"module":              true,
807
-		})
808
-
809
-	}
810
-
811
-}
812
-func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
813
-	newArr = make([]string, 0)
814
-	for i := 0; i < len(arr); i++ {
815
-		repeat := false
816
-		for j := i + 1; j < len(arr); j++ {
817
-			if arr[i] == arr[j] {
818
-				repeat = true
819
-				break
820
-			}
821
-		}
822
-		if !repeat {
823
-			newArr = append(newArr, arr[i])
824
-		}
825
-	}
826
-	return
827
-}
828
-
829
-func RemoveRepeatedOrgElementTwo(orgs []*models.SgjUserOrg) (newOrgs []*models.SgjUserOrg) {
830
-	newOrgs = make([]*models.SgjUserOrg, 0)
831
-	for i := 0; i < len(orgs); i++ {
832
-		repeat := false
833
-		for j := i + 1; j < len(orgs); j++ {
834
-			if orgs[i].ID == orgs[j].ID {
835
-				repeat = true
836
-				break
837
-			}
838
-		}
839
-		if !repeat {
840
-			newOrgs = append(newOrgs, orgs[i])
841
-		}
842
-	}
843
-	return
844
-}

+ 0 - 925
controllers/new_mobile_api_controllers/index_evaluation_api_controller.go Просмотреть файл

@@ -1,925 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service/statistics_service"
7
-	"XT_New/utils"
8
-	"fmt"
9
-	"time"
10
-)
11
-
12
-type IndexEvaluationApiController struct {
13
-	NewMobileBaseAPIAuthController
14
-}
15
-
16
-func (this *IndexEvaluationApiController) GetAdminUser() {
17
-	admins, _ := statistics_service.GetAllAdminUser(this.GetMobileAdminUserInfo().Org.Id)
18
-	this.ServeSuccessJSON(map[string]interface{}{
19
-		"admin": admins,
20
-	})
21
-}
22
-
23
-//化验指标
24
-
25
-//初始化数据
26
-func (this *IndexEvaluationApiController) GetLaboratoryIndexInitData() {
27
-	adminUserInfo := this.GetMobileAdminUserInfo()
28
-	var references []*models.InspectionReference
29
-	count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
30
-	if count <= 0 {
31
-		references, _ = statistics_service.FindOrgInspectionReference(0, 1)
32
-		references2, _ := statistics_service.FindOrgInspectionReference(0, 2)
33
-		references = append(references, references2...)
34
-
35
-	} else {
36
-		references, _ = statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id, 1)
37
-		references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id, 2)
38
-		references = append(references, references2...)
39
-
40
-	}
41
-
42
-	this.ServeSuccessJSON(map[string]interface{}{
43
-		"references": references,
44
-	})
45
-
46
-	//adminUserInfo := this.GetMobileAdminUserInfo()
47
-	//
48
-	//
49
-	//
50
-	//references, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id,1)
51
-	//references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.Org.Id,2)
52
-	//references = append(references, references2...)
53
-	//this.ServeSuccessJSON(map[string]interface{}{
54
-	//	"references": references,
55
-	//})
56
-
57
-}
58
-
59
-//获取取值范围
60
-func (this *IndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueData() {
61
-	range_type, _ := this.GetInt64("range_type")
62
-	project_id, _ := this.GetInt64("project_id")
63
-	item_id, _ := this.GetInt64("item_id")
64
-	adminUserInfo := this.GetMobileAdminUserInfo()
65
-	var range_vaule []string
66
-	var qcs models.InspectionReference
67
-
68
-	if range_type == 1 {
69
-		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
70
-
71
-		if count <= 0 {
72
-			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
73
-		} else {
74
-			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
75
-
76
-		}
77
-		//qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
78
-		range_vaule = append(range_vaule, qcs.RangeMin)
79
-		range_vaule = append(range_vaule, qcs.RangeMax)
80
-	} else {
81
-		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
82
-		for _, item := range inspection {
83
-			range_vaule = append(range_vaule, item.InspectValue)
84
-		}
85
-	}
86
-	this.ServeSuccessJSON(map[string]interface{}{
87
-		"range_vaule": range_vaule,
88
-	})
89
-
90
-}
91
-func (this *IndexEvaluationApiController) GetInspectionChartData() {
92
-	adminUserInfo := this.GetMobileAdminUserInfo()
93
-	start_time := this.GetString("start_time")
94
-	end_time := this.GetString("end_time")
95
-	project_id, _ := this.GetInt64("project_id")
96
-	item_id, _ := this.GetInt64("item_id")
97
-	range_type, _ := this.GetInt("range_type")
98
-
99
-	timeLayout := "2006-01-02"
100
-	loc, _ := time.LoadLocation("Local")
101
-
102
-	var theStartTIme int64
103
-	if len(start_time) > 0 {
104
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
105
-		if err != nil {
106
-			utils.ErrorLog(err.Error())
107
-		}
108
-		theStartTIme = theTime.Unix()
109
-	}
110
-	var theEndtTIme int64
111
-	if len(end_time) > 0 {
112
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
113
-		if err != nil {
114
-			utils.ErrorLog(err.Error())
115
-		}
116
-		theEndtTIme = theTime.Unix()
117
-	}
118
-
119
-	var range_value string
120
-	//if range_type == 1 {
121
-	//	qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
122
-	//	range_value = qcs.RangeMin + "," + qcs.RangeMax
123
-	//
124
-	//} else {
125
-	//
126
-	//	inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
127
-	//	for _, item := range inspection {
128
-	//		if len(range_value) == 0 {
129
-	//			range_value = item.InspectValue
130
-	//		} else {
131
-	//			range_value = range_value + "," + item.InspectValue
132
-	//		}
133
-	//	}
134
-	//}
135
-
136
-	if range_type == 1 {
137
-		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
138
-
139
-		if count <= 0 {
140
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
141
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
142
-
143
-		} else {
144
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
145
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
146
-		}
147
-
148
-	} else {
149
-
150
-		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
151
-		for _, item := range inspection {
152
-			if len(range_value) == 0 {
153
-				range_value = item.InspectValue
154
-			} else {
155
-				range_value = range_value + "," + item.InspectValue
156
-			}
157
-		}
158
-
159
-	}
160
-
161
-	data, _ := statistics_service.GetInspectionChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value)
162
-	this.ServeSuccessJSON(map[string]interface{}{
163
-		"data": data,
164
-	})
165
-
166
-}
167
-func (this *IndexEvaluationApiController) GetInspectionChartTableData() {
168
-	adminUserInfo := this.GetMobileAdminUserInfo()
169
-	start_time := this.GetString("start_time")
170
-	end_time := this.GetString("end_time")
171
-	patient_id, _ := this.GetInt64("patient_id")
172
-	page, _ := this.GetInt64("page")
173
-	limit, _ := this.GetInt64("limit")
174
-	project_id, _ := this.GetInt64("project_id")
175
-	item_id, _ := this.GetInt64("item_id")
176
-	range_value := this.GetString("range_value")
177
-	range_type, _ := this.GetInt("range_type")
178
-
179
-	if page == 0 {
180
-		page = 1
181
-	}
182
-	if limit == 0 {
183
-		limit = 20
184
-	}
185
-	timeLayout := "2006-01-02"
186
-	loc, _ := time.LoadLocation("Local")
187
-
188
-	var theStartTIme int64
189
-	if len(start_time) > 0 {
190
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
191
-		if err != nil {
192
-			utils.ErrorLog(err.Error())
193
-		}
194
-		theStartTIme = theTime.Unix()
195
-	}
196
-	var theEndtTIme int64
197
-	if len(end_time) > 0 {
198
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
199
-		if err != nil {
200
-			utils.ErrorLog(err.Error())
201
-		}
202
-		theEndtTIme = theTime.Unix()
203
-	}
204
-	data, total, _ := statistics_service.GetInspectionChartTableData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, patient_id, page, limit, range_type, range_value)
205
-	this.ServeSuccessJSON(map[string]interface{}{
206
-		"data":  data,
207
-		"total": total,
208
-	})
209
-
210
-}
211
-func (this *IndexEvaluationApiController) GetPatientInspectionChartData() {
212
-	adminUserInfo := this.GetMobileAdminUserInfo()
213
-	start_time := this.GetString("start_time")
214
-	end_time := this.GetString("end_time")
215
-	project_id, _ := this.GetInt64("project_id")
216
-	item_id, _ := this.GetInt64("item_id")
217
-	patient_id, _ := this.GetInt64("patient_id")
218
-
219
-	timeLayout := "2006-01-02"
220
-	loc, _ := time.LoadLocation("Local")
221
-
222
-	var theStartTIme int64
223
-	if len(start_time) > 0 {
224
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
225
-		if err != nil {
226
-			utils.ErrorLog(err.Error())
227
-		}
228
-		theStartTIme = theTime.Unix()
229
-	}
230
-	var theEndtTIme int64
231
-	if len(end_time) > 0 {
232
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
233
-		if err != nil {
234
-			utils.ErrorLog(err.Error())
235
-		}
236
-		theEndtTIme = theTime.Unix()
237
-	}
238
-
239
-	data, _ := statistics_service.GetPatientInspectionChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, patient_id)
240
-	references, _ := statistics_service.FindOrgQualityControlStandardInspectionReferenceById(adminUserInfo.Org.Id, project_id, item_id)
241
-
242
-	this.ServeSuccessJSON(map[string]interface{}{
243
-		"data":       data,
244
-		"references": references,
245
-	})
246
-
247
-}
248
-func (this *IndexEvaluationApiController) GetPatientInspectionBarChartData() {
249
-	adminUserInfo := this.GetMobileAdminUserInfo()
250
-	start_time := this.GetString("start_time")
251
-	end_time := this.GetString("end_time")
252
-	project_id, _ := this.GetInt64("project_id")
253
-	item_id, _ := this.GetInt64("item_id")
254
-	range_type, _ := this.GetInt("range_type")
255
-	patient_id, _ := this.GetInt64("patient_id")
256
-
257
-	timeLayout := "2006-01-02"
258
-	loc, _ := time.LoadLocation("Local")
259
-
260
-	var theStartTIme int64
261
-	if len(start_time) > 0 {
262
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
263
-		if err != nil {
264
-			utils.ErrorLog(err.Error())
265
-		}
266
-		theStartTIme = theTime.Unix()
267
-	}
268
-	var theEndtTIme int64
269
-	if len(end_time) > 0 {
270
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
271
-		if err != nil {
272
-			utils.ErrorLog(err.Error())
273
-		}
274
-		theEndtTIme = theTime.Unix()
275
-	}
276
-
277
-	var range_value string
278
-	if range_type == 1 {
279
-		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.Org.Id)
280
-
281
-		if count <= 0 {
282
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
283
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
284
-
285
-		} else {
286
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
287
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
288
-		}
289
-
290
-	} else {
291
-
292
-		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.Org.Id, project_id, item_id)
293
-		for _, item := range inspection {
294
-			if len(range_value) == 0 {
295
-				range_value = item.InspectValue
296
-			} else {
297
-				range_value = range_value + "," + item.InspectValue
298
-			}
299
-		}
300
-
301
-	}
302
-
303
-	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
304
-	this.ServeSuccessJSON(map[string]interface{}{
305
-		"data": data,
306
-	})
307
-
308
-}
309
-
310
-func (this *IndexEvaluationApiController) GetDialysisProcessIndexChartData() {
311
-	adminUserInfo := this.GetMobileAdminUserInfo()
312
-	statistics_type, _ := this.GetInt("statistics_type")
313
-	fmt.Println("startisct=====================", statistics_type)
314
-	start_time := this.GetString("start_time")
315
-	end_time := this.GetString("end_time")
316
-	patient_id, _ := this.GetInt64("patient_id")
317
-	timeLayout := "2006-01-02"
318
-	loc, _ := time.LoadLocation("Local")
319
-
320
-	var theStartTIme int64
321
-	if len(start_time) > 0 {
322
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
323
-		if err != nil {
324
-			utils.ErrorLog(err.Error())
325
-		}
326
-		theStartTIme = theTime.Unix()
327
-	}
328
-	var theEndtTIme int64
329
-	if len(end_time) > 0 {
330
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
331
-		if err != nil {
332
-			utils.ErrorLog(err.Error())
333
-		}
334
-		theEndtTIme = theTime.Unix()
335
-	}
336
-
337
-	if patient_id == 0 {
338
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.Org.Id)
339
-		if patientInfo == nil {
340
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
341
-			return
342
-		}
343
-		if statistics_type == 9 || statistics_type == 10 {
344
-			data, _ := statistics_service.GetDialysisProcessIndexOtherChartData(adminUserInfo.Org.Id, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
345
-
346
-			this.ServeSuccessJSON(map[string]interface{}{
347
-				"data": data,
348
-			})
349
-		} else {
350
-
351
-			data, _ := statistics_service.GetDialysisProcessIndexChartData(adminUserInfo.Org.Id, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
352
-
353
-			this.ServeSuccessJSON(map[string]interface{}{
354
-				"data": data,
355
-			})
356
-
357
-		}
358
-	} else {
359
-		if statistics_type == 9 || statistics_type == 10 {
360
-			data, _ := statistics_service.GetDialysisProcessIndexOtherChartData(adminUserInfo.Org.Id, patient_id, theStartTIme, theEndtTIme, statistics_type)
361
-
362
-			this.ServeSuccessJSON(map[string]interface{}{
363
-				"data": data,
364
-			})
365
-
366
-		} else {
367
-			data, _ := statistics_service.GetDialysisProcessIndexChartData(adminUserInfo.Org.Id, patient_id, theStartTIme, theEndtTIme, statistics_type)
368
-
369
-			this.ServeSuccessJSON(map[string]interface{}{
370
-				"data": data,
371
-			})
372
-
373
-		}
374
-	}
375
-
376
-}
377
-func (this *IndexEvaluationApiController) GetDialysisProcessIndexTableData() {
378
-	adminUserInfo := this.GetMobileAdminUserInfo()
379
-	start_time := this.GetString("start_time")
380
-	end_time := this.GetString("end_time")
381
-	patient_id, _ := this.GetInt64("patient_id")
382
-
383
-	page, _ := this.GetInt64("page")
384
-	limit, _ := this.GetInt64("limit")
385
-
386
-	if page == 0 {
387
-		page = 1
388
-	}
389
-	if limit == 0 {
390
-		limit = 20
391
-	}
392
-
393
-	timeLayout := "2006-01-02"
394
-	loc, _ := time.LoadLocation("Local")
395
-
396
-	var theStartTIme int64
397
-	if len(start_time) > 0 {
398
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
399
-		if err != nil {
400
-			utils.ErrorLog(err.Error())
401
-		}
402
-		theStartTIme = theTime.Unix()
403
-	}
404
-	var theEndtTIme int64
405
-	if len(end_time) > 0 {
406
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
407
-		if err != nil {
408
-			utils.ErrorLog(err.Error())
409
-		}
410
-		theEndtTIme = theTime.Unix()
411
-	}
412
-
413
-	if patient_id == 0 {
414
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.Org.Id)
415
-		if patientInfo == nil {
416
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
417
-			return
418
-		}
419
-
420
-		data, total, _ := statistics_service.GetDialysisProcessIndexTableData(adminUserInfo.Org.Id, patientInfo.ID, page, limit, theStartTIme, theEndtTIme)
421
-
422
-		this.ServeSuccessJSON(map[string]interface{}{
423
-			"data":  data,
424
-			"total": total,
425
-		})
426
-
427
-	} else {
428
-		data, total, _ := statistics_service.GetDialysisProcessIndexTableData(adminUserInfo.Org.Id, patient_id, page, limit, theStartTIme, theEndtTIme)
429
-		this.ServeSuccessJSON(map[string]interface{}{
430
-			"data":  data,
431
-			"total": total,
432
-		})
433
-
434
-	}
435
-
436
-}
437
-func (this *IndexEvaluationApiController) GetDialysisWatchChartData() {
438
-	adminUserInfo := this.GetMobileAdminUserInfo()
439
-	statistics_type, _ := this.GetInt("statistics_type")
440
-	start_time := this.GetString("start_time")
441
-	end_time := this.GetString("end_time")
442
-	patient_id, _ := this.GetInt64("patient_id")
443
-	timeLayout := "2006-01-02"
444
-	loc, _ := time.LoadLocation("Local")
445
-
446
-	var theStartTIme int64
447
-	if len(start_time) > 0 {
448
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
449
-		if err != nil {
450
-			utils.ErrorLog(err.Error())
451
-		}
452
-		theStartTIme = theTime.Unix()
453
-	}
454
-	var theEndtTIme int64
455
-	if len(end_time) > 0 {
456
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
457
-		if err != nil {
458
-			utils.ErrorLog(err.Error())
459
-		}
460
-		theEndtTIme = theTime.Unix()
461
-	}
462
-
463
-	if patient_id == 0 {
464
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.Org.Id)
465
-		if patientInfo == nil {
466
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
467
-			return
468
-		}
469
-		data, _ := statistics_service.GetDialysisWatchChartData(adminUserInfo.Org.Id, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
470
-		this.ServeSuccessJSON(map[string]interface{}{
471
-			"data": data,
472
-		})
473
-	} else {
474
-		data, _ := statistics_service.GetDialysisWatchChartData(adminUserInfo.Org.Id, patient_id, theStartTIme, theEndtTIme, statistics_type)
475
-		this.ServeSuccessJSON(map[string]interface{}{
476
-			"data": data,
477
-		})
478
-	}
479
-
480
-}
481
-func (this *IndexEvaluationApiController) GetDialysisWatchTableData() {
482
-	adminUserInfo := this.GetMobileAdminUserInfo()
483
-	start_time := this.GetString("start_time")
484
-	end_time := this.GetString("end_time")
485
-	patient_id, _ := this.GetInt64("patient_id")
486
-	page, _ := this.GetInt64("page")
487
-	limit, _ := this.GetInt64("limit")
488
-
489
-	if page == 0 {
490
-		page = 1
491
-	}
492
-	if limit == 0 {
493
-		limit = 20
494
-	}
495
-	timeLayout := "2006-01-02"
496
-	loc, _ := time.LoadLocation("Local")
497
-
498
-	var theStartTIme int64
499
-	if len(start_time) > 0 {
500
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
501
-		if err != nil {
502
-			utils.ErrorLog(err.Error())
503
-		}
504
-		theStartTIme = theTime.Unix()
505
-	}
506
-	var theEndtTIme int64
507
-	if len(end_time) > 0 {
508
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
509
-		if err != nil {
510
-			utils.ErrorLog(err.Error())
511
-		}
512
-		theEndtTIme = theTime.Unix()
513
-	}
514
-
515
-	if patient_id == 0 {
516
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.Org.Id)
517
-		if patientInfo == nil {
518
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
519
-			return
520
-		}
521
-
522
-		data, total, _ := statistics_service.GetDialysisWatchTableData(adminUserInfo.Org.Id, patientInfo.ID, page, limit, theStartTIme, theEndtTIme)
523
-
524
-		this.ServeSuccessJSON(map[string]interface{}{
525
-			"data":  data,
526
-			"total": total,
527
-		})
528
-
529
-	} else {
530
-
531
-		data, total, _ := statistics_service.GetDialysisWatchTableData(adminUserInfo.Org.Id, patient_id, page, limit, theStartTIme, theEndtTIme)
532
-		this.ServeSuccessJSON(map[string]interface{}{
533
-			"data":  data,
534
-			"total": total,
535
-		})
536
-
537
-	}
538
-
539
-}
540
-
541
-func (this *IndexEvaluationApiController) GetDialysisBloodPressureChartData() {
542
-	adminUserInfo := this.GetMobileAdminUserInfo()
543
-	statistics_type, _ := this.GetInt("statistics_type")
544
-	start_time := this.GetString("start_time")
545
-	end_time := this.GetString("end_time")
546
-	patient_id, _ := this.GetInt64("patient_id")
547
-
548
-	timeLayout := "2006-01-02"
549
-	loc, _ := time.LoadLocation("Local")
550
-
551
-	var theStartTIme int64
552
-	if len(start_time) > 0 {
553
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
554
-		if err != nil {
555
-			utils.ErrorLog(err.Error())
556
-		}
557
-		theStartTIme = theTime.Unix()
558
-	}
559
-	var theEndtTIme int64
560
-	if len(end_time) > 0 {
561
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
562
-		if err != nil {
563
-			utils.ErrorLog(err.Error())
564
-		}
565
-		theEndtTIme = theTime.Unix()
566
-	}
567
-
568
-	data, _ := statistics_service.GetBloodPressureChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, statistics_type, patient_id)
569
-	this.ServeSuccessJSON(map[string]interface{}{
570
-		"data": data,
571
-	})
572
-
573
-}
574
-func (this *IndexEvaluationApiController) GetDialysisBloodPressureTableData() {
575
-	adminUserInfo := this.GetMobileAdminUserInfo()
576
-	start_time := this.GetString("start_time")
577
-	end_time := this.GetString("end_time")
578
-	patient_id, _ := this.GetInt64("patient_id")
579
-	page, _ := this.GetInt64("page")
580
-	limit, _ := this.GetInt64("limit")
581
-
582
-	if page == 0 {
583
-		page = 1
584
-	}
585
-	if limit == 0 {
586
-		limit = 20
587
-	}
588
-	timeLayout := "2006-01-02"
589
-	loc, _ := time.LoadLocation("Local")
590
-
591
-	var theStartTIme int64
592
-	if len(start_time) > 0 {
593
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
594
-		if err != nil {
595
-			utils.ErrorLog(err.Error())
596
-		}
597
-		theStartTIme = theTime.Unix()
598
-	}
599
-	var theEndtTIme int64
600
-	if len(end_time) > 0 {
601
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
602
-		if err != nil {
603
-			utils.ErrorLog(err.Error())
604
-		}
605
-		theEndtTIme = theTime.Unix()
606
-	}
607
-
608
-	data, total, _ := statistics_service.GetBloodPressureTableData(adminUserInfo.Org.Id, patient_id, page, limit, theStartTIme, theEndtTIme)
609
-	this.ServeSuccessJSON(map[string]interface{}{
610
-		"data":  data,
611
-		"total": total,
612
-	})
613
-
614
-}
615
-func (this *IndexEvaluationApiController) GetDialysisPatientBloodPressureChartData() {
616
-	adminUserInfo := this.GetMobileAdminUserInfo()
617
-	statistics_type, _ := this.GetInt("statistics_type")
618
-	start_time := this.GetString("start_time")
619
-	end_time := this.GetString("end_time")
620
-	patient_id, _ := this.GetInt64("patient_id")
621
-
622
-	timeLayout := "2006-01-02"
623
-	loc, _ := time.LoadLocation("Local")
624
-
625
-	var theStartTIme int64
626
-	if len(start_time) > 0 {
627
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
628
-		if err != nil {
629
-			utils.ErrorLog(err.Error())
630
-		}
631
-		theStartTIme = theTime.Unix()
632
-	}
633
-	var theEndtTIme int64
634
-	if len(end_time) > 0 {
635
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
636
-		if err != nil {
637
-			utils.ErrorLog(err.Error())
638
-		}
639
-		theEndtTIme = theTime.Unix()
640
-	}
641
-
642
-	data, _ := statistics_service.GetPatientBloodPressureChartData(adminUserInfo.Org.Id, patient_id, theStartTIme, theEndtTIme, statistics_type)
643
-	this.ServeSuccessJSON(map[string]interface{}{
644
-		"data": data,
645
-	})
646
-
647
-}
648
-
649
-func (this *IndexEvaluationApiController) GetDialysisWeightChartData() {
650
-	adminUserInfo := this.GetMobileAdminUserInfo()
651
-	statistics_type, _ := this.GetInt("statistics_type")
652
-	start_time := this.GetString("start_time")
653
-	end_time := this.GetString("end_time")
654
-	timeLayout := "2006-01-02"
655
-	loc, _ := time.LoadLocation("Local")
656
-
657
-	var theStartTIme int64
658
-	if len(start_time) > 0 {
659
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
660
-		if err != nil {
661
-			utils.ErrorLog(err.Error())
662
-		}
663
-		theStartTIme = theTime.Unix()
664
-	}
665
-	var theEndtTIme int64
666
-	if len(end_time) > 0 {
667
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
668
-		if err != nil {
669
-			utils.ErrorLog(err.Error())
670
-		}
671
-		theEndtTIme = theTime.Unix()
672
-	}
673
-
674
-	data, _ := statistics_service.GetDialysisWeightChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, statistics_type)
675
-	this.ServeSuccessJSON(map[string]interface{}{
676
-		"data": data,
677
-	})
678
-
679
-}
680
-func (this *IndexEvaluationApiController) GetDialysisWeightTableData() {
681
-	adminUserInfo := this.GetMobileAdminUserInfo()
682
-	start_time := this.GetString("start_time")
683
-	end_time := this.GetString("end_time")
684
-	patient_id, _ := this.GetInt64("patient_id")
685
-	page, _ := this.GetInt64("page")
686
-	limit, _ := this.GetInt64("limit")
687
-
688
-	if page == 0 {
689
-		page = 1
690
-	}
691
-	if limit == 0 {
692
-		limit = 20
693
-	}
694
-	timeLayout := "2006-01-02"
695
-	loc, _ := time.LoadLocation("Local")
696
-
697
-	var theStartTIme int64
698
-	if len(start_time) > 0 {
699
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
700
-		if err != nil {
701
-			utils.ErrorLog(err.Error())
702
-		}
703
-		theStartTIme = theTime.Unix()
704
-	}
705
-	var theEndtTIme int64
706
-	if len(end_time) > 0 {
707
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
708
-		if err != nil {
709
-			utils.ErrorLog(err.Error())
710
-		}
711
-		theEndtTIme = theTime.Unix()
712
-	}
713
-
714
-	data, total, _ := statistics_service.GetDialysisWeightTableData(adminUserInfo.Org.Id, patient_id, page, limit, theStartTIme, theEndtTIme)
715
-	this.ServeSuccessJSON(map[string]interface{}{
716
-		"data":  data,
717
-		"total": total,
718
-	})
719
-}
720
-func (this *IndexEvaluationApiController) GetDialysisPatientWeightChartData() {
721
-	adminUserInfo := this.GetMobileAdminUserInfo()
722
-	statistics_type, _ := this.GetInt("statistics_type")
723
-	start_time := this.GetString("start_time")
724
-	end_time := this.GetString("end_time")
725
-	patient_id, _ := this.GetInt64("patient_id")
726
-
727
-	timeLayout := "2006-01-02"
728
-	loc, _ := time.LoadLocation("Local")
729
-
730
-	var theStartTIme int64
731
-	if len(start_time) > 0 {
732
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
733
-		if err != nil {
734
-			utils.ErrorLog(err.Error())
735
-		}
736
-		theStartTIme = theTime.Unix()
737
-	}
738
-	var theEndtTIme int64
739
-	if len(end_time) > 0 {
740
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
741
-		if err != nil {
742
-			utils.ErrorLog(err.Error())
743
-		}
744
-		theEndtTIme = theTime.Unix()
745
-	}
746
-
747
-	data, _ := statistics_service.GetPatientDialysisWeightChartData(adminUserInfo.Org.Id, patient_id, theStartTIme, theEndtTIme, statistics_type)
748
-	this.ServeSuccessJSON(map[string]interface{}{
749
-		"data": data,
750
-	})
751
-
752
-}
753
-
754
-func (this *IndexEvaluationApiController) GetDoctorWorkloadChartData() {
755
-	adminUserInfo := this.GetMobileAdminUserInfo()
756
-	statistics_type, _ := this.GetInt("statistics_type")
757
-	start_time := this.GetString("start_time")
758
-	admin_user_id, _ := this.GetInt64("admin_user_id")
759
-	end_time := this.GetString("end_time")
760
-	timeLayout := "2006-01-02"
761
-	loc, _ := time.LoadLocation("Local")
762
-
763
-	var theStartTIme int64
764
-	if len(start_time) > 0 {
765
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
766
-		if err != nil {
767
-			utils.ErrorLog(err.Error())
768
-		}
769
-		theStartTIme = theTime.Unix()
770
-	}
771
-	var theEndtTIme int64
772
-	if len(end_time) > 0 {
773
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
774
-		if err != nil {
775
-			utils.ErrorLog(err.Error())
776
-		}
777
-		theEndtTIme = theTime.Unix()
778
-	}
779
-
780
-	data, _ := statistics_service.GetDoctorWorkloadChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, statistics_type, admin_user_id)
781
-	this.ServeSuccessJSON(map[string]interface{}{
782
-		"data": data,
783
-	})
784
-
785
-}
786
-func (this *IndexEvaluationApiController) GetDoctorWorkloadTableData() {
787
-	adminUserInfo := this.GetMobileAdminUserInfo()
788
-	start_time := this.GetString("start_time")
789
-	end_time := this.GetString("end_time")
790
-	admin_user_id, _ := this.GetInt64("admin_user_id")
791
-	page, _ := this.GetInt64("page")
792
-	limit, _ := this.GetInt64("limit")
793
-
794
-	if page == 0 {
795
-		page = 1
796
-	}
797
-	if limit == 0 {
798
-		limit = 20
799
-	}
800
-	timeLayout := "2006-01-02"
801
-	loc, _ := time.LoadLocation("Local")
802
-
803
-	var theStartTIme int64
804
-	if len(start_time) > 0 {
805
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
806
-		if err != nil {
807
-			utils.ErrorLog(err.Error())
808
-		}
809
-		theStartTIme = theTime.Unix()
810
-	}
811
-	var theEndtTIme int64
812
-	if len(end_time) > 0 {
813
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
814
-		if err != nil {
815
-			utils.ErrorLog(err.Error())
816
-		}
817
-		theEndtTIme = theTime.Unix()
818
-	}
819
-	data, _ := statistics_service.GetDoctorWorkloadTableData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, admin_user_id)
820
-	this.ServeSuccessJSON(map[string]interface{}{
821
-		"data": data,
822
-	})
823
-}
824
-
825
-func (this *IndexEvaluationApiController) GetNurseWorkloadChartData() {
826
-	adminUserInfo := this.GetMobileAdminUserInfo()
827
-	statistics_type, _ := this.GetInt("statistics_type")
828
-	start_time := this.GetString("start_time")
829
-	admin_user_id, _ := this.GetInt64("admin_user_id")
830
-
831
-	end_time := this.GetString("end_time")
832
-	timeLayout := "2006-01-02"
833
-	loc, _ := time.LoadLocation("Local")
834
-
835
-	var theStartTIme int64
836
-	if len(start_time) > 0 {
837
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
838
-		if err != nil {
839
-			utils.ErrorLog(err.Error())
840
-		}
841
-		theStartTIme = theTime.Unix()
842
-	}
843
-	var theEndtTIme int64
844
-	if len(end_time) > 0 {
845
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
846
-		if err != nil {
847
-			utils.ErrorLog(err.Error())
848
-		}
849
-		theEndtTIme = theTime.Unix()
850
-	}
851
-
852
-	data, _ := statistics_service.GetNurseWorkloadChartData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, statistics_type, admin_user_id)
853
-	this.ServeSuccessJSON(map[string]interface{}{
854
-		"data": data,
855
-	})
856
-
857
-}
858
-func (this *IndexEvaluationApiController) GetNurseWorkloadTableData() {
859
-	adminUserInfo := this.GetMobileAdminUserInfo()
860
-	start_time := this.GetString("start_time")
861
-	end_time := this.GetString("end_time")
862
-	admin_user_id, _ := this.GetInt64("admin_user_id")
863
-	page, _ := this.GetInt64("page")
864
-	limit, _ := this.GetInt64("limit")
865
-
866
-	if page == 0 {
867
-		page = 1
868
-	}
869
-	if limit == 0 {
870
-		limit = 10
871
-	}
872
-	timeLayout := "2006-01-02"
873
-	loc, _ := time.LoadLocation("Local")
874
-
875
-	var theStartTIme int64
876
-	if len(start_time) > 0 {
877
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
878
-		if err != nil {
879
-			utils.ErrorLog(err.Error())
880
-		}
881
-		theStartTIme = theTime.Unix()
882
-	}
883
-	var theEndtTIme int64
884
-	if len(end_time) > 0 {
885
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
886
-		if err != nil {
887
-			utils.ErrorLog(err.Error())
888
-		}
889
-		theEndtTIme = theTime.Unix()
890
-	}
891
-	data, total, _ := statistics_service.GetNurseWorkloadTableData(adminUserInfo.Org.Id, theStartTIme, theEndtTIme, admin_user_id, page, limit)
892
-	dialysisCount, _ := statistics_service.GetOrderDialysisCount(adminUserInfo.Org.Id, theStartTIme, theEndtTIme)
893
-	this.ServeSuccessJSON(map[string]interface{}{
894
-		"data":          data,
895
-		"total":         total,
896
-		"dialysisCount": dialysisCount,
897
-	})
898
-}
899
-
900
-func (this *IndexEvaluationApiController) GetDefaultPatient() {
901
-	adminUserInfo := this.GetMobileAdminUserInfo()
902
-	patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.Org.Id)
903
-	if patientInfo == nil {
904
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
905
-		return
906
-	}
907
-
908
-	this.ServeSuccessJSON(map[string]interface{}{
909
-		"patient": patientInfo,
910
-	})
911
-
912
-}
913
-
914
-func (this *IndexEvaluationApiController) GetAllPatients() {
915
-	adminUserInfo := this.GetMobileAdminUserInfo()
916
-	patients, _ := statistics_service.GetOrgPatients(adminUserInfo.Org.Id)
917
-	if patients == nil {
918
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
919
-		return
920
-	}
921
-	this.ServeSuccessJSON(map[string]interface{}{
922
-		"patients": patients,
923
-	})
924
-
925
-}

+ 0 - 139
controllers/new_mobile_api_controllers/management_analyse_api_controller.go Просмотреть файл

@@ -1,139 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service/management_service"
6
-	service "XT_New/service/print_data_service/schedule_dialysis"
7
-	"XT_New/utils"
8
-	"time"
9
-)
10
-
11
-type ManagementAnalyseApiController struct {
12
-	NewMobileBaseAPIAuthController
13
-}
14
-
15
-func (this *ManagementAnalyseApiController) StockRecordPrintData() {
16
-	types, _ := this.GetInt("type", 0)
17
-	start_time := this.GetString("start_time")
18
-	end_time := this.GetString("end_time")
19
-	adminUserInfo := this.GetMobileAdminUserInfo()
20
-
21
-	timeLayout := "2006-01-02"
22
-	loc, _ := time.LoadLocation("Local")
23
-	var startTime int64
24
-	if len(start_time) > 0 {
25
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
26
-		if err != nil {
27
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
28
-			return
29
-		}
30
-		startTime = theTime.Unix()
31
-	}
32
-	var endTime int64
33
-	if len(end_time) > 0 {
34
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
35
-		if err != nil {
36
-			utils.ErrorLog(err.Error())
37
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
38
-			return
39
-		}
40
-		endTime = theTime.Unix()
41
-	}
42
-
43
-	list, err := service.FindPrintStockGoodInfoByType(types, startTime, endTime, adminUserInfo.Org.Id)
44
-
45
-	if err != nil {
46
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
47
-	} else {
48
-		this.ServeSuccessJSON(map[string]interface{}{
49
-			"list": list,
50
-			"type": types,
51
-		})
52
-	}
53
-}
54
-func (this *ManagementAnalyseApiController) StatisticsPatientChart() {
55
-	start_time := this.GetString("start_time")
56
-	end_time := this.GetString("end_time")
57
-	statistics_type, _ := this.GetInt("type", 0)
58
-
59
-	adminUserInfo := this.GetMobileAdminUserInfo()
60
-
61
-	timeLayout := "2006-01-02"
62
-	loc, _ := time.LoadLocation("Local")
63
-	var startTime int64
64
-	if len(start_time) > 0 {
65
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
66
-		if err != nil {
67
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
68
-			return
69
-		}
70
-		startTime = theTime.Unix()
71
-	}
72
-	var endTime int64
73
-	if len(end_time) > 0 {
74
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
75
-		if err != nil {
76
-			utils.ErrorLog(err.Error())
77
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
78
-			return
79
-		}
80
-		endTime = theTime.Unix()
81
-	}
82
-	data, total_one, _ := management_service.GetPatientChartData(adminUserInfo.Org.Id, startTime, endTime, statistics_type)
83
-	total, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, statistics_type)
84
-
85
-	total_three, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, 2)
86
-
87
-	this.ServeSuccessJSON(map[string]interface{}{
88
-		"chart_data":  data,
89
-		"total_one":   total_one,
90
-		"total":       total,
91
-		"total_three": total + total_three,
92
-	})
93
-
94
-}
95
-func (this *ManagementAnalyseApiController) StatisticsPatientTable() {
96
-	start_time := this.GetString("start_time")
97
-	end_time := this.GetString("end_time")
98
-	statistics_type, _ := this.GetInt("type", 0)
99
-	page, _ := this.GetInt64("page", 0)
100
-	limit, _ := this.GetInt64("limit", 0)
101
-
102
-	if page == 0 {
103
-		page = 1
104
-	}
105
-	if limit == 0 {
106
-		limit = 20
107
-	}
108
-
109
-	adminUserInfo := this.GetMobileAdminUserInfo()
110
-
111
-	timeLayout := "2006-01-02"
112
-	loc, _ := time.LoadLocation("Local")
113
-	var startTime int64
114
-	if len(start_time) > 0 {
115
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
116
-		if err != nil {
117
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
118
-			return
119
-		}
120
-		startTime = theTime.Unix()
121
-	}
122
-	var endTime int64
123
-	if len(end_time) > 0 {
124
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
125
-		if err != nil {
126
-			utils.ErrorLog(err.Error())
127
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
128
-			return
129
-		}
130
-		endTime = theTime.Unix()
131
-	}
132
-	data, total, _ := management_service.GetPatientTableData(adminUserInfo.Org.Id, page, limit, startTime, endTime, statistics_type)
133
-
134
-	this.ServeSuccessJSON(map[string]interface{}{
135
-		"data":  data,
136
-		"total": total,
137
-	})
138
-
139
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1283
controllers/new_mobile_api_controllers/mobile_his_api_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 1280
controllers/new_mobile_api_controllers/mobile_regist_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 2164
controllers/new_mobile_api_controllers/new_common_api_controller.go


+ 0 - 48
controllers/new_mobile_api_controllers/new_common_api_router.go Просмотреть файл

@@ -1,48 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import "github.com/astaxie/beego"
4
-
5
-func NewCommonApiControllersRegisterRouters() {
6
-
7
-	beego.Router("/m/api/gettotaldialysis", &NewCommonApiController{}, "Get:GetTotalDialysis")
8
-	beego.Router("/m/api/getmobiletotallapsecount", &NewCommonApiController{}, "Get:GetMobileTotalLapseCount")
9
-	beego.Router("/m/api/getmobiletotalsexcount", &NewCommonApiController{}, "Get:GetMobileTotalSexCount")
10
-	beego.Router("/m/api/getmobiletotalinfectiouscount", &NewCommonApiController{}, "Get:GetMobileTotalInfectiousCout")
11
-	beego.Router("/m/api/getmobiletotalagecount", &NewCommonApiController{}, "Get:GetMobileTotalAgeCount")
12
-	beego.Router("/m/api/getmobiletotaldialysiscount", &NewCommonApiController{}, "Get:GetMobileTotalDialysisCount")
13
-	beego.Router("/m/api/gemobilepatientlist", &NewCommonApiController{}, "Get:GetMobilePatientList")
14
-	beego.Router("/m/api/getprescriptionlist", &NewCommonApiController{}, "Get:GetPrescriptionlist")
15
-	beego.Router("/m/api/getmobilepatientdetail", &NewCommonApiController{}, "Get:GetMobilePatientDetail")
16
-	beego.Router("/m/api/tosearchpatient", &NewCommonApiController{}, "Get:ToSearchPatient")
17
-	beego.Router("/m/api/getallpatientsmode", &NewCommonApiController{}, "Get:GetAllPatientsMode")
18
-	beego.Router("/m/api/getmobileInspectionList", &NewCommonApiController{}, "Get:GetMobileInspectionList")
19
-	beego.Router("/m/api/getpatientinspectiondetail", &NewCommonApiController{}, "Get:GetPatientInspectionDetail")
20
-	beego.Router("m/api/getseachpatientdetail", &NewCommonApiController{}, "Get:GetSeachPatientDetail")
21
-	beego.Router("m/api/getmobilenormdata", &NewCommonApiController{}, "Get:GetMobileNormdata")
22
-	beego.Router("m/api/getmobileprojectlist", &NewCommonApiController{}, "Get:GetMobileProjectlsit")
23
-	beego.Router("/m/api/getmobilefirstquarter", &NewCommonApiController{}, "Get:GetMobileFirstQuarter")
24
-	beego.Router("/m/api/getmobilemonthprojectlist", &NewCommonApiController{}, "Get:GetMobileMonthProjectList")
25
-	beego.Router("/m/api/getallmobilemajorinspection", &NewCommonApiController{}, "Get:GetAllMobileMajorInspection")
26
-	beego.Router("/m/api/getmobilepatientlist", &NewCommonApiController{}, "Get:GetMobilePatient")
27
-	beego.Router("/m/api/getmobilepatientdetailcheck", &NewCommonApiController{}, "Get:GetMobilePatientDetailCheck")
28
-	beego.Router("/m/api/getmobilepatientcontrol", &NewCommonApiController{}, "Get:GetMobilePatientControl")
29
-	beego.Router("m/api/getmobilecartogramlist", &NewCommonApiController{}, "Get:GetMobileCartogramlist")
30
-	beego.Router("/m/api/getmobilequalitycontrol", &NewCommonApiController{}, "Get:GetMobileQualityControl")
31
-	beego.Router("/m/api/toseachpatientscontrol", &NewCommonApiController{}, "Get:GetSeachPatientsControl")
32
-	beego.Router("/m/api/getmobiletreatlist", &NewCommonApiController{}, "Get:GetMobileTreatlist")
33
-	beego.Router("/m/api/getlistpatientdetail", &NewCommonApiController{}, "Get:GetPatientComplianceDetail")
34
-	beego.Router("/m/api/getmobilebloodlist", &NewCommonApiController{}, "Get:GetMoblieBloodList")
35
-	beego.Router("/m/api/getbloodmonthlist", &NewCommonApiController{}, "Get:GetBloodMonthList")
36
-	beego.Router("/m/api/getquarterTargelist", &NewCommonApiController{}, "Get:GetQuarterTargeList")
37
-	beego.Router("/m/api/getmonthtarge", &NewCommonApiController{}, "Get:GetMonthTarget")
38
-	beego.Router("/m/api/getquarterbloodlist", &NewCommonApiController{}, "Get:GetQuarterBloodList")
39
-	beego.Router("/m/api/getmonthbloolist", &NewCommonApiController{}, "Get:GetMonthBLoodList")
40
-	beego.Router("/m/api/gettargetnostanddetail", &NewCommonApiController{}, "Get:GetTargetNoStandDetail")
41
-	beego.Router("/m/api/gettargestanddetail", &NewCommonApiController{}, "Get:GetTargetStandDetail")
42
-	beego.Router("/m/api/getsystolicbloodstand", &NewCommonApiController{}, "Get:GetSystolicBloodStand")
43
-	beego.Router("/m/api/getmobileidslist", &NewCommonApiController{}, "post:GetMobileIdsList")
44
-	beego.Router("/m/api/getsystolicbloodnostand", &NewCommonApiController{}, "Get:GetSystolicBloodNoStand")
45
-	beego.Router("/m/api/getmobiletreatmodelist", &NewCommonApiController{}, "Get:GetMobileTreatModeList")
46
-	beego.Router("/m/api/getmobileCountModeId", &NewCommonApiController{}, "Get:GetMobileCountModeId")
47
-	beego.Router("/m/api/getmobilerolloutcount", &NewCommonApiController{}, "Get:GetMobileRolloutCount")
48
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 2897
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go


+ 0 - 599
controllers/new_mobile_api_controllers/new_login_api_controller.go Просмотреть файл

@@ -1,599 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"XT_New/utils"
9
-	"encoding/json"
10
-	"fmt"
11
-	"github.com/astaxie/beego"
12
-	"io/ioutil"
13
-	"net/http"
14
-	"net/url"
15
-	"strconv"
16
-	"strings"
17
-	"time"
18
-)
19
-
20
-type NewLoginApiController struct {
21
-	mobile_api_controllers.MobileBaseAPIController
22
-}
23
-
24
-func (this *NewLoginApiController) GetLogin() {
25
-	token_cookie := this.Ctx.GetCookie("token_cookie")
26
-
27
-	if len(token_cookie) == 0 {
28
-		this.ServeSuccessJSON(map[string]interface{}{
29
-			"isLogin": false,
30
-		})
31
-		this.ServeJSON()
32
-	} else {
33
-		//从cookie中分离出,手机号码,机构id,角色id,
34
-		cookieStr := token_cookie[24:]
35
-		cookieArr := strings.Split(cookieStr, "-")
36
-		mobile := cookieArr[0]
37
-		org_id, _ := strconv.ParseInt(cookieArr[1], 10, 64)
38
-		role_id, _ := strconv.ParseInt(cookieArr[2], 10, 64)
39
-		adminUser, getAdminErr := service.GetValidAdminUserByMobileReturnErr(mobile)
40
-		if getAdminErr != nil {
41
-			utils.ErrorLog("获取管理员失败:%v", getAdminErr)
42
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
43
-			this.ServeJSON()
44
-			return
45
-		} else if adminUser == nil {
46
-			utils.ErrorLog("查找不到 mobile = %v 的用户", mobile)
47
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
48
-			this.ServeJSON()
49
-			return
50
-		} else {
51
-			var appRole *models.App_Role
52
-			var org *models.Org
53
-			var app *models.OrgApp
54
-			var templateInfo models.GobalTemplate
55
-			var configList interface{}
56
-			var dict_configList interface{}
57
-
58
-			var FiledList []*models.FiledConfig
59
-
60
-			var getAppRoleErr error
61
-			var getOrgErr error
62
-			var getAppErr error
63
-
64
-			if role_id > 0 {
65
-				appRole, getAppRoleErr = service.GetAppRoleById(role_id)
66
-				if getAppRoleErr != nil {
67
-					utils.ErrorLog("获取 app_role 失败:%v", getAppRoleErr)
68
-					this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
69
-					this.ServeJSON()
70
-					return
71
-				}
72
-
73
-				app, getAppErr = service.GetAppById(appRole.AppId)
74
-				if getAppErr != nil {
75
-					utils.ErrorLog("获取APP失败:%v", getOrgErr)
76
-					this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
77
-					this.ServeJSON()
78
-					return
79
-				}
80
-			}
81
-
82
-			if org_id > 0 {
83
-				org, getOrgErr = service.GetOrgById(org_id)
84
-				if getOrgErr != nil {
85
-					utils.ErrorLog("获取机构失败:%v", getOrgErr)
86
-					this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeDataException)
87
-					this.ServeJSON()
88
-					return
89
-				}
90
-				templateInfo, _ = service.GetOrgInfoTemplate(org.Id)
91
-				configList, _ = service.GetConfigList(org.Id)
92
-				dict_configList, _ = service.GetDictConfigList(org.Id)
93
-
94
-				FiledList, _ = service.FindFiledByOrgId(org.Id)
95
-			}
96
-
97
-			mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
98
-				AdminUser:    adminUser,
99
-				Org:          org,
100
-				App:          app,
101
-				AppRole:      appRole,
102
-				TemplateInfo: &templateInfo,
103
-			}
104
-			fmt.Println(this.GetSession("mobile_admin_user_info"))
105
-
106
-			if this.GetSession("mobile_admin_user_info") == nil {
107
-				this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
108
-			}
109
-			fmt.Println(this.GetSession("mobile_admin_user_info"))
110
-
111
-			this.ServeSuccessJSON(map[string]interface{}{
112
-				"admin": adminUser,
113
-				"user":  appRole,
114
-				"org":   org,
115
-				"app":   app,
116
-				"template_info": map[string]interface{}{
117
-					"id":          templateInfo.ID,
118
-					"org_id":      templateInfo.OrgId,
119
-					"template_id": templateInfo.TemplateId,
120
-				},
121
-				"config_list":      configList,
122
-				"dict_config_list": dict_configList,
123
-
124
-				"filed_list": FiledList,
125
-				"isLogin":    true,
126
-			})
127
-
128
-			this.ServeJSON()
129
-		}
130
-	}
131
-
132
-}
133
-
134
-func (this *NewLoginApiController) GetCodeInit() {
135
-	redisClient := service.RedisClient()
136
-	defer redisClient.Close()
137
-	req := this.Ctx.Request
138
-	addr := utils.GetIP(req)
139
-	cur_time := time.Now().Format("2006-01-02")
140
-	_, err := redisClient.Get("ip:host_" + cur_time + "_" + addr).Result()
141
-	if err != nil {
142
-		redisClient.Set("ip:host_"+cur_time+"_"+addr, 0, time.Second*24*60*60)
143
-	}
144
-	//将客户端的ip加密传给前端,作为短信验证的密钥,来验证短信发送的IP地址
145
-	aespass := utils.AESEncrypt(addr)
146
-	//this.Data["aespass"] = aespass
147
-
148
-	this.ServeSuccessJSON(map[string]interface{}{
149
-		"aespass": aespass,
150
-	})
151
-
152
-}
153
-
154
-func (this *NewLoginApiController) LoginByCs() {
155
-	mobile := this.GetString("mobile")
156
-	code := this.GetString("code")
157
-	//pwd := this.GetString("password")
158
-	if len(mobile) == 0 || len(code) == 0 || utils.CellPhoneRegexp().MatchString(mobile) == false {
159
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
160
-		return
161
-	}
162
-	if !service.IsMobileRegister(mobile) {
163
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
164
-		this.ServeJSON()
165
-		return
166
-	}
167
-
168
-	if code == "13535547901" {
169
-		ip := utils.GetIP(this.Ctx.Request)
170
-		ssoDomain := beego.AppConfig.String("sso_domain")
171
-		api := ssoDomain + "/m/login/code"
172
-		values := make(url.Values)
173
-		values.Set("mobile", mobile)
174
-		values.Set("app_type", "3")
175
-		values.Set("ip", ip)
176
-		resp, requestErr := http.PostForm(api, values)
177
-
178
-		if requestErr != nil {
179
-			utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
180
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
181
-			return
182
-		}
183
-		defer resp.Body.Close()
184
-		body, ioErr := ioutil.ReadAll(resp.Body)
185
-		if ioErr != nil {
186
-			utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
187
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
188
-			return
189
-		}
190
-		var respJSON map[string]interface{}
191
-		utils.InfoLog(string(body))
192
-		if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
193
-			utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
194
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
195
-			return
196
-		}
197
-
198
-		if respJSON["state"].(float64) != 1 {
199
-			msg := respJSON["msg"].(string)
200
-			utils.ErrorLog("SSO登录接口请求失败: %v", msg)
201
-			if int(respJSON["code"].(float64)) == 609 {
202
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
203
-				return
204
-			}
205
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
206
-			return
207
-		} else {
208
-			utils.SuccessLog("SSO登录成功")
209
-			// 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
210
-			userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
211
-			userJSONBytes, _ := json.Marshal(userJSON)
212
-			var adminUser models.AdminUser
213
-			if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
214
-				utils.ErrorLog("解析管理员失败:%v", err)
215
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
216
-				return
217
-			}
218
-
219
-			var org models.Org
220
-			if respJSON["data"].(map[string]interface{})["org"] != nil {
221
-				orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
222
-				orgJSONBytes, _ := json.Marshal(orgJSON)
223
-				if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
224
-					utils.ErrorLog("解析机构失败:%v", err)
225
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
226
-					return
227
-				}
228
-			}
229
-
230
-			var app models.OrgApp
231
-
232
-			if respJSON["data"].(map[string]interface{})["app"] != nil {
233
-				appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
234
-				appJSONBytes, _ := json.Marshal(appJSON)
235
-				if err := json.Unmarshal(appJSONBytes, &app); err != nil {
236
-					utils.ErrorLog("解析应用失败:%v", err)
237
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
238
-					return
239
-				}
240
-			}
241
-
242
-			var appRole models.App_Role
243
-
244
-			if respJSON["data"].(map[string]interface{})["app_role"] != nil {
245
-				appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
246
-				appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
247
-				if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
248
-					utils.ErrorLog("解析AppRole失败:%v", err)
249
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
250
-					return
251
-				}
252
-			}
253
-
254
-			var subscibe models.ServeSubscibe
255
-			if respJSON["data"].(map[string]interface{})["subscibe"] != nil {
256
-				subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
257
-				subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
258
-				if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
259
-					utils.ErrorLog("解析Subscibe失败:%v", err)
260
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
261
-					return
262
-				}
263
-
264
-			}
265
-
266
-			//service.GetOrgSubscibeState(&subscibe)
267
-			templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
268
-
269
-			mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
270
-				AdminUser:    &adminUser,
271
-				Org:          &org,
272
-				App:          &app,
273
-				AppRole:      &appRole,
274
-				Subscibe:     &subscibe,
275
-				TemplateInfo: &templateInfo,
276
-			}
277
-			this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
278
-
279
-			mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
280
-			token := utils.GenerateLoginToken(mobile)
281
-			expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
282
-			this.Ctx.SetCookie("token_cookie", token, expiration, "/")
283
-
284
-			var configList interface{}
285
-			var dict_configList interface{}
286
-
287
-			var FiledList []*models.FiledConfig
288
-
289
-			if org.Id > 0 {
290
-				dict_configList, _ = service.GetDictConfigList(org.Id)
291
-
292
-				configList, _ = service.GetConfigList(org.Id)
293
-				FiledList, _ = service.FindFiledByOrgId(org.Id)
294
-			}
295
-			if len(FiledList) == 0 {
296
-				var err error
297
-				if org.Id > 0 {
298
-					err = service.BatchInsertFiledConfig(org.Id)
299
-					if err == nil {
300
-						FiledList, _ = service.FindFiledByOrgId(org.Id)
301
-					} else {
302
-						utils.ErrorLog("字段批量插入失败:%v", err)
303
-					}
304
-				} else {
305
-					FiledList = make([]*models.FiledConfig, 0)
306
-				}
307
-			}
308
-
309
-			if org.Id > 0 {
310
-				//产寻该机构是否有收缩压和舒张压
311
-				pressure, err := service.GetDefaultSystolicPressure(org.Id)
312
-				fmt.Println(err)
313
-				if len(pressure) == 0 {
314
-					err = service.BathInsertQualityControlTwo(org.Id)
315
-				} else {
316
-					utils.ErrorLog("字段批量插入失败:%v", err)
317
-				}
318
-				major, requestErr := service.GetInspectionMajor(org.Id)
319
-				if len(major) == 0 {
320
-					QualityeList, err := service.FindQualityByOrgId(org.Id)
321
-					if len(QualityeList) == 0 {
322
-						err = service.BatchInsertQualityControl(org.Id)
323
-
324
-					} else {
325
-						utils.ErrorLog("字段批量插入失败0:%v", err)
326
-					}
327
-
328
-					InspectionList, err := service.FindeInspectionByOrgId(org.Id)
329
-					if len(InspectionList) == 0 {
330
-						err = service.BatchInspectionConfiguration(org.Id)
331
-					} else {
332
-						utils.ErrorLog("字段批量插入失败0:%v", err)
333
-					}
334
-				} else {
335
-					utils.ErrorLog("字段批量插入失败0:%v", requestErr)
336
-				}
337
-
338
-			}
339
-
340
-			this.ServeSuccessJSON(map[string]interface{}{
341
-				"admin": adminUser,
342
-				"user": map[string]interface{}{
343
-					"id":         appRole.Id,
344
-					"user_name":  appRole.UserName,
345
-					"avatar":     appRole.Avatar,
346
-					"intro":      appRole.Intro,
347
-					"user_type":  appRole.UserType,
348
-					"user_title": appRole.UserTitle,
349
-				},
350
-				"org": map[string]interface{}{
351
-					"id":             org.Id,
352
-					"org_name":       org.OrgName,
353
-					"org_short_name": org.OrgShortName,
354
-					"org_intro":      org.OrgIntroduction,
355
-					"org_logo":       org.OrgLogo,
356
-					"province":       org.Province,
357
-					"city":           org.City,
358
-					"district":       org.District,
359
-					"address":        org.Address,
360
-					"creator":        org.Creator,
361
-				},
362
-				"subscibe": map[string]interface{}{
363
-					"id":           subscibe.ID,
364
-					"period_start": subscibe.PeriodStart,
365
-					"period_end":   subscibe.PeriodEnd,
366
-					"state":        subscibe.State,
367
-				}, "template_info": map[string]interface{}{
368
-					"id":          templateInfo.ID,
369
-					"org_id":      templateInfo.OrgId,
370
-					"template_id": templateInfo.TemplateId,
371
-				},
372
-				"config_list":      configList,
373
-				"dict_config_list": dict_configList,
374
-
375
-				"filed_list": FiledList,
376
-			})
377
-		}
378
-	} else {
379
-
380
-		redisClient := service.RedisClient()
381
-		defer redisClient.Close()
382
-		cachedCode, err := redisClient.Get("code_msg_" + mobile).Result()
383
-
384
-		if err != nil {
385
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
386
-			this.ServeJSON()
387
-			return
388
-
389
-		} else {
390
-			if code != cachedCode {
391
-				this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeAccountOrVerCodeWrong)
392
-				this.ServeJSON()
393
-				return
394
-			} else {
395
-
396
-				ip := utils.GetIP(this.Ctx.Request)
397
-
398
-				ssoDomain := beego.AppConfig.String("sso_domain")
399
-				api := ssoDomain + "/m/login/code"
400
-				values := make(url.Values)
401
-				values.Set("mobile", mobile)
402
-				values.Set("app_type", "3")
403
-				values.Set("ip", ip)
404
-				resp, requestErr := http.PostForm(api, values)
405
-
406
-				if requestErr != nil {
407
-					utils.ErrorLog("请求SSO登录接口失败: %v", requestErr)
408
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
409
-					return
410
-				}
411
-				defer resp.Body.Close()
412
-				body, ioErr := ioutil.ReadAll(resp.Body)
413
-				if ioErr != nil {
414
-					utils.ErrorLog("SSO登录接口返回数据读取失败: %v", ioErr)
415
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
416
-					return
417
-				}
418
-				var respJSON map[string]interface{}
419
-				utils.InfoLog(string(body))
420
-				if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
421
-					utils.ErrorLog("SSO登录接口返回数据解析JSON失败: %v", err)
422
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
423
-					return
424
-				}
425
-
426
-				if respJSON["state"].(float64) != 1 {
427
-					msg := respJSON["msg"].(string)
428
-					utils.ErrorLog("SSO登录接口请求失败: %v", msg)
429
-					if int(respJSON["code"].(float64)) == 609 {
430
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
431
-						return
432
-					}
433
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
434
-					return
435
-				} else {
436
-					utils.SuccessLog("SSO登录成功")
437
-					// 下面这几段 Map=>JSON=>Struct 的流程可能会造成速度很慢
438
-					userJSON := respJSON["data"].(map[string]interface{})["admin"].(map[string]interface{})
439
-					userJSONBytes, _ := json.Marshal(userJSON)
440
-					var adminUser models.AdminUser
441
-					if err := json.Unmarshal(userJSONBytes, &adminUser); err != nil {
442
-						utils.ErrorLog("解析管理员失败:%v", err)
443
-						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
444
-						return
445
-					}
446
-					var org models.Org
447
-					if respJSON["data"].(map[string]interface{})["org"] != nil {
448
-						orgJSON := respJSON["data"].(map[string]interface{})["org"].(map[string]interface{})
449
-						orgJSONBytes, _ := json.Marshal(orgJSON)
450
-						if err := json.Unmarshal(orgJSONBytes, &org); err != nil {
451
-							utils.ErrorLog("解析机构失败:%v", err)
452
-							this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
453
-							return
454
-						}
455
-					}
456
-					var app models.OrgApp
457
-					if respJSON["data"].(map[string]interface{})["app"] != nil {
458
-						appJSON := respJSON["data"].(map[string]interface{})["app"].(map[string]interface{})
459
-						appJSONBytes, _ := json.Marshal(appJSON)
460
-						if err := json.Unmarshal(appJSONBytes, &app); err != nil {
461
-							utils.ErrorLog("解析应用失败:%v", err)
462
-							this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
463
-							return
464
-						}
465
-					}
466
-					var appRole models.App_Role
467
-					if respJSON["data"].(map[string]interface{})["app_role"] != nil {
468
-						appRoleJSON := respJSON["data"].(map[string]interface{})["app_role"].(map[string]interface{})
469
-						appRoleJSONBytes, _ := json.Marshal(appRoleJSON)
470
-						if err := json.Unmarshal(appRoleJSONBytes, &appRole); err != nil {
471
-							utils.ErrorLog("解析AppRole失败:%v", err)
472
-							this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
473
-							return
474
-						}
475
-					}
476
-					var subscibe models.ServeSubscibe
477
-					if respJSON["data"].(map[string]interface{})["subscibe"] != nil {
478
-						subscibeJSON := respJSON["data"].(map[string]interface{})["subscibe"].(map[string]interface{})
479
-						subscibeJSONBytes, _ := json.Marshal(subscibeJSON)
480
-						if err := json.Unmarshal(subscibeJSONBytes, &subscibe); err != nil {
481
-							utils.ErrorLog("解析Subscibe失败:%v", err)
482
-							this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
483
-							return
484
-						}
485
-					}
486
-
487
-					service.GetOrgSubscibeState(&subscibe)
488
-					templateInfo, _ := service.GetOrgInfoTemplate(org.Id)
489
-
490
-					mobileAdminUserInfo := &mobile_api_controllers.MobileAdminUserInfo{
491
-						AdminUser:    &adminUser,
492
-						Org:          &org,
493
-						App:          &app,
494
-						AppRole:      &appRole,
495
-						Subscibe:     &subscibe,
496
-						TemplateInfo: &templateInfo,
497
-					}
498
-					this.SetSession("mobile_admin_user_info", mobileAdminUserInfo)
499
-					redisClient.Del("code_msg_" + mobile)
500
-
501
-					mobile = mobile + "-" + strconv.FormatInt(org.Id, 10) + "-" + strconv.FormatInt(appRole.Id, 10)
502
-					token := utils.GenerateLoginToken(mobile)
503
-					expiration, _ := beego.AppConfig.Int64("mobile_token_expiration_second")
504
-					this.Ctx.SetCookie("token_cookie", token, expiration, "/")
505
-
506
-					configList, _ := service.GetConfigList(org.Id)
507
-					dict_configList, _ := service.GetDictConfigList(org.Id)
508
-
509
-					var FiledList []*models.FiledConfig
510
-					FiledList, _ = service.FindFiledByOrgId(org.Id)
511
-					if len(FiledList) == 0 {
512
-						var err error
513
-						if org.Id > 0 {
514
-							err = service.BatchInsertFiledConfig(org.Id)
515
-							if err == nil {
516
-								FiledList, _ = service.FindFiledByOrgId(org.Id)
517
-							} else {
518
-								utils.ErrorLog("字段批量插入失败:%v", err)
519
-							}
520
-						} else {
521
-							FiledList = make([]*models.FiledConfig, 0)
522
-						}
523
-					}
524
-
525
-					this.ServeSuccessJSON(map[string]interface{}{
526
-						"user": map[string]interface{}{
527
-							"id":         adminUser.Id,
528
-							"mobile":     adminUser.Mobile,
529
-							"user_name":  appRole.UserName,
530
-							"avatar":     appRole.Avatar,
531
-							"intro":      appRole.Intro,
532
-							"user_type":  appRole.UserType,
533
-							"user_title": appRole.UserTitle,
534
-						},
535
-						"org": map[string]interface{}{
536
-							"id":             org.Id,
537
-							"org_name":       org.OrgName,
538
-							"org_short_name": org.OrgShortName,
539
-							"org_intro":      org.OrgIntroduction,
540
-							"org_logo":       org.OrgLogo,
541
-							"province":       org.Province,
542
-							"city":           org.City,
543
-							"district":       org.District,
544
-							"address":        org.Address,
545
-							"creator":        org.Creator,
546
-						},
547
-						"subscibe": map[string]interface{}{
548
-							"id":           subscibe.ID,
549
-							"period_start": subscibe.PeriodStart,
550
-							"period_end":   subscibe.PeriodEnd,
551
-							"state":        subscibe.State,
552
-						}, "template_info": map[string]interface{}{
553
-							"id":          templateInfo.ID,
554
-							"org_id":      templateInfo.OrgId,
555
-							"template_id": templateInfo.TemplateId,
556
-						},
557
-						"config_list":      configList,
558
-						"dict_config_list": dict_configList,
559
-
560
-						"filed_list": FiledList,
561
-					})
562
-				}
563
-
564
-			}
565
-		}
566
-	}
567
-}
568
-
569
-func (this *NewLoginApiController) GetCode() {
570
-	mobile := this.GetString("phone")
571
-	aespass := this.GetString("aespass")
572
-	types, _ := this.GetInt("type", 0)
573
-	utils.TraceLog("mobile:%v aespass:%v", mobile, aespass)
574
-	if utils.CellPhoneRegexp().MatchString(mobile) == false {
575
-		this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeMobileFormat)
576
-		this.ServeJSON()
577
-		return
578
-	}
579
-
580
-	if types == 1 {
581
-		adminUser, _ := service.GetValidAdminUserByMobileReturnErr(mobile)
582
-		if adminUser != nil {
583
-			this.Data["json"] = enums.MakeFailResponseJSONWithSGJErrorCode(enums.ErrorCodeRegisterExist)
584
-			this.ServeJSON()
585
-			return
586
-		}
587
-	}
588
-
589
-	if err := service.SendVerificationCodeSMS(mobile, aespass); err != nil {
590
-		this.Data["json"] = enums.MakeFailResponseJSON(err.Error(), 600)
591
-		this.ServeJSON()
592
-	} else {
593
-		this.Data["json"] = enums.MakeSuccessResponseJSON(map[string]interface{}{
594
-			"msg": "短信发送成功,有效期为10分钟",
595
-		})
596
-		this.ServeJSON()
597
-	}
598
-
599
-}

+ 0 - 263
controllers/new_mobile_api_controllers/new_manage_api_controller.go Просмотреть файл

@@ -1,263 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/models"
7
-	"XT_New/service"
8
-	"XT_New/utils"
9
-	"fmt"
10
-	"github.com/jinzhu/gorm"
11
-	"strconv"
12
-	"time"
13
-)
14
-
15
-type NewManageApiController struct {
16
-	mobile_api_controllers.MobileBaseAPIAuthController
17
-}
18
-
19
-func (this *NewManageApiController) GetEquitAutoInfo() {
20
-
21
-	adminUser := this.GetMobileAdminUserInfo()
22
-	orgid := adminUser.Org.Id
23
-	remander, err := service.GetRemanderData(orgid)
24
-
25
-	if err != nil {
26
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
27
-		return
28
-	}
29
-	this.ServeSuccessJSON(map[string]interface{}{
30
-		"remander": remander,
31
-	})
32
-}
33
-
34
-func (this *NewManageApiController) GetDisInfectionTime() {
35
-	adminUser := this.GetMobileAdminUserInfo()
36
-	orgid := adminUser.Org.Id
37
-	bedid, _ := this.GetInt64("bed_id")
38
-	scheduletype, _ := this.GetInt64("schedule_type")
39
-	scheduleweek, _ := this.GetInt64("schedule_week")
40
-	fmt.Println(scheduleweek)
41
-	scheduledate, _ := this.GetInt64("schedule_date")
42
-
43
-	//根据床位号获取设备型号
44
-	unitType, _ := service.GetUnitType(bedid, orgid)
45
-	//查询使用登记最后一条消毒记录
46
-	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid, scheduledate, scheduletype)
47
-	fmt.Println("err", err)
48
-	if err == gorm.ErrRecordNotFound {
49
-		//查询改设备是否有消毒计划
50
-		plan, errcode := service.GetDisInfectionTime(orgid, unitType.UnitType, scheduletype, scheduleweek)
51
-		//如果没有消毒计划,去查询该设备的上次消毒时间
52
-		if errcode == gorm.ErrRecordNotFound {
53
-			infor, errco := service.GetLaseDeviceInfomationTwo(orgid, bedid, scheduletype)
54
-			if errco != nil {
55
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
56
-				return
57
-			}
58
-			this.ServeSuccessJSON(map[string]interface{}{
59
-				"plan": infor.LongTime,
60
-			})
61
-		} else if errcode == nil {
62
-			this.ServeSuccessJSON(map[string]interface{}{
63
-				"plan": plan.DisinfecTime,
64
-			})
65
-		}
66
-	} else if err == nil {
67
-		this.ServeSuccessJSON(map[string]interface{}{
68
-			"plan":       infomation.LongTime,
69
-			"infomation": infomation,
70
-		})
71
-	}
72
-	//查询改设备是否有消毒计划
73
-	//plan, err := service.GetDisInfectionTime(orgid, bedid, scheduletype, scheduleweek)
74
-	//if err == gorm.ErrRecordNotFound {
75
-	//	//去查询使用登记最后一条数据
76
-	//	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid)
77
-	//	if err != nil {
78
-	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
79
-	//		return
80
-	//	}
81
-	//	this.ServeSuccessJSON(map[string]interface{}{
82
-	//		"plan": infomation.LongTime,
83
-	//	})
84
-	//} else if err == nil {
85
-	//	if err != nil {
86
-	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
87
-	//		return
88
-	//	}
89
-	//	this.ServeSuccessJSON(map[string]interface{}{
90
-	//		"plan": plan.DisinfecTime,
91
-	//	})
92
-	//} else {
93
-	//
94
-	//}
95
-
96
-}
97
-
98
-func (this *NewManageApiController) SaveDisInfectionInfo() {
99
-	adminUser := this.GetMobileAdminUserInfo()
100
-	orgid := adminUser.Org.Id
101
-	bedid, _ := this.GetInt64("bed_id")
102
-	start_time := this.GetString("start_time")
103
-	//startdate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", start_time)
104
-	//startdateunix := startdate.Unix()
105
-	disinfectime, _ := this.GetInt64("disinfec_time")
106
-	endtime := this.GetString("end_time")
107
-	//enddate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04", endtime)
108
-	//enddateunix := enddate.Unix()
109
-
110
-	scheduledate, _ := this.GetInt64("schedule_date")
111
-	zoneid, _ := this.GetInt64("zone_id")
112
-	patientid, _ := this.GetInt64("patient_id")
113
-	modeid, _ := this.GetInt64("mode_id")
114
-	scheduletype, _ := this.GetInt64("schedule_type")
115
-	timeLayout := "2006-01-02"
116
-	loc, _ := time.LoadLocation("Local")
117
-	var startdateunix int64
118
-	if len(start_time) > 0 {
119
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04", start_time, loc)
120
-		if err != nil {
121
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
122
-			return
123
-		}
124
-		startdateunix = theTime.Unix()
125
-	}
126
-	var enddateunix int64
127
-	if len(endtime) > 0 {
128
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04", endtime, loc)
129
-		if err != nil {
130
-			utils.ErrorLog(err.Error())
131
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
132
-			return
133
-		}
134
-		enddateunix = theTime.Unix()
135
-	}
136
-
137
-	//查询病人信息
138
-	patients, _ := service.GetPatientInfoMation(patientid)
139
-	var con = ""
140
-	if patients.IsInfectious == 0 {
141
-		con = ""
142
-	}
143
-	if patients.IsInfectious == 1 {
144
-		con = "无"
145
-	}
146
-	if patients.IsInfectious == 2 {
147
-		con = "有"
148
-	}
149
-	//查询病人上机信息
150
-	order, _ := service.GetPatientOrderInfo(scheduledate, patientid, orgid)
151
-	//查询病人今日透后评估数据
152
-	dislysis, _ := service.GetAssessmentAfterDissDataTwo(patientid, orgid, scheduledate)
153
-	fmt.Println("透析减少", dislysis.WeightLoss)
154
-	//			//根据床位号获取设备id
155
-	addmacher, _ := service.GetEquimentIDTwo(bedid, orgid)
156
-	//unitype, _ := strconv.ParseInt(addmacher.UnitType, 10, 64)
157
-	//fmt.Println(unitype)
158
-	plan, errplan := service.GetDisinfectionTwo(addmacher.UnitType, scheduletype, orgid)
159
-	//counts, errplan := service.GetUserTotalCount(orgid, bedid)
160
-	//var usertoal  int64
161
-	//fmt.Println(usertoal)
162
-	//for index, count := range counts {
163
-	//   if(index == 0){
164
-	//      usertoal = count.Total
165
-	//   }
166
-	//}
167
-	//usertotalint, errplan := strconv.ParseInt(addmacher.UserTotal, 10, 64)
168
-	//var total = usertoal + usertotalint
169
-	//totals := strconv.FormatInt(total, 10)
170
-	if errplan == gorm.ErrRecordNotFound {
171
-		returnData := make(map[string]interface{}, 0)
172
-		returnData["msstatus"] = "2"
173
-		this.ServeSuccessJSON(returnData)
174
-		return
175
-	} else {
176
-		_, errcode := service.GetInforTwo(patientid, scheduledate, orgid, scheduletype)
177
-		if errcode == gorm.ErrRecordNotFound {
178
-			information := models.DeviceInformation{
179
-				Date:                  scheduledate,
180
-				Zone:                  zoneid,
181
-				Class:                 scheduletype,
182
-				BedNumber:             bedid,
183
-				PatientId:             patientid,
184
-				DialysisMode:          modeid,
185
-				LongTime:              strconv.FormatInt(disinfectime, 10),
186
-				Disinfection:          1,
187
-				DialysisConcentration: 1,
188
-				DisinfectionStatus:    1,
189
-				Move:                  1,
190
-				UserOrgId:             orgid,
191
-				DisinfectType:         plan.Way,
192
-				DisinfectantType:      plan.MachineDisinfectant,
193
-				FluidPath:             plan.DisinfectanWay, //液路消毒方式
194
-				Disinfectant:          plan.Disinfectant,
195
-				Ctime:                 time.Now().Unix(),
196
-				Status:                1,
197
-				SignName:              order.FinishNurse,
198
-				EquimentId:            addmacher.ID,
199
-				DisinfectionResidue:   2,
200
-				Bed:                   addmacher.BedNumber,
201
-				StartTime:             order.StartTime,
202
-				EndTime:               order.EndTime,
203
-				Contagion:             con,
204
-				WeightLoss:            dislysis.WeightLoss,
205
-				Hyperfiltratio:        dislysis.ActualUltrafiltration,
206
-				DialysisHour:          strconv.FormatInt(dislysis.ActualTreatmentHour, 10),
207
-				MachineRun:            1,
208
-				DisinfecStartime:      startdateunix,
209
-				DisinfecEndtime:       enddateunix,
210
-			}
211
-			err := service.CreateInformationTwo(&information)
212
-			fmt.Println("报错", err)
213
-			if err != nil {
214
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
215
-				return
216
-			}
217
-			this.ServeSuccessJSON(map[string]interface{}{
218
-				"information": information,
219
-			})
220
-		} else if errcode == nil {
221
-			information := models.DeviceInformation{
222
-				DisinfecStartime: startdateunix,
223
-				DisinfecEndtime:  enddateunix,
224
-				LongTime:         strconv.FormatInt(disinfectime, 10),
225
-			}
226
-
227
-			errcode := service.UpdateInformation(&information, scheduledate, bedid, scheduletype)
228
-			if errcode != nil {
229
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
230
-				return
231
-			}
232
-			this.ServeSuccessJSON(map[string]interface{}{
233
-				"information": information,
234
-			})
235
-		} else {
236
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
237
-			return
238
-		}
239
-	}
240
-}
241
-
242
-func (this *NewManageApiController) GetDeviceInformation() {
243
-
244
-	adminUser := this.GetMobileAdminUserInfo()
245
-	orgid := adminUser.Org.Id
246
-
247
-	scheduleDate := this.GetString("schedule_date")
248
-	recordDate, parseErr := utils.ParseTimeStringToTime("2006-01-02", scheduleDate)
249
-	if parseErr != nil {
250
-		this.ErrorLog("时间解析失败:%v", parseErr)
251
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
252
-		return
253
-	}
254
-	//查询今日所有设备使用登记
255
-	information, err := service.GetDeviceInfomation(orgid, recordDate.Unix())
256
-	if err != nil {
257
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
258
-		return
259
-	}
260
-	this.ServeSuccessJSON(map[string]interface{}{
261
-		"information": information,
262
-	})
263
-}

+ 0 - 11
controllers/new_mobile_api_controllers/new_manage_api_router.go Просмотреть файл

@@ -1,11 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import "github.com/astaxie/beego"
4
-
5
-func NewManageApiControllersRegisterRouters() {
6
-
7
-	beego.Router("m/api/getequitautoinfo", &NewManageApiController{}, "Get:GetEquitAutoInfo")
8
-	beego.Router("m/api/getdisinfection", &NewManageApiController{}, "Get:GetDisInfectionTime")
9
-	beego.Router("/m/api/savedisinfectioninfo", &NewManageApiController{}, "Get:SaveDisInfectionInfo")
10
-	beego.Router("/m/api/getdeviceinformation", &NewManageApiController{}, "Get:GetDeviceInformation")
11
-}

+ 0 - 13
controllers/new_mobile_api_controllers/new_mobile_api_base_controller.go Просмотреть файл

@@ -1,13 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-)
6
-
7
-type NewMobileBaseAPIAuthController struct {
8
-	mobile_api_controllers.MobileBaseAPIAuthController
9
-}
10
-
11
-func (this *NewMobileBaseAPIAuthController) Prepare() {
12
-	this.MobileBaseAPIAuthController.Prepare()
13
-}

+ 0 - 186
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Просмотреть файл

@@ -1,186 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import "github.com/astaxie/beego"
4
-
5
-// 平板端路由,以 /m/api 为前缀
6
-func NewMobileAPIControllersRegisterRouters() {
7
-
8
-	beego.Router("m/api/patient/getillnesslist", &NewDialysisApiController{}, "Get:GetIllnesslist")
9
-	beego.Router("/m/api/patients/generatedialysisnotwo", &NewDialysisApiController{}, "Get:GetGeneratedialysisno")
10
-	beego.Router("/m/api/patient/getbloodDialysisPatient", &NewDialysisApiController{}, "Get:GetPatient")
11
-
12
-	beego.Router("/m/api/islogin", &NewLoginApiController{}, "Get:GetLogin")
13
-
14
-	//验证码相关
15
-	beego.Router("/m/api/code", &NewLoginApiController{}, "Get:GetCodeInit")
16
-	beego.Router("/m/api/getcode", &NewLoginApiController{}, "Get:GetCode")
17
-
18
-	//免密码登录
19
-	beego.Router("/m/api/login/cs", &NewLoginApiController{}, "post:LoginByCs")
20
-
21
-	//忘记密码
22
-	beego.Router("/m/api/password/commit", &ForgetPwdController{}, "post:ModifyPassword")
23
-
24
-	//注册
25
-	beego.Router("/m/api/register/commit", &MobileRegistController{}, "post:RegistSubmit")
26
-	beego.Router("/m/api/register/setname", &MobileRegistController{}, "post:ModifyName")
27
-
28
-	beego.Router("/m/api/register/login", &MobileRegistController{}, "post:Login")
29
-
30
-	beego.Router("/m/api/org/create", &MobileRegistController{}, "post:CreateOrg")
31
-
32
-	beego.Router("/m/api/home", &HomeController{}, "get:GetHomeData")
33
-	beego.Router("/m/api/changeorg", &HomeController{}, "post:ChangeOrg")
34
-	beego.Router("/m/api/createOrg", &HomeController{}, "post:CreateOrg")
35
-
36
-	beego.Router("/m/api/modifypsw", &HomeController{}, "post:ModifyPsw")
37
-
38
-	beego.Router("/m/api/staff", &NewRoleApiController{}, "get:GetAllOrgUser")
39
-
40
-	beego.Router("/m/api/staff/edit", &NewRoleApiController{}, "post:EditAdmin")
41
-	beego.Router("/m/api/staff/init", &NewRoleApiController{}, "get:GetEditAdminInitData")
42
-	beego.Router("/m/api/staff/get", &NewRoleApiController{}, "get:GetAdminUserInfo")
43
-	beego.Router("/m/api/staff/stop", &NewRoleApiController{}, "post:StopAdminUser")
44
-	beego.Router("/m/api/staff/create", &NewRoleApiController{}, "post:CreateAdminUser")
45
-
46
-	beego.Router("/m/api/role/addStaff", &NewRoleApiController{}, "post:AddRoleStaff")
47
-
48
-	beego.Router("/m/api/role", &NewRoleApiController{}, "get:GetAllOrgRole")
49
-	beego.Router("/m/api/role/edit", &NewRoleApiController{}, "post:EditRole")
50
-	beego.Router("/m/api/role/get", &NewRoleApiController{}, "get:GetOrgRoleInfo")
51
-	beego.Router("/m/api/role/del", &NewRoleApiController{}, "post:DeleteOrgRole")
52
-	beego.Router("/m/api/role/create", &NewRoleApiController{}, "post:CreateRole")
53
-
54
-	beego.Router("/m/api/permission/post", &NewRoleApiController{}, "post:EditRolePermission")
55
-	beego.Router("/m/api/functionpermission/post", &NewRoleApiController{}, "post:EditFunctionPermission")
56
-
57
-	beego.Router("/m/api/permission", &NewRoleApiController{}, "get:GetAllPermission")
58
-
59
-	beego.Router("/m/api/newpermission", &NewRoleApiController{}, "get:GetAllNewPermission")
60
-
61
-	beego.Router("/m/api/rolepurview", &NewRoleApiController{}, "get:GetRolePurviews")
62
-	beego.Router("/m/api/role/funtionpurview", &NewRoleApiController{}, "get:GetFuntionPurviews")
63
-
64
-	beego.Router("/m/api/func_role/get", &NewRoleApiController{}, "get:GetFuncRolePurviews")
65
-
66
-	beego.Router("/m/api/permission/get", &HomeController{}, "get:GetFuncPermission")
67
-
68
-	beego.Router("/m/api/patient/getbloodpatientinfo", &NewDialysisApiController{}, "Get:GetBloodPatientInfo")
69
-	beego.Router("/m/api/patient/getslowpatientinfo", &NewDialysisApiController{}, "Get:GetSlowPatientInfo")
70
-	beego.Router("/m/api/patient/getmemberpatientinfo", &NewDialysisApiController{}, "Get:GetMemberpatientInfo")
71
-	beego.Router("/m/api/patient/savepatient", &NewDialysisApiController{}, "Post:SavePatient")
72
-	beego.Router("/m/api/patient/getpatientdetail", &NewDialysisApiController{}, "Get:GetPatientDetail")
73
-	beego.Router("/m/api/patient/getdoctoradvices", &NewDialysisApiController{}, "Get:GetDoctorAdvices")
74
-	beego.Router("/m/api/paitent/getdryweight", &NewDialysisApiController{}, "Get:GetDryWeight")
75
-	beego.Router("m/api/patient/getbloodDialysisPatientwo", &NewDialysisApiController{}, "Get:GetAllPatient")
76
-	beego.Router("m/api/patient/tosearch", &NewDialysisApiController{}, "Get:ToSearch")
77
-	beego.Router("/m/api/patient/getcoursemanagement", &NewDialysisApiController{}, "Get:GetCourseManagement")
78
-	beego.Router("/m/api/patient/delelecousemanage", &NewDialysisApiController{}, "Delete:DeleteCourseManagement")
79
-	beego.Router("/m/api/patient/getcousemanagementdetail", &NewDialysisApiController{}, "Get:GetCouseManagentDetail")
80
-	beego.Router("/m/api/patient/getallblooddialysispatient", &NewDialysisApiController{}, "Get:GetAllBloodDialysisPatient")
81
-	beego.Router("/m/api/patient/getallslowpatient", &NewDialysisApiController{}, "Get:GetAllSlowPatent")
82
-	beego.Router("/m/api/patient/getallmemberpatient", &NewDialysisApiController{}, "Get:GetAllMemberPatient")
83
-	beego.Router("/m/api/patient/deletedryweight", &NewDialysisApiController{}, "Delete:DeleteDryWeight")
84
-	beego.Router("/m/api/patient/getdryweightdetail", &NewDialysisApiController{}, "Get:GetDryWeightDetail")
85
-	beego.Router("/m/api/patient/getlongdialysisrecord", &NewDialysisApiController{}, "Get:GetlongDialysisrecord")
86
-	beego.Router("/m/api/patient/getrescuerecord", &NewDialysisApiController{}, "Get:GetRescuerecord")
87
-	beego.Router("/m/api/patient/getscheduling", &NewDialysisApiController{}, "Get:GetScheduling")
88
-	beego.Router("/m/api/patient/geteducation", &NewDialysisApiController{}, "Get:GetEducation")
89
-	beego.Router("/m/api/patient/getschedulingdetail", &NewDialysisApiController{}, "Get:GetSchedulingDetail")
90
-	beego.Router("/m/api/patient/deletescheduling", &NewDialysisApiController{}, "Delete:DeleteScheduling")
91
-	beego.Router("/m/api/patient/geteducationdetail", &NewDialysisApiController{}, "Get:GetEducationDetail")
92
-	beego.Router("/m/api/patient/deleteeductionone", &NewDialysisApiController{}, "Delete:DeleteEducation")
93
-	beego.Router("/m/api/patient/getrescuerecorddetail", &NewDialysisApiController{}, "GET:GetRescueRecordDetail")
94
-	beego.Router("/m/api/patient/deleterescuerecord", &NewDialysisApiController{}, "Delete:DeleteRescueRecord")
95
-	beego.Router("/m/api/patient/tosearchepatient", &NewDialysisApiController{}, "Get:ToSearchePatient")
96
-	beego.Router("/m/api/patient/searchallpatient", &NewDialysisApiController{}, "Get:SearchallPatient")
97
-	beego.Router("/m/api/patient/searchallblood", &NewDialysisApiController{}, "Get:GetSearchallBlood")
98
-	beego.Router("/m/api/patient/getslowsearchepatient", &NewDialysisApiController{}, "Get:GetSlowSearchePatient")
99
-	beego.Router("/m/api/patient/getmembersearchpatient", &NewDialysisApiController{}, "Get:GetMemberSearchPatent")
100
-	beego.Router("/m/api/patient/getlongdialysisdetail", &NewDialysisApiController{}, "Get:GetLongDialysisDetail")
101
-	beego.Router("/m/api/patient/deletelongdialysis", &NewDialysisApiController{}, "Delete:DeleteLongDialysis")
102
-	beego.Router("/m/api/patient/getdialysisrecord", &NewDialysisApiController{}, "Get:GetDialysisrecord")
103
-	beego.Router("/m/api/patient/getdoctoradvicedetail", &NewDialysisApiController{}, "Get:GetDoctorAdviceDetail")
104
-	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
105
-	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
106
-	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
107
-	beego.Router("/m/api/patient/getallprojectname", &NewDialysisApiController{}, "Get:GetAllProjectName")
108
-	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
109
-	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
110
-	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
111
-	beego.Router("/m/api/patient/getmyinformationThree", &NewDialysisApiController{}, "Get:GetMyInformationThree")
112
-	beego.Router("/m/api/patient/getpatientname", &NewDialysisApiController{}, "Get:GetPatientName")
113
-	beego.Router("/m/api/patient/getinspectiondetail", &NewDialysisApiController{}, "Get:GetInspectionDetail")
114
-	beego.Router("/m/api/patient/savefeed", &NewDialysisApiController{}, "Get:SaveFeed")
115
-	beego.Router("/m/api/patient/deletechild", &NewDialysisApiController{}, "Delete:DeleteChild")
116
-	beego.Router("/m/api/patient/deletePatient", &NewDialysisApiController{}, "Delete:DeletePatient")
117
-	beego.Router("/m/api/patient/deleteinspection", &NewDialysisApiController{}, "Delete:DeleteInspection")
118
-	beego.Router("/m/api/patient/deletechildinspection", &NewDialysisApiController{}, "Delete:DeleteChildInspection")
119
-	beego.Router("/m/api/patient/savemessage", &NewDialysisApiController{}, "Get:SaveMessage")
120
-	beego.Router("/m/api/patient/savesex", &NewDialysisApiController{}, "Get:SaveSex")
121
-	beego.Router("/m/api/patient/savebirthday", &NewDialysisApiController{}, "Post:SaveBirthday")
122
-	beego.Router("/m/api/patient/getorgname", &NewDialysisApiController{}, "Get:GetOrgName")
123
-	beego.Router("/m/api/patient/getrolename", &NewDialysisApiController{}, "Get:GetRoleName")
124
-	beego.Router("/m/api/patient/savepartition", &NewDialysisApiController{}, "Get:SavePartition")
125
-	beego.Router("/m/api/patient/getallzone", &NewDialysisApiController{}, "Get:GetAllZone")
126
-	beego.Router("/m/api/patient/deletezone", &NewDialysisApiController{}, "Delete:DeleteZone")
127
-	beego.Router("/m/api/patient/savegroup", &NewDialysisApiController{}, "Get:SaveGroup")
128
-	beego.Router("/m/api/patient/getallgroup", &NewDialysisApiController{}, "Get:GetAllGroup")
129
-	beego.Router("/m/api/patient/deletegroup", &NewDialysisApiController{}, "Delete:DeleteGroup")
130
-	beego.Router("m/api/patient/getallgroupone", &NewDialysisApiController{}, "Get:GetAllGroupOne")
131
-	beego.Router("/m/api/patient/savebed", &NewDialysisApiController{}, "Get:SaveBed")
132
-	beego.Router("/m/api/patient/getallnumber", &NewDialysisApiController{}, "Get:GetAllNumber")
133
-	beego.Router("/m/api/patient/deletebed", &NewDialysisApiController{}, "Delete:DeleteBed")
134
-	beego.Router("/m/api/patient/loginout", &NewDialysisApiController{}, "Get:LoginOut")
135
-	beego.Router("/m/api/patient/getmemberpatient", &NewDialysisApiController{}, "Get:GetMemberPatient")
136
-	beego.Router("/m/api/patient/getslowpatient", &NewDialysisApiController{}, "Get:GetSlowPatient")
137
-	beego.Router("/m/api/patient/getbloodpatient", &NewDialysisApiController{}, "Get:GetBloodPatient")
138
-	beego.Router("/m/api/patient/savename", &NewDialysisApiController{}, "Get:SaveName")
139
-	beego.Router("/m/api/patient/getallorganization", &NewDialysisApiController{}, "Get:GetAllOrganization")
140
-	beego.Router("/m/api/patient/getmyorganazition", &NewDialysisApiController{}, "Get:GetMyOrganazition")
141
-	beego.Router("/m/api/org/getorginformation", &NewDialysisApiController{}, "Get:GetOrgInformation")
142
-	beego.Router("/m/api/patient/getallorgtype", &NewDialysisApiController{}, "Get:GetAllOrgType")
143
-	beego.Router("/m/api/patient/editorg", &NewDialysisApiController{}, "Get:EditOrg")
144
-	beego.Router("/m/api/patient/getmyinforname", &NewDialysisApiController{}, "Get:GetMyInforName")
145
-	beego.Router("/m/api/patient/getpartiondetail", &NewDialysisApiController{}, "Get:GetPartionDetail")
146
-	beego.Router("/m/api/patient/updatepartition", &NewDialysisApiController{}, "Get:UpdatePartition")
147
-	beego.Router("/m/api/patient/getgroupdetail", &NewDialysisApiController{}, "Get:GetGroupDetail")
148
-	beego.Router("/m/api/patient/updategroup", &NewDialysisApiController{}, "Get:UpdateGroup")
149
-	beego.Router("/m/api/patient/getbeddetail", &NewDialysisApiController{}, "Get:GetBedDetail")
150
-	beego.Router("/m/api/patient/updatebed", &NewDialysisApiController{}, "Get:UpdatedBed")
151
-	beego.Router("/m/api/patient/getmyorginformation", &NewDialysisApiController{}, "Get:GetMyOrgInformation")
152
-	beego.Router("/m/api/patient/savenametwo", &NewDialysisApiController{}, "Get:SaveNameTwo")
153
-	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
154
-	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
155
-	beego.Router("/m/api/org/getMyMobile", &NewDialysisApiController{}, "Get:GetMyMobile")
156
-	beego.Router("/m/api/patient/sumitform", &NewDialysisApiController{}, "Get:SumitForm")
157
-	beego.Router("/m/api/patient/getroleposition", &NewDialysisApiController{}, "Get:GetRolePosition")
158
-	beego.Router("/m/api/patient/getmobile", &NewDialysisApiController{}, "Get:GetMobile")
159
-	beego.Router("/m/api/patient/getorgs", &NewDialysisApiController{}, "Get:GetOrgs")
160
-	beego.Router("/m/api/patient/getnewpatientid", &NewDialysisApiController{}, "Get:GetNewPatientId")
161
-	beego.Router("/m/api/patient/updateimage", &NewDialysisApiController{}, "Get:UpdateImage")
162
-	beego.Router("/m/api/patient/deletemanagementtwo", &NewDialysisApiController{}, "Delete:DeleteManageMentTwo")
163
-	beego.Router("/m/api/patient/savecouresemanagement", &NewDialysisApiController{}, "Get:SaveCourseManageMent")
164
-	beego.Router("/m/api/patient/savecoursemanagementtwo", &NewDialysisApiController{}, "Get:SaveCourseManageMentTwo")
165
-	beego.Router("/m/api/patient/getvascularaccess", &NewDialysisApiController{}, "Get:GetVascularAccess")
166
-	beego.Router("/m/api/patient/getvascularaccessdetail", &NewDialysisApiController{}, "Get:GetVascularAccessDetail")
167
-	beego.Router("/m/api/patient/getalldoctorlist", &NewDialysisApiController{}, "Get:GetAllDoctorList")
168
-	beego.Router("/m/api/patient/gettreatesummay", &NewDialysisApiController{}, "Get:GetTreateSummary")
169
-	//脚本
170
-	beego.Router("/m/api/patient/commitdialysisOrder", &NewDialysisApiController{}, "Get:CommitDialysisOrder")
171
-
172
-	//His相关
173
-	beego.Router("/m/api/hispatientlist/get", &MobileHisApiController{}, "Get:GetHisPatientList")
174
-	beego.Router("/m/api/prescriptionconfig/get", &MobileHisApiController{}, "Get:GetHisPrescriptionConfig")
175
-	beego.Router("/m/api/prescriptioninfo/get", &MobileHisApiController{}, "Get:GetHisPatientInfo")
176
-	beego.Router("/m/api/prescription/call", &MobileHisApiController{}, "Get:GetCallHisPrescription")
177
-	beego.Router("/m/api/lastornextprescription/get", &MobileHisApiController{}, "Get:GetLastOrNextHisPrescription")
178
-	beego.Router("/m/api/prescription/delete", &MobileHisApiController{}, "Post:DeletePrescription")
179
-	beego.Router("/m/api/hisdoctoradvice/delete", &MobileHisApiController{}, "Post:DeleteDoctorAdvice")
180
-	beego.Router("/m/api/hisproject/delete", &MobileHisApiController{}, "Post:DeleteProject")
181
-	beego.Router("/m/api/prescription/create", &MobileHisApiController{}, "Post:CreateHisPrescription")
182
-
183
-	beego.Router("/m/api/patient/getpatientplan", &MobileHisApiController{}, "Get:GetPatientPlan")
184
-	beego.Router("/m/api/patient/togetpatient", &MobileHisApiController{}, "Get:ToGetPatient")
185
-
186
-}

+ 0 - 747
controllers/new_mobile_api_controllers/new_role_api_controller.go Просмотреть файл

@@ -1,747 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"fmt"
8
-	"strconv"
9
-	"strings"
10
-	"time"
11
-)
12
-
13
-type NewRoleApiController struct {
14
-	NewMobileBaseAPIAuthController
15
-}
16
-
17
-func (this *NewRoleApiController) GetAllOrgUser() {
18
-	adminUserInfo := this.GetMobileAdminUserInfo()
19
-	var isSubSuperAdmin bool = false
20
-	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
21
-	role_ids := strings.Split(app_role.RoleIds, ",")
22
-
23
-	if len(role_ids) > 0 {
24
-		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
25
-			for _, item := range role_ids {
26
-				id, _ := strconv.ParseInt(item, 10, 64)
27
-				if id != 0 {
28
-					role, _ := service.GetRoleByRoleID(id)
29
-					if role != nil {
30
-						if role.IsSystem == 1 && role.RoleName == "子管理员" {
31
-							isSubSuperAdmin = true
32
-						}
33
-					}
34
-				}
35
-
36
-			}
37
-		}
38
-	}
39
-	viewModels, _, _ := service.GetAllAdminUsersAndRole(adminUserInfo.Org.Id, adminUserInfo.App.Id, 1, 100)
40
-	this.ServeSuccessJSON(map[string]interface{}{
41
-		"admins":          viewModels,
42
-		"isSubSuperAdmin": isSubSuperAdmin,
43
-		"org_creator":     adminUserInfo.Org.Creator,
44
-	})
45
-}
46
-
47
-func (this *NewRoleApiController) EditAdmin() {
48
-	adminUserInfo := this.GetMobileAdminUserInfo()
49
-	adminUserId, _ := this.GetInt64("uid")
50
-	name := this.GetString("name")
51
-	userTitle := this.GetString("title")
52
-	roleIds := this.GetString("role_ids")
53
-	user_type, _ := this.GetInt64("user_type", 0)
54
-	user_title, _ := this.GetInt64("user_title", 0)
55
-
56
-	department_name := this.GetString("department_name")
57
-	department_id, _ := this.GetInt64("department_id", 0)
58
-
59
-	//roleIds := this.GetString("role_ids")
60
-
61
-	if adminUserId <= 0 || len(name) == 0 || len(roleIds) <= 0 {
62
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
63
-		return
64
-	}
65
-	appRole, getAppRoleErr := service.GetAppRole(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserId)
66
-	if getAppRoleErr != nil {
67
-		//beego.Error("查询管理员信息时失败:", getAppRoleErr)
68
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
69
-		return
70
-	}
71
-	if appRole == nil {
72
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserNotExist)
73
-		return
74
-	}
75
-	appRole.UserName = name
76
-	appRole.UserTitleName = userTitle
77
-	appRole.RoleIds = roleIds
78
-	appRole.ModifyTime = time.Now().Unix()
79
-	appRole.UserType = int8(user_type)
80
-	appRole.UserTitle = int8(user_title)
81
-	appRole.Department = department_name
82
-	appRole.DepartmentId = department_id
83
-	saveErr := service.SaveAppRole(appRole)
84
-
85
-	if saveErr != nil {
86
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
87
-	} else {
88
-		this.ServeSuccessJSON(nil)
89
-	}
90
-}
91
-
92
-func (this *NewRoleApiController) GetEditAdminInitData() {
93
-	adminUserInfo := this.GetMobileAdminUserInfo()
94
-
95
-	roles, _ := service.GetNewAllOrgValidRoles(adminUserInfo.Org.Id)
96
-	this.ServeSuccessJSON(map[string]interface{}{
97
-		"roles": roles,
98
-	})
99
-}
100
-
101
-func (this *NewRoleApiController) GetAdminUserInfo() {
102
-	adminUserInfo := this.GetMobileAdminUserInfo()
103
-	adminUserId, _ := this.GetInt64("uid")
104
-	var isSubSuperAdmin bool = false
105
-	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
106
-	role_ids := strings.Split(app_role.RoleIds, ",")
107
-	if len(role_ids) > 0 {
108
-		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
109
-			for _, item := range role_ids {
110
-				id, _ := strconv.ParseInt(item, 10, 64)
111
-				if id != 0 {
112
-					role, _ := service.GetRoleByRoleID(id)
113
-					if role != nil {
114
-
115
-						if role.IsSystem == 1 && role.RoleName == "子管理员" {
116
-							isSubSuperAdmin = true
117
-						}
118
-					}
119
-				}
120
-			}
121
-		}
122
-	}
123
-
124
-	appRole, getAppRoleErr := service.GetAppRole(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserId)
125
-	if getAppRoleErr != nil {
126
-		//beego.Error("查询管理员信息时失败:", getAppRoleErr)
127
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
128
-		return
129
-	}
130
-	if appRole == nil {
131
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserNotExist)
132
-		return
133
-	}
134
-
135
-	this.ServeSuccessJSON(map[string]interface{}{
136
-		"user_info":       appRole,
137
-		"isSubSuperAdmin": isSubSuperAdmin,
138
-	})
139
-
140
-}
141
-
142
-func (this *NewRoleApiController) StopAdminUser() {
143
-	adminUserInfo := this.GetMobileAdminUserInfo()
144
-	adminUserId, _ := this.GetInt64("uid")
145
-	appRole, getAppRoleErr := service.GetAppRole(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserId)
146
-	if getAppRoleErr != nil {
147
-		//beego.Error("查询管理员信息时失败:", getAppRoleErr)
148
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
149
-		return
150
-	}
151
-	if appRole == nil {
152
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserNotExist)
153
-		return
154
-	}
155
-
156
-	enable, _ := this.GetBool("enable")
157
-
158
-	if enable {
159
-		appRole.Status = 1
160
-	} else {
161
-		appRole.Status = 0
162
-	}
163
-	appRole.ModifyTime = time.Now().Unix()
164
-	saveErr := service.SaveAppRole(appRole)
165
-	if saveErr != nil {
166
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
167
-	} else {
168
-		this.ServeSuccessJSON(nil)
169
-	}
170
-
171
-}
172
-
173
-func (this *NewRoleApiController) CreateAdminUser() {
174
-	adminUserInfo := this.GetMobileAdminUserInfo()
175
-	mobile := this.GetString("mobile")
176
-	name := this.GetString("name")
177
-	role_ids := this.GetString("role_ids")
178
-	userTitle := this.GetString("title")
179
-	department_name := this.GetString("department_name")
180
-	department_id, _ := this.GetInt64("department_id")
181
-
182
-	user_type, _ := this.GetInt("user_type", 0)
183
-	user_title, _ := this.GetInt("user_title", 0)
184
-	if len(mobile) == 0 || len(name) == 0 || len(role_ids) <= 0 {
185
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
186
-		return
187
-	}
188
-
189
-	// 判断是否已存在该手机号
190
-	if adminUser, err := service.GetValidAdminUserByMobileReturnErr(mobile); err != nil {
191
-		//beego.Error("查询用户是否已被添加为管理员时失败:", err)
192
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
193
-		return
194
-	} else {
195
-		if adminUser == nil { //新增账号和用户
196
-
197
-			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.Org.Id, adminUserInfo.App.Id, mobile, name, userTitle, role_ids, user_type, user_title, department_id, department_name)
198
-			if createErr != nil {
199
-				//beego.Error("创建管理员失败:", createErr)
200
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
201
-				return
202
-
203
-			} else {
204
-				sendSMSErr := service.SMSSendInviteMobileToJoinOrgAdmin(name, mobile, password)
205
-				if sendSMSErr != nil {
206
-				}
207
-
208
-				this.ServeSuccessJSON(nil)
209
-				return
210
-			}
211
-		} else {
212
-
213
-			total, _ := service.FindAdminUserByID(adminUser.Id, adminUserInfo.Org.Id)
214
-
215
-			if total <= 0 {
216
-				//新增用户
217
-				app_role := &models.App_Role{
218
-					AdminUserId:   adminUser.Id,
219
-					OrgId:         adminUserInfo.Org.Id,
220
-					AppId:         adminUserInfo.App.Id,
221
-					Avatar:        "",
222
-					UserName:      name,
223
-					UserTitleName: userTitle,
224
-					UserTitle:     int8(user_title),
225
-					UserType:      int8(user_type),
226
-					Status:        1,
227
-					CreateTime:    time.Now().Unix(),
228
-					ModifyTime:    time.Now().Unix(),
229
-					RoleIds:       role_ids,
230
-					IsSort:        1,
231
-				}
232
-				err := service.CreateUserRole(app_role)
233
-				if err != nil {
234
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
235
-					return
236
-				}
237
-				this.ServeSuccessJSON(nil)
238
-			} else {
239
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRepeatCreateStaffException)
240
-				return
241
-			}
242
-
243
-			return
244
-		}
245
-	}
246
-
247
-}
248
-
249
-func (this *NewRoleApiController) GetAllOrgRole() {
250
-	adminUserInfo := this.GetMobileAdminUserInfo()
251
-
252
-	var isSubSuperAdmin bool = false
253
-
254
-	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
255
-	role_ids := strings.Split(app_role.RoleIds, ",")
256
-	if len(role_ids) > 0 {
257
-
258
-		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
259
-			for _, item := range role_ids {
260
-				id, _ := strconv.ParseInt(item, 10, 64)
261
-				if id != 0 {
262
-					role, _ := service.GetRoleByRoleID(id)
263
-					if role != nil {
264
-						if role.IsSystem == 1 && role.RoleName == "子管理员" {
265
-							isSubSuperAdmin = true
266
-						}
267
-					}
268
-				}
269
-			}
270
-		}
271
-	}
272
-	fmt.Println(isSubSuperAdmin)
273
-
274
-	roles, err := service.GetAllOrgValidRoles(adminUserInfo.Org.Id, isSubSuperAdmin)
275
-	if err != nil {
276
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
277
-		return
278
-	} else {
279
-		this.ServeSuccessJSON(map[string]interface{}{
280
-			"roles": roles,
281
-		})
282
-	}
283
-
284
-}
285
-
286
-func (this *NewRoleApiController) EditRole() {
287
-	role_id, _ := this.GetInt64("id", 0)
288
-	desc := this.GetString("desc")
289
-
290
-	role, _ := service.GetRoleByRoleID(role_id)
291
-
292
-	role.RoleIntro = desc
293
-	role.ModifyTime = time.Now().Unix()
294
-
295
-	err := service.SaveRole(role)
296
-	if err != nil {
297
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
298
-	}
299
-	this.ServeSuccessJSON(map[string]interface{}{
300
-		"role": role,
301
-	})
302
-	return
303
-}
304
-
305
-func (this *NewRoleApiController) GetOrgRoleInfo() {
306
-	role_id, _ := this.GetInt64("id", 0)
307
-	role, err := service.GetRoleByRoleID(role_id)
308
-	if err != nil {
309
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
310
-		return
311
-	} else {
312
-		this.ServeSuccessJSON(map[string]interface{}{
313
-			"role": role,
314
-		})
315
-	}
316
-
317
-}
318
-
319
-func (this *NewRoleApiController) CreateRole() {
320
-	adminUserInfo := this.GetMobileAdminUserInfo()
321
-	role_name := this.GetString("name")
322
-	role_desc := this.GetString("desc")
323
-
324
-	total := service.FindRoleRecordByRoleName(role_name, adminUserInfo.Org.Id)
325
-	if total > 0 {
326
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRoleNameIsExist)
327
-		return
328
-
329
-	}
330
-
331
-	role := &models.Role{
332
-		RoleName:     role_name,
333
-		RoleIntro:    role_desc,
334
-		Creator:      adminUserInfo.AdminUser.Id,
335
-		OrgId:        adminUserInfo.Org.Id,
336
-		AppId:        adminUserInfo.App.Id,
337
-		Status:       1,
338
-		IsSuperAdmin: false,
339
-		CreateTime:   time.Now().Unix(),
340
-		ModifyTime:   time.Now().Unix(),
341
-	}
342
-
343
-	err := service.CreateOrgRole(role)
344
-	if err != nil {
345
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
346
-		return
347
-	} else {
348
-		this.ServeSuccessJSON(map[string]interface{}{
349
-			"role": role,
350
-		})
351
-	}
352
-
353
-}
354
-
355
-func (this *NewRoleApiController) GetAllPermission() {
356
-	module, _ := this.GetInt64("module")
357
-	parent_id, _ := this.GetInt64("id")
358
-	purviews, _ := service.GetAllPurview(module, parent_id)
359
-	this.ServeSuccessJSON(map[string]interface{}{
360
-		"purviews": purviews,
361
-	})
362
-}
363
-
364
-func (this *NewRoleApiController) DeleteOrgRole() {
365
-	roleID, _ := this.GetInt64("role_id")
366
-	enable, _ := this.GetBool("enable")
367
-	if roleID <= 0 {
368
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
369
-		return
370
-	}
371
-
372
-	adminUserInfo := this.GetMobileAdminUserInfo()
373
-
374
-	role, getRoleErr := service.GetRoleByRoleID(roleID)
375
-	if getRoleErr != nil {
376
-		//beego.Error("获取角色失败:", getRoleErr)
377
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
378
-		return
379
-	} else if role == nil {
380
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRoleNotExist)
381
-		return
382
-	}
383
-
384
-	if enable == false {
385
-		if count, _ := service.RoleAdminUserCountTwo(adminUserInfo.Org.Id, adminUserInfo.App.Id, roleID); count != 0 {
386
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCannotRemoveRole)
387
-			return
388
-		}
389
-	}
390
-
391
-	if enable {
392
-		role.Status = 1
393
-	} else {
394
-		role.Status = 2
395
-	}
396
-	role.ModifyTime = time.Now().Unix()
397
-	saveErr := service.ModifyRole(role)
398
-	if saveErr != nil {
399
-		//beego.Error("修改角色失败:", role.Id, saveErr)
400
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
401
-	} else {
402
-		this.ServeSuccessJSON(nil)
403
-	}
404
-
405
-}
406
-
407
-func (this *NewRoleApiController) GetRolePurviews() {
408
-	adminUserInfo := this.GetMobileAdminUserInfo()
409
-	role_id, _ := this.GetInt64("id", 0)
410
-	rolePurview, _ := service.GetRoleAndPurviewById(role_id, adminUserInfo.Org.Id, adminUserInfo.App.Id)
411
-	funRolePurview, _ := service.GetRoleFuncPurview(role_id)
412
-
413
-	role, _ := service.GetRoleByRoleID(role_id)
414
-	this.ServeSuccessJSON(map[string]interface{}{
415
-		"role_purview": rolePurview,
416
-		"role":         role,
417
-		"func_purview": funRolePurview,
418
-	})
419
-}
420
-
421
-func (this *NewRoleApiController) AddRoleStaff() {
422
-	//adminUserInfo := this.GetMobileAdminUserInfo()
423
-	role_id, _ := this.GetInt64("id", 0)
424
-	staff_ids := this.GetString("ids")
425
-	ids := strings.Split(staff_ids, ",")
426
-	for _, item := range ids {
427
-		id, _ := strconv.ParseInt(item, 10, 64)
428
-		role, _ := service.FindAdminUserID(id)
429
-		role.RoleIds = role.RoleIds + "," + strconv.FormatInt(role_id, 10)
430
-		service.SaveAdminUser(&role)
431
-	}
432
-	this.ServeSuccessJSON(map[string]interface{}{
433
-		"msg": "添加成功",
434
-	})
435
-
436
-}
437
-
438
-func (this *NewRoleApiController) GetFuntionPurviews() {
439
-	pid, _ := this.GetInt64("pid")
440
-	functionPurview, _ := service.GetFunctionPurview(pid)
441
-	this.ServeSuccessJSON(map[string]interface{}{
442
-		"funtion_purview": functionPurview,
443
-	})
444
-}
445
-
446
-func RemoveRepeatedIDSElement(arr []string) (newArr []string) {
447
-	newArr = make([]string, 0)
448
-	for i := 0; i < len(arr); i++ {
449
-		repeat := false
450
-		for j := i + 1; j < len(arr); j++ {
451
-			if arr[i] == arr[j] {
452
-				repeat = true
453
-				break
454
-			}
455
-		}
456
-		if !repeat {
457
-			newArr = append(newArr, arr[i])
458
-		}
459
-	}
460
-	return
461
-}
462
-
463
-func (this *NewRoleApiController) EditRolePermission() {
464
-	adminUser := this.GetMobileAdminUserInfo()
465
-	role_id, _ := this.GetInt64("id", 0)
466
-	purview_id := this.GetString("purview_id")
467
-	is_open, _ := this.GetInt64("type", 0)
468
-
469
-	permissions, err := service.GetRolePurviewIds(role_id)
470
-	if err != nil {
471
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
472
-		return
473
-	} else {
474
-
475
-		if is_open == 1 { //打开
476
-			purview, _ := service.GetRolePurview(role_id)
477
-			if purview.Id == 0 { // 新建
478
-
479
-				purview.PurviewIds = purview_id
480
-				purview.CreateTime = time.Now().Unix()
481
-				purview.ModifyTime = time.Now().Unix()
482
-				purview.Status = 1
483
-				purview.RoleId = role_id
484
-				purview.OrgId = adminUser.Org.Id
485
-				purview.AppId = adminUser.App.Id
486
-				err := service.CreateRolePurview(&purview)
487
-				if err != nil {
488
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
489
-					return
490
-				}
491
-
492
-				this.ServeSuccessJSON(map[string]interface{}{
493
-					"is_open": 1,
494
-				})
495
-
496
-			} else { //修改
497
-				var permission_arr []string
498
-				purview, _ := service.GetRolePurview(role_id)
499
-				if len(permissions) > 0 {
500
-					permission_arr = strings.Split(permissions, ",")
501
-					if len(purview_id) > 0 {
502
-						permission_arr = append(permission_arr, strings.Split(purview_id, ",")...)
503
-					}
504
-				} else {
505
-					if len(purview_id) > 0 {
506
-						permission_arr = strings.Split(purview_id, ",")
507
-					}
508
-				}
509
-
510
-				permission_arr = RemoveRepeatedIDSElement(permission_arr)
511
-				permissions = strings.Join(permission_arr, ",")
512
-				purview.PurviewIds = permissions
513
-				err := service.SaveRolePurview(&purview)
514
-				if err != nil {
515
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
516
-					return
517
-				}
518
-
519
-				this.ServeSuccessJSON(map[string]interface{}{
520
-					"is_open": 1,
521
-				})
522
-
523
-			}
524
-
525
-		} else { //关闭
526
-			permission_arr := strings.Split(permissions, ",")
527
-			purview_arr := strings.Split(purview_id, ",")
528
-
529
-			for _, pur_id := range purview_arr {
530
-				for index, id := range permission_arr {
531
-					if id == pur_id {
532
-						permission_arr = append(permission_arr[:index], permission_arr[index+1:]...)
533
-					}
534
-				}
535
-			}
536
-			purview, _ := service.GetRolePurview(role_id)
537
-			fmt.Println(purview.CreateTime)
538
-			purview.PurviewIds = strings.Join(permission_arr, ",")
539
-
540
-			err := service.SaveRolePurview(&purview)
541
-			if err != nil {
542
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
543
-				return
544
-			}
545
-			this.ServeSuccessJSON(map[string]interface{}{
546
-				"is_open": 0,
547
-			})
548
-
549
-		}
550
-	}
551
-
552
-}
553
-
554
-func (this *NewRoleApiController) EditFunctionPermission() {
555
-	adminUser := this.GetMobileAdminUserInfo()
556
-	role_id, _ := this.GetInt64("id", 0)
557
-	purview_id := this.GetString("purview_id")
558
-	is_open, _ := this.GetInt64("type", 0)
559
-	is_all, _ := this.GetInt64("is_all", 0)
560
-	pid := this.GetString("pid")
561
-
562
-	func_permissions, err := service.GetRoleFuncPurviewIds(role_id)
563
-	permissions, _ := service.GetRolePurviewIds(role_id)
564
-
565
-	redis := service.RedisClient()
566
-	defer redis.Close()
567
-
568
-	users := service.GetAllUserRole(adminUser.Org.Id)
569
-	for _, item := range users {
570
-		key := "purviews_" + strconv.FormatInt(adminUser.Org.Id, 10) + strconv.FormatInt(item.AdminUserId, 10)
571
-		redis.Set(key, "", time.Second)
572
-	}
573
-
574
-	if err != nil {
575
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
576
-		return
577
-	} else {
578
-
579
-		if is_open == 1 { //打开
580
-			//处理功能权限涉及到的菜单权限
581
-
582
-			purview, _ := service.GetRolePurview(role_id)
583
-			if purview.Id == 0 { // 新建
584
-				purview.PurviewIds = pid
585
-				purview.CreateTime = time.Now().Unix()
586
-				purview.ModifyTime = time.Now().Unix()
587
-				purview.Status = 1
588
-				purview.RoleId = role_id
589
-				purview.OrgId = adminUser.Org.Id
590
-				purview.AppId = adminUser.App.Id
591
-				service.CreateRolePurview(&purview)
592
-
593
-			} else { //修改
594
-				var permission_arr []string
595
-				purview, _ := service.GetRolePurview(role_id)
596
-				if len(permissions) > 0 {
597
-					permission_arr = strings.Split(permissions, ",")
598
-					if len(pid) > 0 {
599
-						permission_arr = append(permission_arr, strings.Split(pid, ",")...)
600
-					}
601
-				} else {
602
-					if len(pid) > 0 {
603
-						permission_arr = strings.Split(pid, ",")
604
-					}
605
-				}
606
-				permission_arr = RemoveRepeatedIDSElement(permission_arr)
607
-				permissions = strings.Join(permission_arr, ",")
608
-				purview.PurviewIds = permissions
609
-				service.SaveRolePurview(&purview)
610
-			}
611
-
612
-			func_purview, _ := service.GetFuncRolePurview(role_id)
613
-			if func_purview.ID == 0 { // 新建
614
-
615
-				func_purview.PurviewIds = purview_id
616
-				func_purview.Ctime = time.Now().Unix()
617
-				func_purview.Mtime = time.Now().Unix()
618
-				func_purview.Status = 1
619
-				func_purview.RoleId = role_id
620
-				func_purview.OrgId = adminUser.Org.Id
621
-				func_purview.AppId = adminUser.App.Id
622
-				err := service.CreateFuncRolePurview(&func_purview)
623
-				if err != nil {
624
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
625
-					return
626
-				}
627
-
628
-				this.ServeSuccessJSON(map[string]interface{}{
629
-					"is_open": 1,
630
-				})
631
-			} else { //修改
632
-				var permission_arr []string
633
-				func_purview, _ := service.GetRoleFuncPurview(role_id)
634
-				if len(func_permissions) > 0 {
635
-					permission_arr = strings.Split(func_permissions, ",")
636
-					if len(purview_id) > 0 {
637
-						permission_arr = append(permission_arr, strings.Split(purview_id, ",")...)
638
-					}
639
-				} else {
640
-					if len(purview_id) > 0 {
641
-						permission_arr = strings.Split(purview_id, ",")
642
-					}
643
-				}
644
-				permission_arr = RemoveRepeatedIDSElement(permission_arr)
645
-				func_permissions = strings.Join(permission_arr, ",")
646
-				func_purview.PurviewIds = func_permissions
647
-
648
-				err := service.SaveRoleFuncPurview(&func_purview)
649
-				if err != nil {
650
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
651
-					return
652
-				}
653
-				this.ServeSuccessJSON(map[string]interface{}{
654
-					"is_open": 1,
655
-				})
656
-			}
657
-		} else { //关闭
658
-
659
-			//处理功能权限涉及到的菜单权限,当关闭到只剩下一个的时候,在将菜单权限对应的权限id清除
660
-			func_permission_arr := strings.Split(func_permissions, ",")
661
-			if len(func_permission_arr) == 1 {
662
-				permission_arr := strings.Split(permissions, ",")
663
-				pid_arr := strings.Split(pid, ",")
664
-				for _, pur_id := range pid_arr {
665
-					for index, id := range permission_arr {
666
-						if id == pur_id {
667
-							permission_arr = append(permission_arr[:index], permission_arr[index+1:]...)
668
-						}
669
-					}
670
-				}
671
-				purview, _ := service.GetRolePurview(role_id)
672
-				purview.PurviewIds = strings.Join(permission_arr, ",")
673
-				service.SaveRolePurview(&purview)
674
-			}
675
-
676
-			if is_all == 1 {
677
-
678
-				permission_arr := strings.Split(permissions, ",")
679
-				pid_arr := strings.Split(pid, ",")
680
-				for _, pur_id := range pid_arr {
681
-					for index, id := range permission_arr {
682
-						if id == pur_id {
683
-							permission_arr = append(permission_arr[:index], permission_arr[index+1:]...)
684
-						}
685
-					}
686
-				}
687
-				purview, _ := service.GetRolePurview(role_id)
688
-				purview.PurviewIds = strings.Join(permission_arr, ",")
689
-				service.SaveRolePurview(&purview)
690
-
691
-				func_purview, _ := service.GetRoleFuncPurview(role_id)
692
-				func_purview.PurviewIds = ""
693
-				err := service.SaveRoleFuncPurview(&func_purview)
694
-				if err != nil {
695
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
696
-					return
697
-				}
698
-				this.ServeSuccessJSON(map[string]interface{}{
699
-					"is_open": 0,
700
-				})
701
-
702
-			} else {
703
-				permission_arr := strings.Split(func_permissions, ",")
704
-				purview_arr := strings.Split(purview_id, ",")
705
-				fmt.Println(permission_arr)
706
-				fmt.Println(purview_arr)
707
-				for index, id := range permission_arr {
708
-					for _, pur_id := range purview_arr {
709
-						if id == pur_id {
710
-							permission_arr = append(permission_arr[:index], permission_arr[index+1:]...)
711
-						}
712
-					}
713
-				}
714
-				func_purview, _ := service.GetRoleFuncPurview(role_id)
715
-				func_purview.PurviewIds = strings.Join(permission_arr, ",")
716
-
717
-				err := service.SaveRoleFuncPurview(&func_purview)
718
-				if err != nil {
719
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
720
-					return
721
-				}
722
-				this.ServeSuccessJSON(map[string]interface{}{
723
-					"is_open": 0,
724
-				})
725
-			}
726
-
727
-		}
728
-	}
729
-
730
-}
731
-
732
-func (this *NewRoleApiController) GetFuncRolePurviews() {
733
-	//adminUserInfo := this.GetMobileAdminUserInfo()
734
-	role_id, _ := this.GetInt64("id", 0)
735
-	purview, _ := service.GetRoleFuncPurview(role_id)
736
-	this.ServeSuccessJSON(map[string]interface{}{
737
-		"role_purview": purview,
738
-	})
739
-}
740
-
741
-func (this *NewRoleApiController) GetAllNewPermission() {
742
-	url := this.GetString("url")
743
-	purviews, _ := service.GetNewAllPurview(url)
744
-	this.ServeSuccessJSON(map[string]interface{}{
745
-		"purviews": purviews,
746
-	})
747
-}

+ 0 - 50
controllers/new_mobile_api_controllers/new_self_drug_api_controller.go Просмотреть файл

@@ -1,50 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import (
4
-	"XT_New/controllers/mobile_api_controllers"
5
-	"XT_New/enums"
6
-	"XT_New/service"
7
-	"fmt"
8
-)
9
-
10
-type NewDrugApiController struct {
11
-	mobile_api_controllers.MobileBaseAPIAuthController
12
-}
13
-
14
-func (this *NewDrugApiController) GetSelfMedicalList() {
15
-
16
-	patient_id, _ := this.GetInt64("patient_id")
17
-	fmt.Println("222222222", patient_id)
18
-	adminUserInfo := this.GetMobileAdminUserInfo()
19
-	orgId := adminUserInfo.Org.Id
20
-	medical, _ := service.GetSetSelfMedical(orgId)
21
-	//开启
22
-	if medical.DrugStart == 1 {
23
-		list, err := service.GetSelfMedicalList(patient_id)
24
-		if err != nil {
25
-			this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取自备药失败")
26
-			return
27
-		}
28
-		this.ServeSuccessJSON(map[string]interface{}{
29
-			"medicalList": list,
30
-		})
31
-	}
32
-}
33
-
34
-func (this *NewDrugApiController) GetDrugDescByDrugName() {
35
-
36
-	drug_name := this.GetString("drug_name")
37
-	fmt.Println("drug_name", drug_name)
38
-	patient_id, _ := this.GetInt64("patient_id")
39
-	fmt.Println("patient_id", patient_id)
40
-	adminUserInfo := this.GetMobileAdminUserInfo()
41
-	orgId := adminUserInfo.Org.Id
42
-	drugspec, err := service.GetDrugDescByDrugName(drug_name, patient_id, orgId)
43
-	if err != nil {
44
-		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
45
-		return
46
-	}
47
-	this.ServeSuccessJSON(map[string]interface{}{
48
-		"drugspec": drugspec,
49
-	})
50
-}

+ 0 - 170
controllers/new_mobile_api_controllers/patient.json Просмотреть файл

@@ -1,170 +0,0 @@
1
-{
2
-  "patients": [
3
-    {
4
-      "avatar": "https://images.shengws.com/201809182128111.png",
5
-      "patient_type": 1,
6
-      "dialysis_no": "001",
7
-      "admission_number": "",
8
-      "source": 1,
9
-      "lapseto": 1,
10
-      "partition_id": 0,
11
-      "bed_id": 0,
12
-      "name": "演示患者一",
13
-      "alias": "",
14
-      "gender": 1,
15
-      "nation": "汉",
16
-      "native_place": "广东深圳",
17
-      "marital_status": 1,
18
-      "id_card_no": "999999190001019999",
19
-      "birthday": -312537600,
20
-      "reimbursement_way_id": 7,
21
-      "health_care_type": 0,
22
-      "health_care_no": "604324517",
23
-      "health_care_due_date": 0,
24
-      "height": 158,
25
-      "blood_type": 0,
26
-      "rh": 0,
27
-      "health_care_due_alert_date": 0,
28
-      "education_level": 5,
29
-      "profession": 10,
30
-      "phone": "13800000001",
31
-      "home_telephone": "",
32
-      "relative_phone": "",
33
-      "relative_relations": "",
34
-      "home_address": "深圳市罗湖区鸿翔花园",
35
-      "work_unit": "无",
36
-      "unit_address": "无",
37
-      "children": 2,
38
-      "receiving_date": 0,
39
-      "is_hospital_first_dialysis": 1,
40
-      "first_dialysis_date": 1110816000,
41
-      "first_dialysis_hospital": "深圳市人民医院",
42
-      "predialysis_condition": "",
43
-      "pre_hospital_dialysis_frequency": "每周3次",
44
-      "pre_hospital_dialysis_times": 1820,
45
-      "hospital_first_dialysis_date": 1511366400,
46
-      "induction_period": 0,
47
-      "initial_dialysis": 0,
48
-      "total_dialysis": 0,
49
-      "attending_doctor_id": 0,
50
-      "head_nurse_id": 0,
51
-      "evaluate": "",
52
-      "diagnose": "慢病肾功能不全(尿毒症期)",
53
-      "remark": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
54
-      "registrars_id": 185,
55
-      "registrars": "",
56
-      "qr_code": "",
57
-      "binding_state": 2,
58
-      "patient_complains": "慢病肾功能不全(尿毒症期)",
59
-      "present_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
60
-      "past_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
61
-      "temperature": 39,
62
-      "pulse": 60,
63
-      "respiratory": 100,
64
-      "sbp": 0,
65
-      "dbp": 0,
66
-      "status": 1,
67
-      "created_time": 1537347970,
68
-      "updated_time": 1584343696,
69
-      "solutions": null,
70
-      "age": 60,
71
-      "schedules": null,
72
-      "contagions": null,
73
-      "diseases": null,
74
-      "response_result": "",
75
-      "is_open_remind": 1,
76
-      "dialysis_age": 0,
77
-      "expense_kind": 3,
78
-      "tell_phone": "21212",
79
-      "first_treatment_date": 1582560000,
80
-      "contact_name": "21221",
81
-      "is_infectious":1,
82
-      "contagion_ids": ""
83
-
84
-
85
-    },
86
-    {
87
-      "avatar": "https://images.shengws.com/201809182128111.png",
88
-      "patient_type": 1,
89
-      "dialysis_no": "002",
90
-      "admission_number": "",
91
-      "source": 1,
92
-      "lapseto": 1,
93
-      "partition_id": 0,
94
-      "bed_id": 0,
95
-      "name": "演示患者二",
96
-      "alias": "",
97
-      "gender": 2,
98
-      "nation": "汉",
99
-      "native_place": "广东深圳",
100
-      "marital_status": 1,
101
-      "id_card_no": "999999190001018888",
102
-      "birthday": -312537600,
103
-      "reimbursement_way_id": 7,
104
-      "health_care_type": 0,
105
-      "health_care_no": "604324517",
106
-      "health_care_due_date": 0,
107
-      "height": 158,
108
-      "blood_type": 0,
109
-      "rh": 0,
110
-      "health_care_due_alert_date": 0,
111
-      "education_level": 5,
112
-      "profession": 10,
113
-      "phone": "13800000001",
114
-      "home_telephone": "",
115
-      "relative_phone": "",
116
-      "relative_relations": "哥哥",
117
-      "home_address": "深圳市罗湖区鸿翔花园",
118
-      "work_unit": "无",
119
-      "unit_address": "无",
120
-      "children": 2,
121
-      "receiving_date": 0,
122
-      "is_hospital_first_dialysis": 1,
123
-      "first_dialysis_date": 1110816000,
124
-      "first_dialysis_hospital": "深圳市人民医院",
125
-      "predialysis_condition": "",
126
-      "pre_hospital_dialysis_frequency": "每周3次",
127
-      "pre_hospital_dialysis_times": 1820,
128
-      "hospital_first_dialysis_date": 1511366400,
129
-      "induction_period": 0,
130
-      "initial_dialysis": 0,
131
-      "total_dialysis": 0,
132
-      "attending_doctor_id": 0,
133
-      "head_nurse_id": 0,
134
-      "evaluate": "",
135
-      "diagnose": "慢病肾功能不全(尿毒症期)",
136
-      "remark": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
137
-      "registrars_id": 185,
138
-      "registrars": "",
139
-      "qr_code": "",
140
-      "binding_state": 2,
141
-      "patient_complains": "慢病肾功能不全(尿毒症期)",
142
-      "present_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
143
-      "past_history": "慢病肾功能不全(尿毒症期)肾性贫血,肾性高血压,多囊肾,多囊肝,支气管炎;",
144
-      "temperature": 39,
145
-      "pulse": 60,
146
-      "respiratory": 100,
147
-      "sbp": 0,
148
-      "dbp": 0,
149
-      "status": 1,
150
-      "created_time": 1537347970,
151
-      "updated_time": 1584343696,
152
-      "solutions": null,
153
-      "age": 60,
154
-      "schedules": null,
155
-      "contagions": null,
156
-      "diseases": null,
157
-      "response_result": "",
158
-      "is_open_remind": 1,
159
-      "dialysis_age": 0,
160
-      "expense_kind": 3,
161
-      "tell_phone": "21212",
162
-      "first_treatment_date": 1582560000,
163
-      "contact_name": "21221",
164
-      "is_infectious":2,
165
-      "contagion_ids": "2"
166
-
167
-    }
168
-  ]
169
-}
170
-

+ 0 - 73
controllers/new_mobile_api_controllers/role.json Просмотреть файл

@@ -1,73 +0,0 @@
1
-{
2
-  "roles": [
3
-    {
4
-      "role_name": "子管理员",
5
-      "role_introduction": "子管理员角色具备平台全部功能的使用权限,请谨慎配置",
6
-      "is_super_admin": false,
7
-      "status": 1,
8
-      "is_system": 1,
9
-      "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102,83,94",
11
-      "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12
-    },
13
-    {
14
-      "role_name": "医生",
15
-      "role_introduction": "医生角色能够进行建立患者档案,制定和调整患者透析治疗方案,定期评价病人的透析质量等",
16
-      "is_super_admin": false,
17
-      "status": 1,
18
-      "is_system": 2,
19
-      "number": 9998,
20
-      "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21
-      "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-    },
23
-    {
24
-      "role_name": "护士",
25
-      "role_introduction": "护士角色能够进行病人透析管理,以及医院的感染控制与消毒记录等",
26
-      "is_super_admin": false,
27
-      "status": 1,
28
-      "is_system": 3,
29
-      "number": 9997,
30
-      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76,83,94",
31
-      "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
32
-    },{
33
-      "role_name": "库存",
34
-      "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
35
-      "is_super_admin": false,
36
-      "status": 1,
37
-      "is_system": 0,
38
-      "number": 9996,
39
-      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,83,94",
40
-      "func_ids": ""
41
-    },{
42
-      "role_name": "运营",
43
-      "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
44
-      "is_super_admin": false,
45
-      "status": 1,
46
-      "is_system": 0,
47
-      "number": 9995,
48
-      "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
49
-      "func_ids": ""
50
-    },{
51
-      "role_name": "技师",
52
-      "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
53
-      "is_super_admin": false,
54
-      "status": 1,
55
-      "is_system": 0,
56
-      "number": 9994,
57
-      "purview_ids": "77,78,79,80,197,76",
58
-      "func_ids": ""
59
-    },
60
-    {
61
-      "role_name": "院长",
62
-      "role_introduction": "院长角色了解血透患者血液透析质量和相关的大数据,以及掌握透析中心整体运营情况",
63
-      "is_super_admin": false,
64
-      "status": 1,
65
-      "is_system": 0,
66
-      "number": 9993,
67
-      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201,83,94",
68
-      "func_ids": ""
69
-
70
-
71
-    }
72
-  ]
73
-}

+ 0 - 86
controllers/new_mobile_api_controllers/schedule_template.json Просмотреть файл

@@ -1,86 +0,0 @@
1
-{
2
-  "item": [
3
-    {
4
-      "treat_mode": 1,
5
-      "weekday": 1,
6
-      "time_type": 1
7
-    },
8
-    {
9
-      "treat_mode": 1,
10
-      "weekday": 1,
11
-      "time_type": 2
12
-    },
13
-    {
14
-
15
-      "treat_mode": 1,
16
-      "weekday": 2,
17
-      "time_type": 1
18
-    },
19
-
20
-    {
21
-
22
-      "treat_mode": 1,
23
-      "weekday": 2,
24
-      "time_type": 2
25
-    },
26
-    {
27
-
28
-      "treat_mode": 1,
29
-      "weekday": 3,
30
-      "time_type": 1
31
-    },
32
-    {
33
-
34
-      "treat_mode": 1,
35
-      "weekday": 3,
36
-      "time_type": 2
37
-    },
38
-    {
39
-
40
-      "treat_mode": 1,
41
-      "weekday": 4,
42
-      "time_type": 1
43
-    },
44
-    {
45
-
46
-      "treat_mode": 1,
47
-      "weekday": 4,
48
-      "time_type": 2
49
-    },
50
-    {
51
-
52
-      "treat_mode": 1,
53
-      "weekday": 5,
54
-      "time_type": 1
55
-    },
56
-    {
57
-
58
-      "treat_mode": 1,
59
-      "weekday": 5,
60
-      "time_type": 2
61
-    },
62
-    {
63
-
64
-      "treat_mode": 1,
65
-      "weekday": 6,
66
-      "time_type": 1
67
-    },
68
-    {
69
-
70
-      "treat_mode": 1,
71
-      "weekday": 6,
72
-      "time_type": 2
73
-    },
74
-    {
75
-
76
-      "treat_mode": 1,
77
-      "weekday": 7,
78
-      "time_type": 1
79
-    },
80
-    {
81
-      "treat_mode": 1,
82
-      "weekday": 7,
83
-      "time_type": 2
84
-    }
85
-  ]
86
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 1172
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go


+ 0 - 38
controllers/new_mobile_api_controllers/staff_schedule_api_router.go Просмотреть файл

@@ -1,38 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import "github.com/astaxie/beego"
4
-
5
-func StaffScheduleApiControllersRegisterRouters() {
6
-
7
-	beego.Router("/m/api/getmobiledoctorlist", &StaffScheduleApiController{}, "Get:GetMobileDoctorList")
8
-	beego.Router("/m/api/getmobilestaffschedulelist", &StaffScheduleApiController{}, "Get:GetMobileStaffScheduleList")
9
-	beego.Router("/m/api/getmobilenextweekschedulelist", &StaffScheduleApiController{}, "Get:GetMobileNextWeekScheduleLIst")
10
-	beego.Router("/m/api/getschedulebyusertype", &StaffScheduleApiController{}, "Get:GetScheduleByUserType")
11
-	beego.Router("/m/api/getsearchpatientbydoctorid", &StaffScheduleApiController{}, "Get:GetSearchPatientByDoctorId")
12
-	beego.Router("/m/api/getmobileschedulelist", &StaffScheduleApiController{}, "Get:GetMobileSchedulelist")
13
-	beego.Router("/m/api/getmobileschedulelisttoal", &StaffScheduleApiController{}, "Get:GetMobileScheduleListTotal")
14
-	beego.Router("m/api/getmyschedule", &StaffScheduleApiController{}, "Get:GetMySchedule")
15
-	beego.Router("/m/api/getmobilechartlist", &StaffScheduleApiController{}, "Get:GetMobileChartList")
16
-	beego.Router("/m/api/tosearchmobiletotal", &StaffScheduleApiController{}, "Get:ToSearchMobileTotal")
17
-	beego.Router("/m/api/changemobileoption", &StaffScheduleApiController{}, "Get:ChangeMobileOption")
18
-	beego.Router("/m/api/getallzone", &StaffScheduleApiController{}, "Get:GetAllZone")
19
-	beego.Router("/m/api/getallzonepb", &StaffScheduleApiController{}, "Get:GetAllZonePb")
20
-	beego.Router("/m/api/getpatientschedulelist", &StaffScheduleApiController{}, "Get:GetPatientScheduleList")
21
-	beego.Router("/m/api/deleteSchedule", &StaffScheduleApiController{}, "Get:DeleteSchedule")
22
-	beego.Router("/m/api/ssearchpatient", &StaffScheduleApiController{}, "Get:SearchPatient")
23
-	beego.Router("/m/api/updatepatientschedule", &StaffScheduleApiController{}, "Get:UpdatePatientScheduleById")
24
-	beego.Router("/m/api/updateschedulemode", &StaffScheduleApiController{}, "Get:UpdateBloodScheduleMode")
25
-	beego.Router("/m/api/updatedialysisprescription", &StaffScheduleApiController{}, "Get:UpdateDialysisPrescription")
26
-	beego.Router("/m/api/updateschedule", &StaffScheduleApiController{}, "Get:UpdateBloodSchedule")
27
-	beego.Router("m/api/schedule/patients", &StaffScheduleApiController{}, "Get:GetSchedulePatient")
28
-	beego.Router("/m/api/schedule/create", &StaffScheduleApiController{}, "Post:CreateMobileSchedulePatient")
29
-	beego.Router("m/api/schedule/getsolutionschedule", &StaffScheduleApiController{}, "Get:GetSolutionSchedule")
30
-
31
-	beego.Router("m/api/schedule/getallbedlist", &StaffScheduleApiController{}, "Get:GetAllBedList")
32
-
33
-	beego.Router("m/api/schedule/changeschedulebyid", &StaffScheduleApiController{}, "Get:ChangeScheduleById")
34
-
35
-	beego.Router("m/api/schedule/changescheduletype", &StaffScheduleApiController{}, "Get:ChangeScheduleType")
36
-
37
-	beego.Router("m/api/schedule/changeschedulebed", &StaffScheduleApiController{}, "Get:ChangeScheduleBed")
38
-}

+ 0 - 44
controllers/new_mobile_api_controllers/statistics_api_controllers.go Просмотреть файл

@@ -1,44 +0,0 @@
1
-package new_mobile_api_controllers
2
-
3
-import "github.com/astaxie/beego"
4
-
5
-func StatisticsAPIControllersRegisterRouters() {
6
-
7
-	//化验指标
8
-	beego.Router("/m/api/inspectionindex/init", &IndexEvaluationApiController{}, "Get:GetLaboratoryIndexInitData")
9
-	beego.Router("/m/api/rangevalue/get", &IndexEvaluationApiController{}, "Get:GetLaboratoryIndexProjectRangeValueData")
10
-	beego.Router("/m/api/inspectionindex/chart", &IndexEvaluationApiController{}, "Get:GetInspectionChartData")
11
-	beego.Router("/m/api/inspectionindex/table", &IndexEvaluationApiController{}, "Get:GetInspectionChartTableData")
12
-	beego.Router("/m/api/patientinspectionindex/chart", &IndexEvaluationApiController{}, "Get:GetPatientInspectionChartData")
13
-	beego.Router("/m/api/patientinspectionindex/barchart", &IndexEvaluationApiController{}, "Get:GetPatientInspectionBarChartData")
14
-
15
-	beego.Router("/m/api/dialysisprocessindex/chart", &IndexEvaluationApiController{}, "Get:GetDialysisProcessIndexChartData")
16
-	beego.Router("/m/api/dialysisprocessindex/table", &IndexEvaluationApiController{}, "Get:GetDialysisProcessIndexTableData")
17
-
18
-	beego.Router("/m/api/dialysiswatch/chart", &IndexEvaluationApiController{}, "Get:GetDialysisWatchChartData")
19
-	beego.Router("/m/api/dialysiswatch/table", &IndexEvaluationApiController{}, "Get:GetDialysisWatchTableData")
20
-
21
-	beego.Router("/m/api/dialysisbloodpressure/chart", &IndexEvaluationApiController{}, "Get:GetDialysisBloodPressureChartData")
22
-	beego.Router("/m/api/dialysisbloodpressure/table", &IndexEvaluationApiController{}, "Get:GetDialysisBloodPressureTableData")
23
-	beego.Router("/m/api/patientdialysisbloodpressure/chart", &IndexEvaluationApiController{}, "Get:GetDialysisPatientBloodPressureChartData")
24
-
25
-	beego.Router("/m/api/dialysisweight/chart", &IndexEvaluationApiController{}, "Get:GetDialysisWeightChartData")
26
-	beego.Router("/m/api/dialysisweight/table", &IndexEvaluationApiController{}, "Get:GetDialysisWeightTableData")
27
-	beego.Router("/m/api/patientdialysisweight/chart", &IndexEvaluationApiController{}, "Get:GetDialysisPatientWeightChartData")
28
-
29
-	beego.Router("/m/api/doctorworkload/chart", &IndexEvaluationApiController{}, "Get:GetDoctorWorkloadChartData")
30
-	beego.Router("/m/api/doctorworkload/table", &IndexEvaluationApiController{}, "Get:GetDoctorWorkloadTableData")
31
-
32
-	beego.Router("/m/api/nurseworkload/chart", &IndexEvaluationApiController{}, "Get:GetNurseWorkloadChartData")
33
-	beego.Router("/m/api/nurseworkload/table", &IndexEvaluationApiController{}, "Get:GetNurseWorkloadTableData")
34
-
35
-	beego.Router("/m/api/adminuser/all", &IndexEvaluationApiController{}, "Get:GetAdminUser")
36
-	beego.Router("/m/api/defalutpatient/get", &IndexEvaluationApiController{}, "Get:GetDefaultPatient")
37
-
38
-	beego.Router("/m/api/patients/get", &IndexEvaluationApiController{}, "Get:GetAllPatients")
39
-
40
-	beego.Router("/m/api/stock/get", &ManagementAnalyseApiController{}, "Get:StockRecordPrintData")
41
-	beego.Router("/m/api/patientlapseto/chart", &ManagementAnalyseApiController{}, "Get:StatisticsPatientChart")
42
-	beego.Router("/m/api/patientlapseto/table", &ManagementAnalyseApiController{}, "Get:StatisticsPatientTable")
43
-
44
-}

+ 0 - 57
controllers/new_mobile_api_controllers/system_dialysis_prescription.json Просмотреть файл

@@ -1,57 +0,0 @@
1
-{
2
-  "prescription": [
3
-    {
4
-      "anticoagulant": 3,
5
-      "anticoagulant_shouji": 4000,
6
-      "anticoagulant_weichi": 0,
7
-      "anticoagulant_zongliang": 4000,
8
-      "mode_id": 1,
9
-      "blood_flow_volume": 250,
10
-      "kalium": 2,
11
-      "sodium": 135,
12
-      "calcium": 1.5,
13
-      "status": 1,
14
-      "dialysis_duration_hour": 4,
15
-      "dialysis_duration_minute": 0
16
-    },{
17
-      "anticoagulant": 3,
18
-      "anticoagulant_shouji": 4000,
19
-      "anticoagulant_weichi": 0,
20
-      "anticoagulant_zongliang": 4000,
21
-      "mode_id": 2,
22
-      "blood_flow_volume": 250,
23
-      "kalium": 2,
24
-      "sodium": 135,
25
-      "calcium": 1.5,
26
-      "status": 1,
27
-      "dialysis_duration_hour": 4,
28
-      "dialysis_duration_minute": 0
29
-    },{
30
-      "anticoagulant": 3,
31
-      "anticoagulant_shouji": 4000,
32
-      "anticoagulant_weichi": 0,
33
-      "anticoagulant_zongliang": 4000,
34
-      "mode_id": 3,
35
-      "blood_flow_volume": 200,
36
-      "kalium": 2,
37
-      "sodium": 135,
38
-      "calcium": 1.5,
39
-      "status": 1,
40
-      "dialysis_duration_hour": 4,
41
-      "dialysis_duration_minute": 0
42
-    },{
43
-      "anticoagulant": 3,
44
-      "anticoagulant_shouji": 4000,
45
-      "anticoagulant_weichi": 0,
46
-      "anticoagulant_zongliang": 4000,
47
-      "mode_id": 12,
48
-      "blood_flow_volume": 200,
49
-      "kalium": 2,
50
-      "sodium": 135,
51
-      "calcium": 1.5,
52
-      "status": 1,
53
-      "dialysis_duration_hour": 4,
54
-      "dialysis_duration_minute": 0
55
-    }
56
-  ]
57
-}

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

@@ -1 +0,0 @@
1
-package controllers

+ 0 - 296
controllers/orginfo_api_controller.go Просмотреть файл

@@ -1,296 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"encoding/json"
9
-	"reflect"
10
-	"time"
11
-
12
-	"github.com/astaxie/beego"
13
-)
14
-
15
-type OrgInfoApiController struct {
16
-	BaseAuthAPIController
17
-}
18
-
19
-func OrgInfoApiRegistRouters() {
20
-	beego.Router("/api/orginfo/getinfo", &OrgInfoApiController{}, "get:GetOrgInfo")
21
-	beego.Router("/api/orginfo/savegallery", &OrgInfoApiController{}, "post:SaveOrgGallery")
22
-	beego.Router("/api/orginfo/deletegallery", &OrgInfoApiController{}, "delete:DeleteOrgGallery")
23
-	beego.Router("/api/orginfo/edit", &OrgInfoApiController{}, "post:EditOrgInfo")
24
-
25
-}
26
-
27
-func (c *OrgInfoApiController) GetOrgInfo() {
28
-
29
-	adminUserInfo := c.GetAdminUserInfo()
30
-
31
-	orgInfo := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
32
-	provinces, _ := service.GetDistrictsByUpid(0)
33
-	var citys []*models.District
34
-	var districts []*models.District
35
-	if orgInfo.Province > 0 {
36
-		citys, _ = service.GetDistrictsByUpid(orgInfo.Province)
37
-	}
38
-	if orgInfo.City > 0 {
39
-		districts, _ = service.GetDistrictsByUpid(orgInfo.City)
40
-	}
41
-
42
-	orgtypes, _ := service.GetOrgTypes()
43
-
44
-	illness, _ := service.GetIllnessList()
45
-
46
-	c.ServeSuccessJSON(map[string]interface{}{
47
-		"orginfo":   orgInfo,
48
-		"provinces": provinces,
49
-		"citys":     citys,
50
-		"districts": districts,
51
-		"orgtypes":  orgtypes,
52
-		"illness":   illness,
53
-	})
54
-	return
55
-}
56
-
57
-func (c *OrgInfoApiController) EditOrgInfo() {
58
-	adminUserInfo := c.GetAdminUserInfo()
59
-
60
-	tempOrg, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
61
-
62
-	if tempOrg != nil && adminUserInfo.AdminUser.Id != tempOrg.Creator {
63
-		c.ServeFailJsonSend(enums.ErrorCodePermissionDenied, "权限不足")
64
-		return
65
-	}
66
-
67
-	dataBody := make(map[string]interface{}, 0)
68
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
69
-	if err != nil {
70
-		utils.ErrorLog(err.Error())
71
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
72
-		return
73
-	}
74
-
75
-	orgInfo := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
76
-	org := *orgInfo
77
-
78
-	if dataBody["org_name"] == nil || reflect.TypeOf(dataBody["org_name"]).String() != "string" {
79
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "缺少参数:机构名称")
80
-		return
81
-	}
82
-	orgName, _ := dataBody["org_name"].(string)
83
-	if len(orgName) == 0 {
84
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "机构名称不能为空")
85
-		return
86
-	}
87
-
88
-	org.OrgName = orgName
89
-
90
-	if dataBody["contact_name"] == nil || reflect.TypeOf(dataBody["contact_name"]).String() != "string" {
91
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "缺少参数:联系人姓名")
92
-		return
93
-	}
94
-	contactName, _ := dataBody["contact_name"].(string)
95
-	if len(contactName) == 0 {
96
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "联系人姓名不能为空")
97
-		return
98
-	}
99
-	org.ContactName = contactName
100
-
101
-	// if dataBody["org_short_name"] == nil || reflect.TypeOf(dataBody["org_short_name"]).String() != "string" {
102
-	// 	c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "缺少参数:商家简称")
103
-	// 	return
104
-	// }
105
-	// orgShortName, _ := dataBody["org_short_name"].(string)
106
-	// if len(orgShortName) == 0 {
107
-	// 	c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "商家简称不能为空")
108
-	// 	return
109
-	// }
110
-	org.OrgShortName = orgName
111
-
112
-	if dataBody["org_introduction"] == nil || reflect.TypeOf(dataBody["org_introduction"]).String() != "string" {
113
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "缺少参数:机构介绍")
114
-		return
115
-	}
116
-	orgIntroduction, _ := dataBody["org_introduction"].(string)
117
-	if len(orgIntroduction) == 0 {
118
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "机构介绍不能为空")
119
-		return
120
-	}
121
-	org.OrgIntroduction = orgIntroduction
122
-
123
-	if dataBody["org_logo"] == nil || reflect.TypeOf(dataBody["org_logo"]).String() != "string" {
124
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "缺少参数:机构头像")
125
-		return
126
-	}
127
-	orgLogo, _ := dataBody["org_logo"].(string)
128
-	if len(orgLogo) == 0 {
129
-		c.ServeFailJsonSend(enums.ErrorCodeParamWrong, "机构头像不能为空")
130
-		return
131
-	}
132
-	org.OrgLogo = orgLogo
133
-
134
-	if dataBody["province"] != nil || reflect.TypeOf(dataBody["province"]).String() == "float64" {
135
-		province := int64(dataBody["province"].(float64))
136
-		org.Province = province
137
-	}
138
-
139
-	if dataBody["city"] != nil || reflect.TypeOf(dataBody["city"]).String() == "float64" {
140
-		city := int64(dataBody["city"].(float64))
141
-		org.City = city
142
-	}
143
-
144
-	if dataBody["district"] != nil || reflect.TypeOf(dataBody["district"]).String() == "float64" {
145
-		district := int64(dataBody["district"].(float64))
146
-		org.District = district
147
-	}
148
-
149
-	if dataBody["address"] != nil || reflect.TypeOf(dataBody["address"]).String() == "string" {
150
-		address, _ := dataBody["address"].(string)
151
-		org.Address = address
152
-	}
153
-
154
-	if dataBody["org_type"] != nil || reflect.TypeOf(dataBody["org_type"]).String() == "float64" {
155
-		orgType := int64(dataBody["org_type"].(float64))
156
-		org.OrgType = orgType
157
-	}
158
-
159
-	if dataBody["telephone"] != nil || reflect.TypeOf(dataBody["telephone"]).String() == "string" {
160
-		telephone, _ := dataBody["telephone"].(string)
161
-		org.Telephone = telephone
162
-	}
163
-
164
-	if dataBody["operating_state"] != nil || reflect.TypeOf(dataBody["operating_state"]).String() == "float64" {
165
-		operatingState := int64(dataBody["operating_state"].(float64))
166
-		org.OperatingState = operatingState
167
-	}
168
-
169
-	if dataBody["business_week"] != nil || reflect.TypeOf(dataBody["business_week"]).String() == "string" {
170
-		businessWeek, _ := dataBody["business_week"].(string)
171
-		org.BusinessWeek = businessWeek
172
-	}
173
-
174
-	if dataBody["business_time"] != nil || reflect.TypeOf(dataBody["business_time"]).String() == "string" {
175
-		businessTime, _ := dataBody["business_time"].(string)
176
-		org.BusinessTime = businessTime
177
-	}
178
-	if dataBody["illness"] != nil || reflect.TypeOf(dataBody["illness"]).String() == "string" {
179
-		illness, _ := dataBody["illness"].(string)
180
-		org.Illness = illness
181
-	}
182
-
183
-	timeNow := time.Now().Unix()
184
-	org.ModifyTime = timeNow
185
-	org.OrgGallery = nil
186
-	err = service.UpdateOrgInfo(&org)
187
-	if err != nil {
188
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
189
-		return
190
-	}
191
-
192
-	orgInfo.OrgName = orgName
193
-	orgInfo.OrgShortName = orgName
194
-	orgInfo.OrgIntroduction = orgIntroduction
195
-	orgInfo.OrgLogo = orgLogo
196
-	orgInfo.Province = org.Province
197
-	orgInfo.District = org.District
198
-	orgInfo.City = org.City
199
-	orgInfo.OrgType = org.OrgType
200
-	orgInfo.Telephone = org.Telephone
201
-	orgInfo.OperatingState = org.OperatingState
202
-	orgInfo.BusinessWeek = org.BusinessWeek
203
-	orgInfo.BusinessTime = org.BusinessTime
204
-	orgInfo.Illness = org.Illness
205
-	orgInfo.ContactName = org.ContactName
206
-
207
-	c.ServeSuccessJSON(map[string]interface{}{
208
-		"msg": "ok",
209
-	})
210
-	return
211
-}
212
-
213
-func (c *OrgInfoApiController) SaveOrgGallery() {
214
-	adminUserInfo := c.GetAdminUserInfo()
215
-
216
-	dataBody := make(map[string]interface{}, 0)
217
-	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
218
-	if err != nil {
219
-		utils.ErrorLog(err.Error())
220
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
221
-		return
222
-	}
223
-
224
-	if dataBody["type"] == nil || reflect.TypeOf(dataBody["type"]).String() != "float64" {
225
-		utils.ErrorLog("type")
226
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
227
-		return
228
-	}
229
-	galleryType := int64(dataBody["type"].(float64))
230
-	if galleryType != 1 && galleryType != 2 {
231
-		utils.ErrorLog("galleryType != 1&&2")
232
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
233
-		return
234
-	}
235
-
236
-	if dataBody["url"] == nil || reflect.TypeOf(dataBody["url"]).String() != "string" {
237
-		utils.ErrorLog("url")
238
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
239
-		return
240
-	}
241
-	url, _ := dataBody["url"].(string)
242
-	if len(url) == 0 {
243
-		utils.ErrorLog("len(url) == 0")
244
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
245
-		return
246
-	}
247
-
248
-	timeNow := time.Now().Unix()
249
-	var gallery models.OrgGallery
250
-	gallery.Type = galleryType
251
-	gallery.Url = url
252
-	gallery.OrgId = adminUserInfo.CurrentOrgId
253
-	gallery.Status = 1
254
-	gallery.Ctime = timeNow
255
-	gallery.Mtime = timeNow
256
-	err = service.CreateOrgGalleryItem(&gallery)
257
-	if err != nil {
258
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
259
-		return
260
-	}
261
-
262
-	orgInfo := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
263
-	orgInfo.OrgGallery = append(orgInfo.OrgGallery, &gallery)
264
-	c.ServeSuccessJSON(map[string]interface{}{
265
-		"msg": "ok",
266
-	})
267
-	return
268
-
269
-}
270
-
271
-func (c *OrgInfoApiController) DeleteOrgGallery() {
272
-	adminUserInfo := c.GetAdminUserInfo()
273
-	id, _ := c.GetInt64("id", 0)
274
-	if id <= 0 {
275
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
276
-		return
277
-	}
278
-
279
-	err := service.DeleteOrgGalleryItem(id)
280
-	if err != nil {
281
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
282
-		return
283
-	}
284
-
285
-	orgInfo := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
286
-	for index, item := range orgInfo.OrgGallery {
287
-		if item.ID == id {
288
-			orgInfo.OrgGallery = append(orgInfo.OrgGallery[:index], orgInfo.OrgGallery[index+1:]...)
289
-		}
290
-	}
291
-	c.ServeSuccessJSON(map[string]interface{}{
292
-		"msg": "ok",
293
-	})
294
-	return
295
-
296
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 5449
controllers/patient_api_controller.go


Разница между файлами не показана из-за своего большого размера
+ 0 - 1040
controllers/patient_dataconfig_api_controller.go


+ 0 - 620
controllers/pay_api_controller.go Просмотреть файл

@@ -1,620 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"bytes"
8
-	"crypto/md5"
9
-	"encoding/hex"
10
-	"encoding/json"
11
-	"encoding/xml"
12
-	"errors"
13
-	"fmt"
14
-	"github.com/astaxie/beego"
15
-	"io/ioutil"
16
-	"math/rand"
17
-	"net/http"
18
-	"regexp"
19
-	"sort"
20
-	"strconv"
21
-	"strings"
22
-	"time"
23
-)
24
-
25
-const (
26
-	pay_url = "https://api.mch.weixin.qq.com/pay/unifiedorder"
27
-)
28
-
29
-type PayApiController struct {
30
-	BaseServeAPIController
31
-	parameters       map[string]string
32
-	resultParameters map[string]string
33
-	payUrl           string
34
-}
35
-
36
-type PayApiController2 struct {
37
-	beego.Controller
38
-	parameters       map[string]string
39
-	resultParameters map[string]string
40
-	payUrl           string
41
-}
42
-
43
-func PayApiRegistRouters() {
44
-	beego.Router("/api/my/service", &PayApiController{}, "Get:GetMyService")
45
-	beego.Router("/api/product", &PayApiController{}, "Get:GetProduct")
46
-	beego.Router("/api/pay", &PayApiController{}, "Get:GetPayUrl")
47
-	beego.Router("/api/pay/transfer", &PayApiController{}, "Post:PostTransferStatus")
48
-	beego.Router("/api/order", &PayApiController{}, "Post:PostOrderInfo")
49
-	beego.Router("/api/order/get", &PayApiController{}, "Get:GetOrderInfo")
50
-	beego.Router("/api/pay/notify", &PayApiController2{}, "Post:WxPaySuccessNotify")
51
-	beego.Router("/api/order/cancel", &PayApiController{}, "Post:CancelOrder")
52
-	beego.Router("/api/order/list", &PayApiController{}, "Get:GetOrderList")
53
-	beego.Router("/api/order/hetong", &PayApiController{}, "Get:GetHeTong")
54
-	beego.Router("/api/order/hetong", &PayApiController{}, "Post:CreateHeTong")
55
-
56
-}
57
-func (c *PayApiController) GetOrderList() {
58
-	adminUserInfo := c.GetAdminUserInfo()
59
-	serviceOrderList, err := service.GetOrderList(adminUserInfo.CurrentOrgId)
60
-	if err == nil {
61
-		c.ServeSuccessJSON(map[string]interface{}{
62
-			"list": serviceOrderList,
63
-		})
64
-	} else {
65
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
66
-	}
67
-
68
-}
69
-
70
-func (c *PayApiController) CancelOrder() {
71
-	adminUserInfo := c.GetAdminUserInfo()
72
-	orderId, _ := c.GetInt64("id", 0)
73
-	if orderId == 0 {
74
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
75
-		return
76
-	}
77
-	order, err := service.FindServeOrderByID(adminUserInfo.CurrentOrgId, orderId)
78
-	if err != nil {
79
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
80
-		return
81
-	}
82
-	if order == nil {
83
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
84
-		return
85
-	}
86
-
87
-	errs := service.UpdateOrderStatus(adminUserInfo.CurrentOrgId, orderId)
88
-	if errs == nil {
89
-		c.ServeSuccessJSON(map[string]interface{}{
90
-			"msg": "取消成功",
91
-		})
92
-	} else {
93
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
94
-	}
95
-}
96
-
97
-func (c *PayApiController) PostTransferStatus() {
98
-	adminUserInfo := c.GetAdminUserInfo()
99
-	orderId, _ := c.GetInt64("id", 0)
100
-	if orderId == 0 {
101
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
102
-		return
103
-	}
104
-	order, err := service.FindServeOrderByID(adminUserInfo.CurrentOrgId, orderId)
105
-	if err != nil {
106
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
107
-		return
108
-	}
109
-	if order == nil {
110
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
111
-		return
112
-	}
113
-
114
-	errs := service.UpdateOrderPayType(adminUserInfo.CurrentOrgId, orderId)
115
-
116
-	if errs == nil {
117
-		c.ServeSuccessJSON(map[string]interface{}{
118
-			"msg": "确认成功",
119
-		})
120
-	} else {
121
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
122
-	}
123
-}
124
-
125
-func (c *PayApiController) GetOrderInfo() {
126
-	adminUserInfo := c.GetAdminUserInfo()
127
-	orderId, _ := c.GetInt64("id", 0)
128
-	order, err := service.FindServeOrderByID(adminUserInfo.CurrentOrgId, orderId)
129
-	if err != nil {
130
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
131
-		return
132
-	}
133
-	if order == nil {
134
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
135
-		return
136
-	}
137
-
138
-	orderInfo, err := service.FindOrderInfomationByID(order.OrderNumber, adminUserInfo.CurrentOrgId)
139
-	if err != nil {
140
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
141
-		return
142
-	}
143
-	if orderInfo == nil {
144
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
145
-		return
146
-	}
147
-	c.ServeSuccessJSON(map[string]interface{}{
148
-		"total":       order.PaymentAmount,
149
-		"orderNumber": order.OrderNumber,
150
-		"OrgName":     adminUserInfo.Orgs[adminUserInfo.CurrentOrgId].OrgName,
151
-		"order":       order,
152
-		"orderInfo":   orderInfo,
153
-	})
154
-}
155
-
156
-func (c *PayApiController) PostOrderInfo() {
157
-	adminUserInfo := c.GetAdminUserInfo()
158
-	amount, _ := c.GetInt64("amount", 0)
159
-	productId, _ := c.GetInt64("id", 0)
160
-
161
-	product, err := service.FindProductByID(productId)
162
-	if err != nil {
163
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
164
-		return
165
-	}
166
-	if product == nil {
167
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeProductError)
168
-		return
169
-	}
170
-	timestamp := c.GetTimestamp()
171
-	//自定义订单号
172
-	bill_no := "S" + strconv.FormatInt(timestamp, 10) + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
173
-
174
-	order := models.ServeOrder{
175
-		OrgId:           adminUserInfo.CurrentOrgId,
176
-		Period:          amount * 12,
177
-		Status:          1,
178
-		CreatedTime:     time.Now().Unix(),
179
-		UpdatedTime:     time.Now().Unix(),
180
-		OrderNumber:     bill_no,
181
-		OrderStatus:     1,
182
-		PayableAmount:   float64(amount) * product.Price,
183
-		PaymentAmount:   float64(amount) * product.Price,
184
-		ServeName:       product.ServeName,
185
-		ServeDesc:       product.ServeDesc,
186
-		OrderExpireTime: time.Now().Unix() + (7 * 24 * 3600),
187
-		Quantity:        amount,
188
-		Price:           product.Price,
189
-		ServeId:         productId,
190
-	}
191
-	infomation := models.ServeOrderInfomation{
192
-		OrgId:       adminUserInfo.CurrentOrgId,
193
-		OrderNumber: bill_no,
194
-		Status:      1,
195
-		ProductId:   product.ID,
196
-		ProductName: product.ServeName,
197
-		ProductDesc: product.ServeDesc,
198
-		Price:       product.Price,
199
-		Quantity:    amount,
200
-		MarketPrice: product.OriginalPrice,
201
-	}
202
-
203
-	service.CreateOrderRecord(&order)
204
-	service.CreateOrderInfomation(&infomation)
205
-	c.ServeSuccessJSON(map[string]interface{}{
206
-		"order": order,
207
-		"msg":   "提交订单成功",
208
-	})
209
-}
210
-
211
-func (c *PayApiController) GetProduct() {
212
-	adminUserInfo := c.GetAdminUserInfo()
213
-	products, err := service.FindAllProduct()
214
-	subscibe, _ := service.FindServiceSubscibeByOrgId(adminUserInfo.CurrentOrgId)
215
-
216
-	if err == nil {
217
-		c.ServeSuccessJSON(map[string]interface{}{
218
-			"products":    products,
219
-			"subscibe":    subscibe,
220
-			"serviceTime": time.Now().Unix(),
221
-			//"OrgName":  adminUserInfo.Orgs[adminUserInfo.CurrentOrgId].OrgName,
222
-		})
223
-	} else {
224
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
225
-	}
226
-}
227
-
228
-func (c *PayApiController) GetMyService() {
229
-	adminUserInfo := c.GetAdminUserInfo()
230
-	subscibe, err := service.FindServiceSubscibeByOrgId(adminUserInfo.CurrentOrgId)
231
-	if err == nil {
232
-		c.ServeSuccessJSON(map[string]interface{}{
233
-			"subscibe":    subscibe,
234
-			"serviceTime": time.Now().Unix(),
235
-		})
236
-	} else {
237
-
238
-	}
239
-
240
-}
241
-
242
-func (c *PayApiController) GetPayUrl() {
243
-	adminUserInfo := c.GetAdminUserInfo()
244
-	orderId, _ := c.GetInt64("id", 0)
245
-	if orderId == 0 {
246
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
247
-		return
248
-	}
249
-	order, err := service.FindServeOrderByID(adminUserInfo.CurrentOrgId, orderId)
250
-	if err != nil {
251
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
252
-		return
253
-	}
254
-	if order == nil {
255
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
256
-		return
257
-	}
258
-
259
-	orderInfo, err := service.FindOrderInfomationByID(order.OrderNumber, adminUserInfo.CurrentOrgId)
260
-	if err != nil {
261
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
262
-		return
263
-	}
264
-	if orderInfo == nil {
265
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
266
-		return
267
-	}
268
-
269
-	totalPrice := orderInfo.Price * float64(orderInfo.Quantity)
270
-	totalFee := fmt.Sprintf("%.0f", totalPrice*100)
271
-	c.SetParameter("out_trade_no", orderInfo.OrderNumber)
272
-	c.SetParameter("total_fee", totalFee)
273
-	c.SetParameter("trade_type", "NATIVE")
274
-	c.SetParameter("body", order.ServeName)
275
-	notify_url := beego.AppConfig.String("httpdomain") + "/api/pay/notify"
276
-	c.SetParameter("product_id", orderInfo.OrderNumber)
277
-	c.SetParameter("notify_url", notify_url)
278
-	c.SetParameter("spbill_create_ip", c.GetClientIp())
279
-	fmt.Println(c.GetClientIp())
280
-	url, err := c.GetPayCodeUrl()
281
-	fmt.Println(err)
282
-	if err == nil {
283
-		c.SetPayUrl(url)
284
-		c.ServeSuccessJSON(map[string]interface{}{
285
-			"payUrl": url,
286
-			"price":  order.PayableAmount,
287
-			//":  adminUserInfo.Orgs[adminUserInfo.CurrentOrgId].OrgName,
288
-		})
289
-	} else {
290
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
291
-		// utils.LogError(err)
292
-	}
293
-
294
-}
295
-
296
-func (this *PayApiController2) WxPaySuccessNotify() {
297
-
298
-	type PaySuccessXmlResp struct {
299
-		ReturnCode    string `xml:"return_code"`
300
-		Appid         string `xml:"appid"`
301
-		BankType      string `xml:"bank_type"`
302
-		CashFee       int64  `xml:"cash_fee"`
303
-		FeeType       string `xml:"fee_type"`
304
-		IsSubscribe   string `xml:"is_subscribe"`
305
-		MchId         string `xml:"mch_id"`
306
-		NonceStr      string `xml:"nonce_str"`
307
-		OpenId        string `xml:"openid"`
308
-		OutTradeNo    string `xml:"out_trade_no"`
309
-		ResultCode    string `xml:"result_code"`
310
-		Sign          string `xml:"sign"`
311
-		TimeEnd       string `xml:"time_end"`
312
-		TotalFee      string `xml:"total_fee"`
313
-		TradeType     string `xml:"trade_type"`
314
-		TransactionId string `xml:"transaction_id"`
315
-	}
316
-
317
-	defer this.Ctx.Request.Body.Close()
318
-	result, _ := ioutil.ReadAll(this.Ctx.Request.Body)
319
-
320
-	res := new(PaySuccessXmlResp)
321
-	xmlErr := xml.Unmarshal(result, &res)
322
-	if xmlErr != nil {
323
-
324
-	}
325
-
326
-	order, _ := service.FindServeOrderByOrderNumber(res.OutTradeNo)
327
-	service.UpdateOrder(order.OrderNumber, order.Quantity, order.OrgId, res.TransactionId, order.PeriodEnd, order.PeriodStart)
328
-
329
-	this.SetResultParameter("return_code", res.ReturnCode)
330
-	results := this.ParamsToXml2(this.resultParameters)
331
-	this.Ctx.WriteString(results)
332
-	this.ServeXML()
333
-
334
-}
335
-
336
-func (this *PayApiController) GetTimestamp() int64 {
337
-	return time.Now().UnixNano() / 1000000 //毫秒
338
-}
339
-
340
-func (this *PayApiController) GetClientIp() string {
341
-	ip := this.Ctx.Request.Header.Get("Remote_addr")
342
-	if ip == "" {
343
-		ip = this.Ctx.Request.RemoteAddr
344
-	}
345
-	if strings.Contains(ip, ":") {
346
-		ip = this.Substr(ip, 0, strings.Index(ip, ":"))
347
-	}
348
-	return ip
349
-}
350
-
351
-//截取字符串 start 起点下标 end 终点下标(不包括)
352
-func (this *PayApiController) Substr(str string, start int, end int) string {
353
-	rs := []rune(str)
354
-	length := len(rs)
355
-
356
-	if start < 0 || start > length {
357
-		return ""
358
-	}
359
-	if end < 0 || end > length {
360
-		return ""
361
-	}
362
-	return string(rs[start:end])
363
-}
364
-
365
-//设置请求参数
366
-func (this *PayApiController) SetParameter(key string, value string) {
367
-	if this.parameters == nil {
368
-		this.parameters = make(map[string]string)
369
-	}
370
-	this.parameters[key] = value
371
-}
372
-
373
-//设置请求参数
374
-func (this *PayApiController2) SetResultParameter(key string, value string) {
375
-	if this.resultParameters == nil {
376
-		this.resultParameters = make(map[string]string)
377
-	}
378
-	this.resultParameters[key] = value
379
-}
380
-
381
-//设置prepay_id
382
-func (this *PayApiController) SetPayUrl(payUrl string) {
383
-	this.payUrl = payUrl
384
-}
385
-
386
-type XmlResp struct {
387
-	Return_code  string `xml:"return_code"`
388
-	Return_msg   string `xml:"return_msg"`
389
-	Result_code  string `xml:"result_code"`
390
-	Err_code     string `xml:"err_code"`
391
-	Err_code_des string `xml:"err_code_des"`
392
-	Prepay_id    string `xml:"prepay_id"`
393
-	Code_url     string `xml:"code_url"`
394
-}
395
-
396
-func (this *PayApiController) GetPayCodeUrl() (string, error) {
397
-	strXml, err := this.CreateXml()
398
-	if err != nil {
399
-		return "", this.Error("get pay_code_url error", err)
400
-	}
401
-	result, err := this.http_post(pay_url, strXml)
402
-	if err != nil {
403
-		return "", this.Error("get pay_code_url error", err)
404
-	}
405
-
406
-	res := new(XmlResp)
407
-	xmlErr := xml.Unmarshal(result, &res)
408
-	if xmlErr != nil {
409
-		return "", this.Error("get pay_code_url xml error", xmlErr)
410
-	}
411
-	if res.Return_code != "SUCCESS" {
412
-		return "", this.Error("get pay_code_url result error: "+res.Return_msg, nil)
413
-	}
414
-
415
-	if res.Result_code != "SUCCESS" {
416
-		return "", this.Error("get pay_code_url result error: "+res.Err_code+"-"+res.Err_code_des, nil)
417
-	}
418
-	if res.Code_url == "" {
419
-		return "", this.Error("get pay_code_url result error: not get pay_code_url", nil)
420
-	}
421
-	return res.Code_url, nil
422
-}
423
-
424
-func (this *PayApiController) http_post(url string, xml string) ([]byte, error) {
425
-	bc := &http.Client{
426
-		Timeout: 30 * time.Second, //设置超时时间30s
427
-	}
428
-	res, err := bc.Post(url, "text/xml:charset=UTF-8", strings.NewReader(xml))
429
-	if err != nil {
430
-		return nil, this.Error("post", err)
431
-	}
432
-	result, err := ioutil.ReadAll(res.Body)
433
-	res.Body.Close()
434
-	if err != nil {
435
-		return nil, this.Error("post result err", err)
436
-	}
437
-	return result, nil
438
-}
439
-
440
-func (this *PayApiController) CreateXml() (string, error) {
441
-	//检测必填参数
442
-	if this.parameters["out_trade_no"] == "" {
443
-		return "", this.Error("缺少统一支付接口必填参数out_trade_no(商户订单号)!", nil)
444
-	} else if this.parameters["body"] == "" {
445
-		return "", this.Error("缺少统一支付接口必填参数body(商品描述)!", nil)
446
-	} else if this.parameters["total_fee"] == "" {
447
-		return "", this.Error("缺少统一支付接口必填参数total_fee(交易金额)!", nil)
448
-	} else if this.parameters["notify_url"] == "" {
449
-		return "", this.Error("缺少统一支付接口必填参数notify_url(异步接收微信支付结果通知的回调地址)!", nil)
450
-	} else if this.parameters["trade_type"] == "" {
451
-		return "", this.Error("缺少统一支付接口必填参数trade_type(交易类型)!", nil)
452
-	} else if this.parameters["spbill_create_ip"] == "" {
453
-		return "", this.Error("缺少统一支付接口必填参数spbill_create_ip(终端ip)", nil)
454
-	} else if this.parameters["trade_type"] == "NATIVE" && this.parameters["product_id"] == "" {
455
-		return "", this.Error("统一支付接口中,缺少必填参数product_id!trade_type为NATIVE时,product_id为必填参数!", nil)
456
-	}
457
-	this.parameters["appid"] = beego.AppConfig.String("appid")                             //公众账号ID
458
-	this.parameters["mch_id"] = beego.AppConfig.String("mchid")                            //商户号
459
-	this.parameters["nonce_str"] = this.CreateNoncestr(32)                                 //随机字符串
460
-	this.parameters["sign"] = this.GetSign(this.parameters, beego.AppConfig.String("key")) //签名
461
-	return this.ParamsToXml(this.parameters), nil
462
-}
463
-
464
-//产生随机字符串,不长于32位
465
-func (this *PayApiController) CreateNoncestr(length int) (nonceStr string) {
466
-	chars := "abcdefghijklmnopqrstuvwxyz0123456789"
467
-	for i := 0; i < length; i++ {
468
-		idx := rand.Intn(len(chars) - 1)
469
-		nonceStr += chars[idx : idx+1]
470
-	}
471
-	return
472
-}
473
-
474
-func (this *PayApiController) Error(strMsg string, err error) error {
475
-	if err == nil {
476
-		return errors.New(strMsg)
477
-	} else {
478
-		return errors.New(strMsg + ": " + err.Error())
479
-	}
480
-}
481
-
482
-//格式化参数,签名过程需要使用
483
-func (this *PayApiController) FormatParams(paramsMap map[string]string) string {
484
-	//STEP 1, 对key进行升序排序.
485
-	var sorted_keys []string
486
-	for k, _ := range paramsMap {
487
-		sorted_keys = append(sorted_keys, k)
488
-	}
489
-	sort.Strings(sorted_keys)
490
-
491
-	//STEP2, 对key=value的键值对用&连接起来,略过空值
492
-	var paramsStr []string
493
-	for _, k := range sorted_keys {
494
-		v := fmt.Sprintf("%v", strings.TrimSpace(paramsMap[k]))
495
-		if v != "" {
496
-			paramsStr = append(paramsStr, fmt.Sprintf("%s=%s", k, v))
497
-		}
498
-	}
499
-	return strings.Join(paramsStr, "&")
500
-}
501
-
502
-//生成签名
503
-func (this *PayApiController) GetSign(paramsMap map[string]string, wxKey string) string {
504
-	//STEP 1:按字典序排序参数
505
-	paramsStr := this.FormatParams(paramsMap)
506
-	//STEP 2:在string后加入KEY
507
-	signStr := paramsStr + "&key=" + wxKey
508
-	//STEP 3:MD5加密
509
-	sign := md5.New()
510
-	sign.Write([]byte(signStr))
511
-	//STEP 3:所有字符转为大写
512
-	return strings.ToUpper(hex.EncodeToString(sign.Sum(nil)))
513
-}
514
-
515
-//xml结构
516
-func (this *PayApiController) ParamsToXml(data map[string]string) string {
517
-	fmt.Println(data)
518
-	buf := bytes.NewBufferString("<xml>")
519
-	for k, v := range data {
520
-		str := "<![CDATA[%s]]>"
521
-		flag, _ := regexp.MatchString("^\\d+\\.?\\d*$", v)
522
-		if flag {
523
-			str = "%s"
524
-		}
525
-		buf.WriteString(fmt.Sprintf("<%s>"+str+"</%s>", k, v, k))
526
-	}
527
-	buf.WriteString("</xml>")
528
-	return buf.String()
529
-}
530
-
531
-//xml结构
532
-func (this *PayApiController2) ParamsToXml2(data map[string]string) string {
533
-	fmt.Println(data)
534
-	buf := bytes.NewBufferString("<xml>")
535
-	for k, v := range data {
536
-		str := "<![CDATA[%s]]>"
537
-		flag, _ := regexp.MatchString("^\\d+\\.?\\d*$", v)
538
-		if flag {
539
-			str = "%s"
540
-		}
541
-		buf.WriteString(fmt.Sprintf("<%s>"+str+"</%s>", k, v, k))
542
-	}
543
-	buf.WriteString("</xml>")
544
-	return buf.String()
545
-}
546
-
547
-func (this *PayApiController) SetUrl(payUrl string) {
548
-	this.payUrl = payUrl
549
-}
550
-
551
-func (c *PayApiController) GetHeTong() {
552
-	order_id, _ := c.GetInt64("order_id", 0)
553
-	if order_id <= 0 {
554
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
555
-		return
556
-	}
557
-
558
-	admin := c.GetAdminUserInfo()
559
-	ht, err := service.GetHetong(admin.CurrentOrgId, order_id)
560
-	if err != nil {
561
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
562
-		return
563
-	}
564
-
565
-	c.ServeSuccessJSON(map[string]interface{}{
566
-		"ht": ht,
567
-	})
568
-}
569
-
570
-func (c *PayApiController) CreateHeTong() {
571
-	orderId, _ := c.GetInt64("order_id", 0)
572
-	if orderId <= 0 {
573
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
574
-		return
575
-	}
576
-	admin := c.GetAdminUserInfo()
577
-	order, err := service.FindServeOrderByID(admin.CurrentOrgId, orderId)
578
-	if err != nil {
579
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
580
-		return
581
-	}
582
-	if order == nil {
583
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeServeNotExist)
584
-		return
585
-	}
586
-	ht, err := service.GetHetong(admin.CurrentOrgId, orderId)
587
-	if err != nil {
588
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
589
-		return
590
-	}
591
-	if ht != nil {
592
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHetongHad)
593
-		return
594
-	}
595
-
596
-	var hetong models.ServeOrderContract
597
-	err = json.Unmarshal(c.Ctx.Input.RequestBody, &hetong)
598
-	if err != nil {
599
-		fmt.Println(err)
600
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
601
-		return
602
-	}
603
-
604
-	hetong.OrderId = orderId
605
-	hetong.OrderNumber = order.OrderNumber
606
-	hetong.CreatedTime = time.Now().Unix()
607
-	hetong.UpdatedTime = time.Now().Unix()
608
-	hetong.Status = 1
609
-	hetong.OrgId = admin.CurrentOrgId
610
-
611
-	err = service.CreateHetong(&hetong)
612
-	if err != nil {
613
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateHetongFail)
614
-		return
615
-	}
616
-
617
-	c.ServeSuccessJSON(map[string]interface{}{
618
-		"ht": hetong,
619
-	})
620
-}

+ 0 - 922
controllers/pc_index_evaluation_api_controller.go Просмотреть файл

@@ -1,922 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service/statistics_service"
7
-	"XT_New/utils"
8
-	"github.com/astaxie/beego"
9
-	"time"
10
-)
11
-
12
-func PCIndexEvaluationApiControllersRegisterRouters() {
13
-
14
-	beego.Router("/api/inspectionindex/init", &PCIndexEvaluationApiController{}, "Get:GetLaboratoryIndexInitData")
15
-	beego.Router("/api/rangevalue/get", &PCIndexEvaluationApiController{}, "Get:GetLaboratoryIndexProjectRangeValueData")
16
-	beego.Router("/api/inspectionindex/chart", &PCIndexEvaluationApiController{}, "Get:GetInspectionChartData")
17
-	beego.Router("/api/inspectionindex/table", &PCIndexEvaluationApiController{}, "Get:GetInspectionChartTableData")
18
-	beego.Router("/api/patientinspectionindex/chart", &PCIndexEvaluationApiController{}, "Get:GetPatientInspectionChartData")
19
-	beego.Router("/api/patientinspectionindex/barchart", &PCIndexEvaluationApiController{}, "Get:GetPatientInspectionBarChartData")
20
-
21
-	beego.Router("/api/dialysisprocessindex/chart", &PCIndexEvaluationApiController{}, "Get:GetDialysisProcessIndexChartData")
22
-	beego.Router("/api/dialysisprocessindex/table", &PCIndexEvaluationApiController{}, "Get:GetDialysisProcessIndexTableData")
23
-
24
-	beego.Router("/api/dialysiswatch/chart", &PCIndexEvaluationApiController{}, "Get:GetDialysisWatchChartData")
25
-	beego.Router("/api/dialysiswatch/table", &PCIndexEvaluationApiController{}, "Get:GetDialysisWatchTableData")
26
-
27
-	beego.Router("/api/dialysisbloodpressure/chart", &PCIndexEvaluationApiController{}, "Get:GetDialysisBloodPressureChartData")
28
-	beego.Router("/api/dialysisbloodpressure/table", &PCIndexEvaluationApiController{}, "Get:GetDialysisBloodPressureTableData")
29
-	beego.Router("/api/patientdialysisbloodpressure/chart", &PCIndexEvaluationApiController{}, "Get:GetDialysisPatientBloodPressureChartData")
30
-
31
-	beego.Router("/api/dialysisweight/chart", &PCIndexEvaluationApiController{}, "Get:GetDialysisWeightChartData")
32
-	beego.Router("/api/dialysisweight/table", &PCIndexEvaluationApiController{}, "Get:GetDialysisWeightTableData")
33
-	beego.Router("/api/patientdialysisweight/chart", &PCIndexEvaluationApiController{}, "Get:GetDialysisPatientWeightChartData")
34
-
35
-	beego.Router("/api/doctorworkload/chart", &PCIndexEvaluationApiController{}, "Get:GetDoctorWorkloadChartData")
36
-	beego.Router("/api/doctorworkload/table", &PCIndexEvaluationApiController{}, "Get:GetDoctorWorkloadTableData")
37
-
38
-	beego.Router("/api/nurseworkload/chart", &PCIndexEvaluationApiController{}, "Get:GetNurseWorkloadChartData")
39
-	beego.Router("/api/nurseworkload/table", &PCIndexEvaluationApiController{}, "Get:GetNurseWorkloadTableData")
40
-
41
-	beego.Router("/api/adminuser/all", &PCIndexEvaluationApiController{}, "Get:GetAdminUser")
42
-	beego.Router("/api/defalutpatient/get", &PCIndexEvaluationApiController{}, "Get:GetDefaultPatient")
43
-
44
-}
45
-
46
-type PCIndexEvaluationApiController struct {
47
-	BaseAuthAPIController
48
-}
49
-
50
-//化验指标
51
-
52
-//初始化数据
53
-func (this *PCIndexEvaluationApiController) GetLaboratoryIndexInitData() {
54
-	adminUserInfo := this.GetAdminUserInfo()
55
-
56
-	var references []*models.InspectionReference
57
-	count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
58
-	if count <= 0 {
59
-		references, _ = statistics_service.FindOrgInspectionReference(0, 1)
60
-		references2, _ := statistics_service.FindOrgInspectionReference(0, 2)
61
-		references = append(references, references2...)
62
-
63
-	} else {
64
-		references, _ = statistics_service.FindOrgInspectionReference(adminUserInfo.CurrentOrgId, 1)
65
-		references2, _ := statistics_service.FindOrgInspectionReference(adminUserInfo.CurrentOrgId, 2)
66
-		references = append(references, references2...)
67
-
68
-	}
69
-	this.ServeSuccessJSON(map[string]interface{}{
70
-		"references": references,
71
-	})
72
-}
73
-
74
-//获取取值范围
75
-func (this *PCIndexEvaluationApiController) GetLaboratoryIndexProjectRangeValueData() {
76
-	range_type, _ := this.GetInt64("range_type")
77
-	project_id, _ := this.GetInt64("project_id")
78
-	item_id, _ := this.GetInt64("item_id")
79
-	adminUserInfo := this.GetAdminUserInfo()
80
-	var range_vaule []string
81
-	var qcs models.InspectionReference
82
-	if range_type == 1 {
83
-		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
84
-
85
-		if count <= 0 {
86
-			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
87
-		} else {
88
-			qcs, _ = statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
89
-
90
-		}
91
-
92
-		range_vaule = append(range_vaule, qcs.RangeMin)
93
-		range_vaule = append(range_vaule, qcs.RangeMax)
94
-
95
-	} else {
96
-
97
-		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
98
-		for _, item := range inspection {
99
-			range_vaule = append(range_vaule, item.InspectValue)
100
-		}
101
-
102
-	}
103
-	this.ServeSuccessJSON(map[string]interface{}{
104
-		"range_vaule": range_vaule,
105
-	})
106
-
107
-}
108
-func (this *PCIndexEvaluationApiController) GetInspectionChartData() {
109
-	adminUserInfo := this.GetAdminUserInfo()
110
-	start_time := this.GetString("start_time")
111
-	end_time := this.GetString("end_time")
112
-	project_id, _ := this.GetInt64("project_id")
113
-	item_id, _ := this.GetInt64("item_id")
114
-	range_type, _ := this.GetInt("range_type")
115
-
116
-	timeLayout := "2006-01-02"
117
-	loc, _ := time.LoadLocation("Local")
118
-
119
-	var theStartTIme int64
120
-	if len(start_time) > 0 {
121
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
122
-		if err != nil {
123
-			utils.ErrorLog(err.Error())
124
-		}
125
-		theStartTIme = theTime.Unix()
126
-	}
127
-	var theEndtTIme int64
128
-	if len(end_time) > 0 {
129
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
130
-		if err != nil {
131
-			utils.ErrorLog(err.Error())
132
-		}
133
-		theEndtTIme = theTime.Unix()
134
-	}
135
-
136
-	var range_value string
137
-
138
-	if range_type == 1 {
139
-		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
140
-
141
-		if count <= 0 {
142
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
143
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
144
-
145
-		} else {
146
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
147
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
148
-		}
149
-
150
-	} else {
151
-
152
-		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
153
-		for _, item := range inspection {
154
-			if len(range_value) == 0 {
155
-				range_value = item.InspectValue
156
-			} else {
157
-				range_value = range_value + "," + item.InspectValue
158
-			}
159
-		}
160
-
161
-	}
162
-
163
-	data, _ := statistics_service.GetInspectionChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value)
164
-	this.ServeSuccessJSON(map[string]interface{}{
165
-		"data": data,
166
-	})
167
-
168
-}
169
-func (this *PCIndexEvaluationApiController) GetInspectionChartTableData() {
170
-	adminUserInfo := this.GetAdminUserInfo()
171
-	start_time := this.GetString("start_time")
172
-	end_time := this.GetString("end_time")
173
-	patient_id, _ := this.GetInt64("patient_id")
174
-	page, _ := this.GetInt64("page")
175
-	limit, _ := this.GetInt64("limit")
176
-	project_id, _ := this.GetInt64("project_id")
177
-	item_id, _ := this.GetInt64("item_id")
178
-	range_value := this.GetString("range_value")
179
-	range_type, _ := this.GetInt("range_type")
180
-
181
-	if page == 0 {
182
-		page = 1
183
-	}
184
-	if limit == 0 {
185
-		limit = 20
186
-	}
187
-	timeLayout := "2006-01-02"
188
-	loc, _ := time.LoadLocation("Local")
189
-
190
-	var theStartTIme int64
191
-	if len(start_time) > 0 {
192
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
193
-		if err != nil {
194
-			utils.ErrorLog(err.Error())
195
-		}
196
-		theStartTIme = theTime.Unix()
197
-	}
198
-	var theEndtTIme int64
199
-	if len(end_time) > 0 {
200
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
201
-		if err != nil {
202
-			utils.ErrorLog(err.Error())
203
-		}
204
-		theEndtTIme = theTime.Unix()
205
-	}
206
-	data, total, _ := statistics_service.GetInspectionChartTableData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, patient_id, page, limit, range_type, range_value)
207
-	this.ServeSuccessJSON(map[string]interface{}{
208
-		"data":  data,
209
-		"total": total,
210
-	})
211
-
212
-}
213
-func (this *PCIndexEvaluationApiController) GetPatientInspectionChartData() {
214
-	adminUserInfo := this.GetAdminUserInfo()
215
-	start_time := this.GetString("start_time")
216
-	end_time := this.GetString("end_time")
217
-	project_id, _ := this.GetInt64("project_id")
218
-	item_id, _ := this.GetInt64("item_id")
219
-	patient_id, _ := this.GetInt64("patient_id")
220
-
221
-	timeLayout := "2006-01-02"
222
-	loc, _ := time.LoadLocation("Local")
223
-
224
-	var theStartTIme int64
225
-	if len(start_time) > 0 {
226
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
227
-		if err != nil {
228
-			utils.ErrorLog(err.Error())
229
-		}
230
-		theStartTIme = theTime.Unix()
231
-	}
232
-	var theEndtTIme int64
233
-	if len(end_time) > 0 {
234
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
235
-		if err != nil {
236
-			utils.ErrorLog(err.Error())
237
-		}
238
-		theEndtTIme = theTime.Unix()
239
-	}
240
-
241
-	data, _ := statistics_service.GetPatientInspectionChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, patient_id)
242
-	references, _ := statistics_service.FindOrgQualityControlStandardInspectionReferenceById(adminUserInfo.CurrentOrgId, project_id, item_id)
243
-
244
-	this.ServeSuccessJSON(map[string]interface{}{
245
-		"data":       data,
246
-		"references": references,
247
-	})
248
-
249
-}
250
-func (this *PCIndexEvaluationApiController) GetPatientInspectionBarChartData() {
251
-	adminUserInfo := this.GetAdminUserInfo()
252
-	start_time := this.GetString("start_time")
253
-	end_time := this.GetString("end_time")
254
-	project_id, _ := this.GetInt64("project_id")
255
-	item_id, _ := this.GetInt64("item_id")
256
-	range_type, _ := this.GetInt("range_type")
257
-	patient_id, _ := this.GetInt64("patient_id")
258
-
259
-	timeLayout := "2006-01-02"
260
-	loc, _ := time.LoadLocation("Local")
261
-
262
-	var theStartTIme int64
263
-	if len(start_time) > 0 {
264
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
265
-		if err != nil {
266
-			utils.ErrorLog(err.Error())
267
-		}
268
-		theStartTIme = theTime.Unix()
269
-	}
270
-	var theEndtTIme int64
271
-	if len(end_time) > 0 {
272
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
273
-		if err != nil {
274
-			utils.ErrorLog(err.Error())
275
-		}
276
-		theEndtTIme = theTime.Unix()
277
-	}
278
-
279
-	var range_value string
280
-	if range_type == 1 {
281
-		count, _ := statistics_service.FindOrgInspectionCount(adminUserInfo.CurrentOrgId)
282
-
283
-		if count <= 0 {
284
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(0, project_id, item_id)
285
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
286
-
287
-		} else {
288
-			qcs, _ := statistics_service.FindOrgConfigRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
289
-			range_value = qcs.RangeMin + "," + qcs.RangeMax
290
-		}
291
-
292
-	} else {
293
-
294
-		inspection, _ := statistics_service.FindOrgInspectionReferenceRangeTypeValue(adminUserInfo.CurrentOrgId, project_id, item_id)
295
-		for _, item := range inspection {
296
-			if len(range_value) == 0 {
297
-				range_value = item.InspectValue
298
-			} else {
299
-				range_value = range_value + "," + item.InspectValue
300
-			}
301
-		}
302
-
303
-	}
304
-	data, _ := statistics_service.GetPatientInspectionBarChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, project_id, item_id, range_type, range_value, patient_id)
305
-	this.ServeSuccessJSON(map[string]interface{}{
306
-		"data": data,
307
-	})
308
-
309
-}
310
-
311
-func (this *PCIndexEvaluationApiController) GetAdminUser() {
312
-	admins, _ := statistics_service.GetAllAdminUser(this.GetAdminUserInfo().CurrentOrgId)
313
-	this.ServeSuccessJSON(map[string]interface{}{
314
-		"admin": admins,
315
-	})
316
-}
317
-
318
-func (this *PCIndexEvaluationApiController) GetDialysisProcessIndexChartData() {
319
-	adminUserInfo := this.GetAdminUserInfo()
320
-	statistics_type, _ := this.GetInt("statistics_type")
321
-	start_time := this.GetString("start_time")
322
-	end_time := this.GetString("end_time")
323
-	patient_id, _ := this.GetInt64("patient_id")
324
-	timeLayout := "2006-01-02"
325
-	loc, _ := time.LoadLocation("Local")
326
-
327
-	var theStartTIme int64
328
-	if len(start_time) > 0 {
329
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
330
-		if err != nil {
331
-			utils.ErrorLog(err.Error())
332
-		}
333
-		theStartTIme = theTime.Unix()
334
-	}
335
-	var theEndtTIme int64
336
-	if len(end_time) > 0 {
337
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
338
-		if err != nil {
339
-			utils.ErrorLog(err.Error())
340
-		}
341
-		theEndtTIme = theTime.Unix()
342
-	}
343
-
344
-	if patient_id == 0 {
345
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
346
-		if patientInfo == nil {
347
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
348
-			return
349
-		}
350
-		if statistics_type == 9 || statistics_type == 10 {
351
-			data, _ := statistics_service.GetDialysisProcessIndexOtherChartData(adminUserInfo.CurrentOrgId, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
352
-
353
-			this.ServeSuccessJSON(map[string]interface{}{
354
-				"data": data,
355
-			})
356
-		} else {
357
-
358
-			data, _ := statistics_service.GetDialysisProcessIndexChartData(adminUserInfo.CurrentOrgId, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
359
-
360
-			this.ServeSuccessJSON(map[string]interface{}{
361
-				"data": data,
362
-			})
363
-
364
-		}
365
-	} else {
366
-		if statistics_type == 9 || statistics_type == 10 {
367
-			data, _ := statistics_service.GetDialysisProcessIndexOtherChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
368
-
369
-			this.ServeSuccessJSON(map[string]interface{}{
370
-				"data": data,
371
-			})
372
-
373
-		} else {
374
-			data, _ := statistics_service.GetDialysisProcessIndexChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
375
-
376
-			this.ServeSuccessJSON(map[string]interface{}{
377
-				"data": data,
378
-			})
379
-
380
-		}
381
-	}
382
-
383
-}
384
-func (this *PCIndexEvaluationApiController) GetDialysisProcessIndexTableData() {
385
-	adminUserInfo := this.GetAdminUserInfo()
386
-	start_time := this.GetString("start_time")
387
-	end_time := this.GetString("end_time")
388
-	patient_id, _ := this.GetInt64("patient_id")
389
-
390
-	page, _ := this.GetInt64("page")
391
-	limit, _ := this.GetInt64("limit")
392
-
393
-	if page == 0 {
394
-		page = 1
395
-	}
396
-	if limit == 0 {
397
-		limit = 20
398
-	}
399
-
400
-	timeLayout := "2006-01-02"
401
-	loc, _ := time.LoadLocation("Local")
402
-
403
-	var theStartTIme int64
404
-	if len(start_time) > 0 {
405
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
406
-		if err != nil {
407
-			utils.ErrorLog(err.Error())
408
-		}
409
-		theStartTIme = theTime.Unix()
410
-	}
411
-	var theEndtTIme int64
412
-	if len(end_time) > 0 {
413
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
414
-		if err != nil {
415
-			utils.ErrorLog(err.Error())
416
-		}
417
-		theEndtTIme = theTime.Unix()
418
-	}
419
-
420
-	if patient_id == 0 {
421
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
422
-		if patientInfo == nil {
423
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
424
-			return
425
-		}
426
-
427
-		data, total, _ := statistics_service.GetDialysisProcessIndexTableData(adminUserInfo.CurrentOrgId, patientInfo.ID, page, limit, theStartTIme, theEndtTIme)
428
-
429
-		this.ServeSuccessJSON(map[string]interface{}{
430
-			"data":  data,
431
-			"total": total,
432
-		})
433
-
434
-	} else {
435
-		data, total, _ := statistics_service.GetDialysisProcessIndexTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
436
-		this.ServeSuccessJSON(map[string]interface{}{
437
-			"data":  data,
438
-			"total": total,
439
-		})
440
-
441
-	}
442
-
443
-}
444
-
445
-func (this *PCIndexEvaluationApiController) GetDialysisWatchChartData() {
446
-	adminUserInfo := this.GetAdminUserInfo()
447
-	statistics_type, _ := this.GetInt("statistics_type")
448
-	start_time := this.GetString("start_time")
449
-	end_time := this.GetString("end_time")
450
-	patient_id, _ := this.GetInt64("patient_id")
451
-	timeLayout := "2006-01-02"
452
-	loc, _ := time.LoadLocation("Local")
453
-
454
-	var theStartTIme int64
455
-	if len(start_time) > 0 {
456
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
457
-		if err != nil {
458
-			utils.ErrorLog(err.Error())
459
-		}
460
-		theStartTIme = theTime.Unix()
461
-	}
462
-	var theEndtTIme int64
463
-	if len(end_time) > 0 {
464
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
465
-		if err != nil {
466
-			utils.ErrorLog(err.Error())
467
-		}
468
-		theEndtTIme = theTime.Unix()
469
-	}
470
-
471
-	if patient_id == 0 {
472
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
473
-		if patientInfo == nil {
474
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
475
-			return
476
-		}
477
-		data, _ := statistics_service.GetDialysisWatchChartData(adminUserInfo.CurrentOrgId, patientInfo.ID, theStartTIme, theEndtTIme, statistics_type)
478
-		this.ServeSuccessJSON(map[string]interface{}{
479
-			"data": data,
480
-		})
481
-	} else {
482
-		data, _ := statistics_service.GetDialysisWatchChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
483
-		this.ServeSuccessJSON(map[string]interface{}{
484
-			"data": data,
485
-		})
486
-	}
487
-
488
-}
489
-func (this *PCIndexEvaluationApiController) GetDialysisWatchTableData() {
490
-	adminUserInfo := this.GetAdminUserInfo()
491
-	start_time := this.GetString("start_time")
492
-	end_time := this.GetString("end_time")
493
-	patient_id, _ := this.GetInt64("patient_id")
494
-	page, _ := this.GetInt64("page")
495
-	limit, _ := this.GetInt64("limit")
496
-
497
-	if page == 0 {
498
-		page = 1
499
-	}
500
-	if limit == 0 {
501
-		limit = 20
502
-	}
503
-	timeLayout := "2006-01-02"
504
-	loc, _ := time.LoadLocation("Local")
505
-
506
-	var theStartTIme int64
507
-	if len(start_time) > 0 {
508
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
509
-		if err != nil {
510
-			utils.ErrorLog(err.Error())
511
-		}
512
-		theStartTIme = theTime.Unix()
513
-	}
514
-	var theEndtTIme int64
515
-	if len(end_time) > 0 {
516
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
517
-		if err != nil {
518
-			utils.ErrorLog(err.Error())
519
-		}
520
-		theEndtTIme = theTime.Unix()
521
-	}
522
-
523
-	if patient_id == 0 {
524
-		patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
525
-		if patientInfo == nil {
526
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
527
-			return
528
-		}
529
-
530
-		data, total, _ := statistics_service.GetDialysisWatchTableData(adminUserInfo.CurrentOrgId, patientInfo.ID, page, limit, theStartTIme, theEndtTIme)
531
-
532
-		this.ServeSuccessJSON(map[string]interface{}{
533
-			"data":  data,
534
-			"total": total,
535
-		})
536
-
537
-	} else {
538
-
539
-		data, total, _ := statistics_service.GetDialysisWatchTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
540
-		this.ServeSuccessJSON(map[string]interface{}{
541
-			"data":  data,
542
-			"total": total,
543
-		})
544
-
545
-	}
546
-
547
-}
548
-
549
-func (this *PCIndexEvaluationApiController) GetDialysisBloodPressureChartData() {
550
-	adminUserInfo := this.GetAdminUserInfo()
551
-	statistics_type, _ := this.GetInt("statistics_type")
552
-	start_time := this.GetString("start_time")
553
-	end_time := this.GetString("end_time")
554
-	patient_id, _ := this.GetInt64("patient_id")
555
-
556
-	timeLayout := "2006-01-02"
557
-	loc, _ := time.LoadLocation("Local")
558
-
559
-	var theStartTIme int64
560
-	if len(start_time) > 0 {
561
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
562
-		if err != nil {
563
-			utils.ErrorLog(err.Error())
564
-		}
565
-		theStartTIme = theTime.Unix()
566
-	}
567
-	var theEndtTIme int64
568
-	if len(end_time) > 0 {
569
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
570
-		if err != nil {
571
-			utils.ErrorLog(err.Error())
572
-		}
573
-		theEndtTIme = theTime.Unix()
574
-	}
575
-
576
-	data, _ := statistics_service.GetBloodPressureChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type, patient_id)
577
-	this.ServeSuccessJSON(map[string]interface{}{
578
-		"data": data,
579
-	})
580
-
581
-}
582
-func (this *PCIndexEvaluationApiController) GetDialysisBloodPressureTableData() {
583
-	adminUserInfo := this.GetAdminUserInfo()
584
-	start_time := this.GetString("start_time")
585
-	end_time := this.GetString("end_time")
586
-	patient_id, _ := this.GetInt64("patient_id")
587
-	page, _ := this.GetInt64("page")
588
-	limit, _ := this.GetInt64("limit")
589
-
590
-	if page == 0 {
591
-		page = 1
592
-	}
593
-	if limit == 0 {
594
-		limit = 20
595
-	}
596
-	timeLayout := "2006-01-02"
597
-	loc, _ := time.LoadLocation("Local")
598
-
599
-	var theStartTIme int64
600
-	if len(start_time) > 0 {
601
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
602
-		if err != nil {
603
-			utils.ErrorLog(err.Error())
604
-		}
605
-		theStartTIme = theTime.Unix()
606
-	}
607
-	var theEndtTIme int64
608
-	if len(end_time) > 0 {
609
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
610
-		if err != nil {
611
-			utils.ErrorLog(err.Error())
612
-		}
613
-		theEndtTIme = theTime.Unix()
614
-	}
615
-
616
-	data, total, _ := statistics_service.GetBloodPressureTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
617
-	this.ServeSuccessJSON(map[string]interface{}{
618
-		"data":  data,
619
-		"total": total,
620
-	})
621
-
622
-}
623
-func (this *PCIndexEvaluationApiController) GetDialysisPatientBloodPressureChartData() {
624
-	adminUserInfo := this.GetAdminUserInfo()
625
-	statistics_type, _ := this.GetInt("statistics_type")
626
-	start_time := this.GetString("start_time")
627
-	end_time := this.GetString("end_time")
628
-	patient_id, _ := this.GetInt64("patient_id")
629
-
630
-	timeLayout := "2006-01-02"
631
-	loc, _ := time.LoadLocation("Local")
632
-
633
-	var theStartTIme int64
634
-	if len(start_time) > 0 {
635
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
636
-		if err != nil {
637
-			utils.ErrorLog(err.Error())
638
-		}
639
-		theStartTIme = theTime.Unix()
640
-	}
641
-	var theEndtTIme int64
642
-	if len(end_time) > 0 {
643
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
644
-		if err != nil {
645
-			utils.ErrorLog(err.Error())
646
-		}
647
-		theEndtTIme = theTime.Unix()
648
-	}
649
-
650
-	data, _ := statistics_service.GetPatientBloodPressureChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
651
-	this.ServeSuccessJSON(map[string]interface{}{
652
-		"data": data,
653
-	})
654
-
655
-}
656
-
657
-func (this *PCIndexEvaluationApiController) GetDialysisWeightChartData() {
658
-	adminUserInfo := this.GetAdminUserInfo()
659
-	statistics_type, _ := this.GetInt("statistics_type")
660
-	start_time := this.GetString("start_time")
661
-	end_time := this.GetString("end_time")
662
-	timeLayout := "2006-01-02"
663
-	loc, _ := time.LoadLocation("Local")
664
-
665
-	var theStartTIme int64
666
-	if len(start_time) > 0 {
667
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
668
-		if err != nil {
669
-			utils.ErrorLog(err.Error())
670
-		}
671
-		theStartTIme = theTime.Unix()
672
-	}
673
-	var theEndtTIme int64
674
-	if len(end_time) > 0 {
675
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
676
-		if err != nil {
677
-			utils.ErrorLog(err.Error())
678
-		}
679
-		theEndtTIme = theTime.Unix()
680
-	}
681
-
682
-	data, _ := statistics_service.GetDialysisWeightChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type)
683
-	this.ServeSuccessJSON(map[string]interface{}{
684
-		"data": data,
685
-	})
686
-
687
-}
688
-func (this *PCIndexEvaluationApiController) GetDialysisWeightTableData() {
689
-	adminUserInfo := this.GetAdminUserInfo()
690
-	start_time := this.GetString("start_time")
691
-	end_time := this.GetString("end_time")
692
-	patient_id, _ := this.GetInt64("patient_id")
693
-	page, _ := this.GetInt64("page")
694
-	limit, _ := this.GetInt64("limit")
695
-
696
-	if page == 0 {
697
-		page = 1
698
-	}
699
-	if limit == 0 {
700
-		limit = 20
701
-	}
702
-	timeLayout := "2006-01-02"
703
-	loc, _ := time.LoadLocation("Local")
704
-
705
-	var theStartTIme int64
706
-	if len(start_time) > 0 {
707
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
708
-		if err != nil {
709
-			utils.ErrorLog(err.Error())
710
-		}
711
-		theStartTIme = theTime.Unix()
712
-	}
713
-	var theEndtTIme int64
714
-	if len(end_time) > 0 {
715
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
716
-		if err != nil {
717
-			utils.ErrorLog(err.Error())
718
-		}
719
-		theEndtTIme = theTime.Unix()
720
-	}
721
-
722
-	data, total, _ := statistics_service.GetDialysisWeightTableData(adminUserInfo.CurrentOrgId, patient_id, page, limit, theStartTIme, theEndtTIme)
723
-	this.ServeSuccessJSON(map[string]interface{}{
724
-		"data":  data,
725
-		"total": total,
726
-	})
727
-}
728
-func (this *PCIndexEvaluationApiController) GetDialysisPatientWeightChartData() {
729
-	adminUserInfo := this.GetAdminUserInfo()
730
-	statistics_type, _ := this.GetInt("statistics_type")
731
-	start_time := this.GetString("start_time")
732
-	end_time := this.GetString("end_time")
733
-	patient_id, _ := this.GetInt64("patient_id")
734
-
735
-	timeLayout := "2006-01-02"
736
-	loc, _ := time.LoadLocation("Local")
737
-
738
-	var theStartTIme int64
739
-	if len(start_time) > 0 {
740
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
741
-		if err != nil {
742
-			utils.ErrorLog(err.Error())
743
-		}
744
-		theStartTIme = theTime.Unix()
745
-	}
746
-	var theEndtTIme int64
747
-	if len(end_time) > 0 {
748
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
749
-		if err != nil {
750
-			utils.ErrorLog(err.Error())
751
-		}
752
-		theEndtTIme = theTime.Unix()
753
-	}
754
-
755
-	data, _ := statistics_service.GetPatientDialysisWeightChartData(adminUserInfo.CurrentOrgId, patient_id, theStartTIme, theEndtTIme, statistics_type)
756
-	this.ServeSuccessJSON(map[string]interface{}{
757
-		"data": data,
758
-	})
759
-
760
-}
761
-
762
-func (this *PCIndexEvaluationApiController) GetDoctorWorkloadChartData() {
763
-	adminUserInfo := this.GetAdminUserInfo()
764
-	statistics_type, _ := this.GetInt("statistics_type")
765
-	start_time := this.GetString("start_time")
766
-	admin_user_id, _ := this.GetInt64("admin_user_id")
767
-
768
-	end_time := this.GetString("end_time")
769
-	timeLayout := "2006-01-02"
770
-	loc, _ := time.LoadLocation("Local")
771
-
772
-	var theStartTIme int64
773
-	if len(start_time) > 0 {
774
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
775
-		if err != nil {
776
-			utils.ErrorLog(err.Error())
777
-		}
778
-		theStartTIme = theTime.Unix()
779
-	}
780
-	var theEndtTIme int64
781
-	if len(end_time) > 0 {
782
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
783
-		if err != nil {
784
-			utils.ErrorLog(err.Error())
785
-		}
786
-		theEndtTIme = theTime.Unix()
787
-	}
788
-
789
-	data, _ := statistics_service.GetDoctorWorkloadChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type, admin_user_id)
790
-	this.ServeSuccessJSON(map[string]interface{}{
791
-		"data": data,
792
-	})
793
-
794
-}
795
-func (this *PCIndexEvaluationApiController) GetDoctorWorkloadTableData() {
796
-	adminUserInfo := this.GetAdminUserInfo()
797
-	start_time := this.GetString("start_time")
798
-	end_time := this.GetString("end_time")
799
-	admin_user_id, _ := this.GetInt64("admin_user_id")
800
-	page, _ := this.GetInt64("page")
801
-	limit, _ := this.GetInt64("limit")
802
-
803
-	if page == 0 {
804
-		page = 1
805
-	}
806
-	if limit == 0 {
807
-		limit = 20
808
-	}
809
-	timeLayout := "2006-01-02"
810
-	loc, _ := time.LoadLocation("Local")
811
-
812
-	var theStartTIme int64
813
-	if len(start_time) > 0 {
814
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
815
-		if err != nil {
816
-			utils.ErrorLog(err.Error())
817
-		}
818
-		theStartTIme = theTime.Unix()
819
-	}
820
-	var theEndtTIme int64
821
-	if len(end_time) > 0 {
822
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
823
-		if err != nil {
824
-			utils.ErrorLog(err.Error())
825
-		}
826
-		theEndtTIme = theTime.Unix()
827
-	}
828
-	data, _ := statistics_service.GetDoctorWorkloadTableData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, admin_user_id)
829
-	this.ServeSuccessJSON(map[string]interface{}{
830
-		"data": data,
831
-	})
832
-}
833
-
834
-func (this *PCIndexEvaluationApiController) GetNurseWorkloadChartData() {
835
-	adminUserInfo := this.GetAdminUserInfo()
836
-	statistics_type, _ := this.GetInt("statistics_type")
837
-	start_time := this.GetString("start_time")
838
-	end_time := this.GetString("end_time")
839
-	admin_user_id, _ := this.GetInt64("admin_user_id")
840
-
841
-	timeLayout := "2006-01-02"
842
-	loc, _ := time.LoadLocation("Local")
843
-
844
-	var theStartTIme int64
845
-	if len(start_time) > 0 {
846
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
847
-		if err != nil {
848
-			utils.ErrorLog(err.Error())
849
-		}
850
-		theStartTIme = theTime.Unix()
851
-	}
852
-	var theEndtTIme int64
853
-	if len(end_time) > 0 {
854
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
855
-		if err != nil {
856
-			utils.ErrorLog(err.Error())
857
-		}
858
-		theEndtTIme = theTime.Unix()
859
-	}
860
-
861
-	data, _ := statistics_service.GetNurseWorkloadChartData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, statistics_type, admin_user_id)
862
-
863
-	this.ServeSuccessJSON(map[string]interface{}{
864
-		"data": data,
865
-	})
866
-
867
-}
868
-func (this *PCIndexEvaluationApiController) GetNurseWorkloadTableData() {
869
-	adminUserInfo := this.GetAdminUserInfo()
870
-	start_time := this.GetString("start_time")
871
-	end_time := this.GetString("end_time")
872
-	admin_user_id, _ := this.GetInt64("admin_user_id")
873
-	page, _ := this.GetInt64("page")
874
-	limit, _ := this.GetInt64("limit")
875
-
876
-	if page == 0 {
877
-		page = 1
878
-	}
879
-	if limit == 0 {
880
-		limit = 5
881
-	}
882
-	timeLayout := "2006-01-02"
883
-	loc, _ := time.LoadLocation("Local")
884
-
885
-	var theStartTIme int64
886
-	if len(start_time) > 0 {
887
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
888
-		if err != nil {
889
-			utils.ErrorLog(err.Error())
890
-		}
891
-		theStartTIme = theTime.Unix()
892
-	}
893
-	var theEndtTIme int64
894
-	if len(end_time) > 0 {
895
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
896
-		if err != nil {
897
-			utils.ErrorLog(err.Error())
898
-		}
899
-		theEndtTIme = theTime.Unix()
900
-	}
901
-	data, total, _ := statistics_service.GetNurseWorkloadTableData(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme, admin_user_id, page, limit)
902
-	dialysisCount, _ := statistics_service.GetOrderDialysisCount(adminUserInfo.CurrentOrgId, theStartTIme, theEndtTIme)
903
-	this.ServeSuccessJSON(map[string]interface{}{
904
-		"data":          data,
905
-		"total":         total,
906
-		"dialysisCount": dialysisCount,
907
-	})
908
-}
909
-
910
-func (this *PCIndexEvaluationApiController) GetDefaultPatient() {
911
-	adminUserInfo := this.GetAdminUserInfo()
912
-	patientInfo, _ := statistics_service.GetOrgFirstPatientInfo(adminUserInfo.CurrentOrgId)
913
-	if patientInfo == nil {
914
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeOrgNoPatient)
915
-		return
916
-	}
917
-
918
-	this.ServeSuccessJSON(map[string]interface{}{
919
-		"patient": patientInfo,
920
-	})
921
-
922
-}

+ 0 - 789
controllers/pharmacy_controller.go Просмотреть файл

@@ -1,789 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
-	"fmt"
9
-	"github.com/astaxie/beego"
10
-	"math"
11
-	"strconv"
12
-	"time"
13
-)
14
-
15
-type PharmacyController struct {
16
-	BaseAuthAPIController
17
-}
18
-
19
-func PharmacyApiRegistRouters() {
20
-	beego.Router("/api/pharmacy/ceshili", &PharmacyController{}, "get:Tlili")
21
-	beego.Router("/api/pharmacy/todaynumber", &PharmacyController{}, "get:TodayNumber")                     //查询今天的待发药,已发药人数(
22
-	beego.Router("/api/pharmacy/waitingdrug", &PharmacyController{}, "get:WaitingDrug")                     //获取当天待发药的所有患者(
23
-	beego.Router("/api/pharmacy/issueddrugs", &PharmacyController{}, "get:IssuedDrug")                      //获取当天已发药的所有患者(
24
-	beego.Router("/api/pharmacy/getpharmacycontent", &PharmacyController{}, "get:GetPharmacyContent")       //获取当天该患者的所有信息(
25
-	beego.Router("/api/pharmacy/dispensingmedicine", &PharmacyController{}, "get:DispensingMedicine")       //患者发药按钮点击(
26
-	beego.Router("/api/pharmacy/drugwithdrawal", &PharmacyController{}, "get:DrugWithdrawal")               //退药按钮点击
27
-	beego.Router("/api/pharmacy/dispensingdetails", &PharmacyController{}, "get:DispensingDetails")         //获取发药明细的患者列表(
28
-	beego.Router("/api/pharmacy/prescriptiondetails", &PharmacyController{}, "get:PrescriptionDetails")     //发药明细-详情(
29
-	beego.Router("/api/pharmacy/dispensemedicine", &PharmacyController{}, "get:DispenseMedicine")           //获取当天已发药的药品(
30
-	beego.Router("/api/pharmacy/waitingmedicine", &PharmacyController{}, "get:WaitingMedicine")             //获取当天待发药的药品(
31
-	beego.Router("/api/pharmacy/getpatientswithdrugs", &PharmacyController{}, "get:GetPatientsWithDrugs")   //获取当天该药品的所有患者(
32
-	beego.Router("/api/pharmacy/medicinedeparture", &PharmacyController{}, "get:MedicineDeparture")         //药品发药按钮点击(
33
-	beego.Router("/api/pharmacy/getcurrentname", &PharmacyController{}, "get:GetCurrentName")               //获取当前登录账号的名字(
34
-	beego.Router("/api/pharmacy/getpartitionlist", &PharmacyController{}, "get:GetPartitionList")           //获取当前机构的分区列表
35
-	beego.Router("/api/pharmacy/routeofadministration", &PharmacyController{}, "get:RouteOfAdministration") //获取当前机构的给药途径
36
-}
37
-
38
-// 测试
39
-func (this *PharmacyController) Tlili() {
40
-	var err error
41
-	defer func() {
42
-		if rec := recover(); rec != nil {
43
-			err = fmt.Errorf("程序异常:%v", rec)
44
-		}
45
-		if err != nil {
46
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
47
-		}
48
-	}()
49
-	var list2 []*models.ReplacementDrugs
50
-	list2, err = service.ReplacementDrugs(9675, false)
51
-	if err != nil {
52
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
53
-		return
54
-	}
55
-	this.ServeSuccessJSON(map[string]interface{}{
56
-		"list": list2,
57
-	})
58
-	return
59
-}
60
-func (this *PharmacyController) GetCurrentName() {
61
-	create := this.GetAdminUserInfo().AdminUser.Id
62
-	this.ServeSuccessJSON(map[string]interface{}{
63
-		"list": create,
64
-	})
65
-	return
66
-}
67
-
68
-// 查询今天的待发药,已发药人数
69
-func (this *PharmacyController) TodayNumber() {
70
-	var err error
71
-	defer func() {
72
-		if rec := recover(); rec != nil {
73
-			err = fmt.Errorf("程序异常:%v", rec)
74
-		}
75
-		if err != nil {
76
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
77
-		}
78
-	}()
79
-	orgid := this.GetAdminUserInfo().CurrentOrgId
80
-	times := this.GetString("time", "")
81
-	timeLayout := "2006-01-02"
82
-	loc, _ := time.LoadLocation("Local")
83
-
84
-	var stime, etime int64
85
-	if times == "" {
86
-		stime, etime = service.GetNowTime()
87
-	} else {
88
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
89
-		stime = stmp.Unix()
90
-		etime = stime + 86399
91
-	}
92
-
93
-	if orgid != 9671 && orgid != 10188 && orgid != 10217 && orgid != 3877 && orgid != 10164 {
94
-		//查询表里当天的数据
95
-		var wtotal int
96
-		wtotal, err = service.GetTodayPharmacy(stime, etime, orgid, 1)
97
-
98
-		if err != nil {
99
-			utils.ErrorLog(err.Error())
100
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
101
-			return
102
-		}
103
-
104
-		var itotal int
105
-		itotal, err = service.GetTodayPharmacy(stime, etime, orgid, 0)
106
-
107
-		if err != nil {
108
-			utils.ErrorLog(err.Error())
109
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
110
-			return
111
-		}
112
-		this.ServeSuccessJSON(map[string]interface{}{
113
-			"wtotal": wtotal,
114
-			"itotal": itotal,
115
-		})
116
-		return
117
-	}
118
-
119
-	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 {
120
-		var wtotal int
121
-		var itotal int
122
-		//查找出库数量
123
-		wtotal, _ = service.GetTodayAdviceCount(stime, etime, orgid, 1)
124
-
125
-		itotal, _ = service.GetTodayAdviceCount(stime, etime, orgid, 0)
126
-		this.ServeSuccessJSON(map[string]interface{}{
127
-			"wtotal": wtotal,
128
-			"itotal": itotal,
129
-		})
130
-		return
131
-	}
132
-
133
-}
134
-func (this *PharmacyController) IssuedDrug() {
135
-	var err error
136
-	defer func() {
137
-		if rec := recover(); rec != nil {
138
-			err = fmt.Errorf("程序异常:%v", rec)
139
-		}
140
-		if err != nil {
141
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
142
-		}
143
-	}()
144
-	keyword := this.GetString("keyword", "")
145
-	times := this.GetString("time", "")
146
-	orgid := this.GetAdminUserInfo().CurrentOrgId
147
-	shift, err := this.GetInt64("shift", 0) //班次
148
-	if err != nil {
149
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
150
-		return
151
-	}
152
-	partition, err := this.GetInt64("partition", 0) //分区
153
-	if err != nil {
154
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
155
-		return
156
-	}
157
-	timeLayout := "2006-01-02"
158
-	loc, _ := time.LoadLocation("Local")
159
-	var stime, etime int64
160
-	if times == "" {
161
-		stime, etime = service.GetNowTime()
162
-	} else {
163
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
164
-		stime = stmp.Unix()
165
-		etime = stime + 86399
166
-	}
167
-
168
-	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 || orgid == 10387 {
169
-
170
-		//获取排班班次
171
-		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
172
-
173
-		var ids []int64
174
-		for _, item := range schedule {
175
-			ids = append(ids, item.PatientId)
176
-		}
177
-
178
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
179
-
180
-		var flist []models.TmpPatientOne
181
-		if len(list) > 0 {
182
-			for _, item := range list {
183
-				patientlist, _ := service.GetPatientByAdviceId(item.PatientId)
184
-				flist = append(flist, patientlist)
185
-			}
186
-		}
187
-		this.ServeSuccessJSON(map[string]interface{}{
188
-			"list": flist,
189
-		})
190
-	}
191
-
192
-	if orgid != 10164 && orgid == 3877 && orgid != 10188 && orgid != 10217 && orgid != 9671 && orgid != 10387 {
193
-		//查询表里当天的数据
194
-		var flist []*models.TmpPatient
195
-		flist, err = service.GetTodayDrug(stime, etime, orgid, 1, keyword)
196
-		if err != nil {
197
-			utils.ErrorLog(err.Error())
198
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
199
-			return
200
-		}
201
-		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
202
-		if err != nil {
203
-			utils.ErrorLog(err.Error())
204
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
205
-			return
206
-		}
207
-		this.ServeSuccessJSON(map[string]interface{}{
208
-			"list": listt,
209
-		})
210
-		return
211
-	}
212
-
213
-}
214
-func (this *PharmacyController) WaitingDrug() {
215
-	var err error
216
-	defer func() {
217
-		if rec := recover(); rec != nil {
218
-			err = fmt.Errorf("程序异常:%v", rec)
219
-		}
220
-		if err != nil {
221
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
222
-		}
223
-	}()
224
-	keyword := this.GetString("keyword", "")
225
-	times := this.GetString("time", "")
226
-	shift, err := this.GetInt64("shift", 0) //班次
227
-	if err != nil {
228
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
229
-		return
230
-	}
231
-	partition, err := this.GetInt64("partition", 0) //分区
232
-	if err != nil {
233
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
234
-		return
235
-	}
236
-	orgid := this.GetAdminUserInfo().CurrentOrgId
237
-	timeLayout := "2006-01-02"
238
-	loc, _ := time.LoadLocation("Local")
239
-	var stime, etime int64
240
-	if times == "" {
241
-		stime, etime = service.GetNowTime()
242
-	} else {
243
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
244
-		stime = stmp.Unix()
245
-		etime = stime + 86399
246
-	}
247
-
248
-	if orgid != 9671 && orgid != 10188 && orgid != 10217 && orgid != 3877 && orgid != 10164 && orgid != 10387 {
249
-		//查询表里当天的数据
250
-		var flist []*models.TmpPatient
251
-		flist, err = service.GetTodayDrug(stime, etime, orgid, 0, keyword)
252
-
253
-		if err != nil {
254
-			utils.ErrorLog(err.Error())
255
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
256
-			return
257
-		}
258
-		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
259
-
260
-		if err != nil {
261
-			utils.ErrorLog(err.Error())
262
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
263
-			return
264
-		}
265
-		this.ServeSuccessJSON(map[string]interface{}{
266
-			"list": listt,
267
-		})
268
-		return
269
-	}
270
-
271
-	//当天已发药的人数
272
-	if orgid == 9671 || orgid == 10188 || orgid == 10217 || orgid == 3877 || orgid == 10164 || orgid == 10387 {
273
-
274
-		//获取排班班次
275
-		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
276
-		fmt.Println("schedule--------", schedule)
277
-		var ids []int64
278
-		for _, item := range schedule {
279
-			ids = append(ids, item.PatientId)
280
-		}
281
-
282
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 0, ids)
283
-
284
-		var flist []models.TmpPatientOne
285
-		if len(list) > 0 {
286
-			for _, item := range list {
287
-				patientlist, _ := service.GetPatientByAdviceId(item.PatientId)
288
-				flist = append(flist, patientlist)
289
-			}
290
-		}
291
-		this.ServeSuccessJSON(map[string]interface{}{
292
-			"list": flist,
293
-		})
294
-		return
295
-	}
296
-
297
-}
298
-
299
-func (this *PharmacyController) GetPharmacyContent() {
300
-	var err error
301
-	defer func() {
302
-		if rec := recover(); rec != nil {
303
-			err = fmt.Errorf("程序异常:%v", rec)
304
-		}
305
-		if err != nil {
306
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
307
-		}
308
-	}()
309
-	patient_id, _ := this.GetInt64("patient_id", 0)
310
-	is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
311
-	times := this.GetString("time", "")
312
-	orgid := this.GetAdminUserInfo().CurrentOrgId
313
-	timeLayout := "2006-01-02"
314
-	loc, _ := time.LoadLocation("Local")
315
-	var stime, etime int64
316
-	if times == "" {
317
-		stime, etime = service.GetNowTime()
318
-	} else {
319
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
320
-		stime = stmp.Unix()
321
-		etime = stime + 86399
322
-	}
323
-	var list []*models.PharmacyContent
324
-	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
325
-	if err != nil {
326
-		utils.ErrorLog(err.Error())
327
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
328
-		return
329
-	}
330
-	return_value := make(map[string]interface{})
331
-	return_value["list"] = list
332
-	//if is_medicine == 1{发药时间先不展示
333
-	//	return_value["time"] = time
334
-	//}
335
-	this.ServeSuccessJSON(return_value)
336
-	return
337
-
338
-}
339
-
340
-// 发药按钮点击
341
-func (this *PharmacyController) DispensingMedicine() {
342
-	var err error
343
-	defer func() {
344
-		if rec := recover(); rec != nil {
345
-			err = fmt.Errorf("程序异常:%v", rec)
346
-		}
347
-		if err != nil {
348
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
349
-		}
350
-	}()
351
-	patient_id, _ := this.GetInt64("patient_id", 0)
352
-	times := this.GetString("time", "")
353
-	orgid := this.GetAdminUserInfo().CurrentOrgId
354
-	creater := this.GetAdminUserInfo().AdminUser.Id
355
-	timeLayout := "2006-01-02"
356
-	loc, _ := time.LoadLocation("Local")
357
-	var stime, etime int64
358
-	if times == "" {
359
-		stime, etime = service.GetNowTime()
360
-	} else {
361
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
362
-		stime = stmp.Unix()
363
-		etime = stime + 86399
364
-	}
365
-
366
-	advicelist, _ := service.FindeHisAdviceDocAdvice(orgid, patient_id, stime, etime)
367
-	if len(advicelist) > 0 {
368
-		var total int64
369
-		var prescribing_number_total int64
370
-		for _, item := range advicelist {
371
-			//查询改药品信息
372
-			medical, _ := service.GetBaseDrugMedical(item.DrugId)
373
-			if medical.IsPharmacy == 1 {
374
-				houseConfig, _ := service.GetAllStoreHouseConfig(orgid)
375
-				//查询该药品是否有库存
376
-				list, _ := service.GetDrugTotalCountTwenty(item.DrugId, item.UserOrgId, houseConfig.DrugStorehouseOut)
377
-
378
-				//判断单位是否相等
379
-				if medical.MaxUnit == item.PrescribingNumberUnit {
380
-					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
381
-					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
382
-					//转化为最小单位
383
-					total = list.Count*medical.MinNumber + list.StockMinNumber
384
-					prescribing_number_total = count * medical.MinNumber
385
-				}
386
-				if medical.MinUnit == item.PrescribingNumberUnit {
387
-					prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
388
-					count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
389
-					total = list.Count*medical.MinNumber + list.StockMinNumber
390
-					prescribing_number_total = count
391
-				}
392
-
393
-				if medical.IsUse != 1 {
394
-					//如果出库数量大于库存数量
395
-					if prescribing_number_total > total {
396
-						err := fmt.Errorf(service.FindDrugsName(item.DrugId) + "库存不足")
397
-						if err != nil {
398
-							utils.ErrorLog(err.Error())
399
-							this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
400
-							return
401
-						}
402
-					}
403
-				}
404
-			}
405
-
406
-		}
407
-	}
408
-
409
-	err = service.DispensingMedicine(orgid, patient_id, stime, etime, creater)
410
-
411
-	if orgid == 10387 || orgid == 3877 {
412
-		advicelist, _ := service.FindeHisAdviceDocAdvice(orgid, patient_id, stime, etime)
413
-		if len(advicelist) > 0 {
414
-			for _, item := range advicelist {
415
-				//查询改药品信息
416
-				medical, _ := service.GetBaseDrugMedical(item.DrugId)
417
-				if medical.IsPharmacy == 1 {
418
-					flow, _ := service.GetFlow(item.DrugId, item.AdviceDate, orgid, item.PatientId)
419
-					if len(flow) > 0 {
420
-						service.UpdateAdviceFlow(item.ID)
421
-					}
422
-				}
423
-			}
424
-
425
-		}
426
-	}
427
-	if err != nil {
428
-		utils.ErrorLog(err.Error())
429
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
430
-		return
431
-	}
432
-
433
-	this.ServeSuccessJSON(map[string]interface{}{
434
-		"list": "操作成功",
435
-	})
436
-	return
437
-}
438
-
439
-// 退药按钮点击
440
-func (this *PharmacyController) DrugWithdrawal() {
441
-	fmt.Println("寄哪里2333333333333333333333333333333")
442
-	var err error
443
-	defer func() {
444
-		if rec := recover(); rec != nil {
445
-			err = fmt.Errorf("程序异常:%v", rec)
446
-		}
447
-		if err != nil {
448
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
449
-		}
450
-	}()
451
-	patient_id, _ := this.GetInt64("patient_id", 0)
452
-	times := this.GetString("time", "")
453
-	orgid := this.GetAdminUserInfo().CurrentOrgId
454
-	creater := this.GetAdminUserInfo().AdminUser.Id
455
-	timeLayout := "2006-01-02"
456
-	loc, _ := time.LoadLocation("Local")
457
-	var stime, etime int64
458
-	if times == "" {
459
-		stime, etime = service.GetNowTime()
460
-	} else {
461
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
462
-		stime = stmp.Unix()
463
-		etime = stime + 86399
464
-	}
465
-	err = service.DrugWithdrawal(orgid, patient_id, stime, etime, creater)
466
-	if err != nil {
467
-		utils.ErrorLog(err.Error())
468
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
469
-		return
470
-	}
471
-	this.ServeSuccessJSON(map[string]interface{}{
472
-		"list": "操作成功",
473
-	})
474
-	return
475
-
476
-}
477
-
478
-// 发药明细列表
479
-func (this *PharmacyController) DispensingDetails() {
480
-	var err error
481
-	defer func() {
482
-		if rec := recover(); rec != nil {
483
-			err = fmt.Errorf("程序异常:%v", rec)
484
-		}
485
-		if err != nil {
486
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
487
-		}
488
-	}()
489
-	keyword := this.GetString("keyword", "")       //患者名称
490
-	start_time := this.GetString("start_time", "") //开始时间
491
-	end_time := this.GetString("end_time", "")     //结束时间
492
-	page, _ := this.GetInt64("page", 1)            //页码
493
-	limit, _ := this.GetInt64("limit", 10)         //每一页查出来的条数
494
-	orgid := this.GetAdminUserInfo().CurrentOrgId
495
-	timeLayout := "2006-01-02"
496
-	loc, _ := time.LoadLocation("Local")
497
-	var stime, etime int64
498
-	if start_time == "" {
499
-		stime = 1
500
-	} else {
501
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
502
-		stime = stmp.Unix()
503
-	}
504
-	if end_time == "" {
505
-		_, etime = service.GetNowTime()
506
-	} else {
507
-		etmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
508
-		etime = etmp.Unix()
509
-	}
510
-	var dislist []*models.DispensingList
511
-	var total int64
512
-	dislist, total, err = service.DispensingDetailsList(stime, etime, orgid, page, limit, keyword)
513
-	if err != nil {
514
-		utils.ErrorLog(err.Error())
515
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
516
-		return
517
-	}
518
-
519
-	this.ServeSuccessJSON(map[string]interface{}{
520
-		"list":  dislist,
521
-		"total": total,
522
-	})
523
-	return
524
-}
525
-
526
-// 处方详情
527
-func (this *PharmacyController) PrescriptionDetails() {
528
-	var err error
529
-	defer func() {
530
-		if rec := recover(); rec != nil {
531
-			err = fmt.Errorf("程序异常:%v", rec)
532
-		}
533
-		if err != nil {
534
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
535
-		}
536
-	}()
537
-	//患者姓名
538
-	patient_id, _ := this.GetInt64("patient_id", 0)
539
-	//发药时间
540
-	record_date, _ := this.GetInt64("record_date", 0)
541
-	orgid := this.GetAdminUserInfo().CurrentOrgId
542
-	if record_date == 0 || patient_id == 0 {
543
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
544
-		return
545
-	}
546
-	var list []*models.PrescripDetails
547
-	list, err = service.PrescriptionDetails(patient_id, record_date, orgid)
548
-	if err != nil {
549
-		utils.ErrorLog(err.Error())
550
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
551
-		return
552
-	}
553
-	this.ServeSuccessJSON(map[string]interface{}{
554
-		"list": list,
555
-	})
556
-	return
557
-}
558
-
559
-// 已发药品的信息
560
-func (this *PharmacyController) DispenseMedicine() {
561
-	var err error
562
-	defer func() {
563
-		if rec := recover(); rec != nil {
564
-			err = fmt.Errorf("程序异常:%v", rec)
565
-		}
566
-		if err != nil {
567
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
568
-		}
569
-	}()
570
-	keyword := this.GetString("keyword", "")
571
-	times := this.GetString("time", "")
572
-	orgid := this.GetAdminUserInfo().CurrentOrgId
573
-	timeLayout := "2006-01-02"
574
-	loc, _ := time.LoadLocation("Local")
575
-	deliveryway := this.GetString("deliveryway", "")
576
-	var stime, etime int64
577
-	if times == "" {
578
-		stime, etime = service.GetNowTime()
579
-	} else {
580
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
581
-		stime = stmp.Unix()
582
-		etime = stime + 86399
583
-	}
584
-	//查询表里当天的数据
585
-	var flist []*models.ListOfDrugs
586
-	flist, err = service.GetTodayMedicine(stime, etime, orgid, 1, keyword)
587
-	if err != nil {
588
-		utils.ErrorLog(err.Error())
589
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
590
-		return
591
-	}
592
-	llist, err := service.Administration(deliveryway, orgid, flist)
593
-	if err != nil {
594
-		utils.ErrorLog(err.Error())
595
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
596
-		return
597
-	}
598
-	this.ServeSuccessJSON(map[string]interface{}{
599
-		"list": llist,
600
-	})
601
-	return
602
-}
603
-
604
-// 待发药的药品信息
605
-func (this *PharmacyController) WaitingMedicine() {
606
-	var err error
607
-	defer func() {
608
-		if rec := recover(); rec != nil {
609
-			err = fmt.Errorf("程序异常:%v", rec)
610
-		}
611
-		if err != nil {
612
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
613
-		}
614
-	}()
615
-	keyword := this.GetString("keyword", "")
616
-	times := this.GetString("time", "")
617
-	orgid := this.GetAdminUserInfo().CurrentOrgId
618
-	timeLayout := "2006-01-02"
619
-	loc, _ := time.LoadLocation("Local")
620
-	deliveryway := this.GetString("deliveryway", "")
621
-	var stime, etime int64
622
-	if times == "" {
623
-		stime, etime = service.GetNowTime()
624
-	} else {
625
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
626
-		stime = stmp.Unix()
627
-		etime = stime + 86399
628
-	}
629
-	//查询表里当天的数据
630
-	var flist []*models.ListOfDrugs
631
-	flist, err = service.GetTodayMedicine(stime, etime, orgid, 0, keyword)
632
-	if err != nil {
633
-		utils.ErrorLog(err.Error())
634
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
635
-		return
636
-	}
637
-	llist, err := service.Administration(deliveryway, orgid, flist)
638
-	if err != nil {
639
-		utils.ErrorLog(err.Error())
640
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
641
-		return
642
-	}
643
-	this.ServeSuccessJSON(map[string]interface{}{
644
-		"list": llist,
645
-	})
646
-	return
647
-}
648
-
649
-// 获取药品的所有患者信息
650
-func (this *PharmacyController) GetPatientsWithDrugs() {
651
-	var err error
652
-	defer func() {
653
-		if rec := recover(); rec != nil {
654
-			err = fmt.Errorf("程序异常:%v", rec)
655
-		}
656
-		if err != nil {
657
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
658
-		}
659
-	}()
660
-	drug_id, _ := this.GetInt64("drug_id", 0)
661
-	is_medicine, _ := this.GetInt64("is_medicine", 0) //0:待发药,1:已发药
662
-	times := this.GetString("time", "")
663
-	orgid := this.GetAdminUserInfo().CurrentOrgId
664
-	deliveryway := this.GetString("deliveryway", "")
665
-	if deliveryway == "" {
666
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
667
-		return
668
-	}
669
-	shift, err := this.GetInt64("shift", 0) //班次
670
-	if err != nil {
671
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
672
-		return
673
-	}
674
-	partition, err := this.GetInt64("partition", 0) //分区
675
-	if err != nil {
676
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
677
-		return
678
-	}
679
-	timeLayout := "2006-01-02"
680
-	loc, _ := time.LoadLocation("Local")
681
-	var stime, etime int64
682
-	if times == "" {
683
-		stime, etime = service.GetNowTime()
684
-	} else {
685
-		stmp, _ := time.ParseInLocation(timeLayout+" 15:04:05", times+" 00:00:00", loc)
686
-		stime = stmp.Unix()
687
-		etime = stime + 86399
688
-	}
689
-	var list []*models.PatientInformation
690
-	list, err = service.FindMedicationList(orgid, drug_id, stime, etime, is_medicine)
691
-	if err != nil {
692
-		utils.ErrorLog(err.Error())
693
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
694
-		return
695
-	}
696
-	listll, err := service.PartitionAndLayoutDrug(deliveryway, stime, etime, orgid, shift, partition, list)
697
-	if err != nil {
698
-		utils.ErrorLog(err.Error())
699
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
700
-		return
701
-	}
702
-	total, err := service.CalculateTheTotalAmount(listll, drug_id)
703
-
704
-	if err != nil {
705
-		utils.ErrorLog(err.Error())
706
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
707
-		return
708
-	}
709
-	this.ServeSuccessJSON(map[string]interface{}{
710
-		"list":  listll,
711
-		"total": total,
712
-	})
713
-	return
714
-}
715
-
716
-// 药品管理发药按钮点击
717
-func (this *PharmacyController) MedicineDeparture() {
718
-	var err error
719
-	defer func() {
720
-		if rec := recover(); rec != nil {
721
-			err = fmt.Errorf("程序异常:%v", rec)
722
-		}
723
-		if err != nil {
724
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
725
-		}
726
-	}()
727
-	creater, _ := this.GetInt64("creater", 0) //领药人
728
-	ids := this.GetString("ids", "")          //发药的数据
729
-	orgid := this.GetAdminUserInfo().CurrentOrgId
730
-	if ids == "" {
731
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数不足")
732
-		return
733
-	}
734
-	err = service.MedicineDeparture(ids, creater, orgid)
735
-	if err != nil {
736
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
737
-		return
738
-	}
739
-	this.ServeSuccessJSON(map[string]interface{}{
740
-		"list": "修改成功",
741
-	})
742
-	return
743
-}
744
-
745
-func (this *PharmacyController) GetPartitionList() {
746
-	var err error
747
-	defer func() {
748
-		if rec := recover(); rec != nil {
749
-			err = fmt.Errorf("程序异常:%v", rec)
750
-		}
751
-		if err != nil {
752
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
753
-		}
754
-	}()
755
-	orgid := this.GetAdminUserInfo().CurrentOrgId
756
-	tmp := []*models.DeviceZone{{ID: 0, Name: "全部分区"}}
757
-	list, err := service.GetAllValidDeviceZones02(orgid)
758
-	if err != nil {
759
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
760
-		return
761
-	}
762
-	this.ServeSuccessJSON(map[string]interface{}{
763
-		"list": append(tmp, list...),
764
-	})
765
-	return
766
-}
767
-
768
-func (this *PharmacyController) RouteOfAdministration() {
769
-	var err error
770
-	defer func() {
771
-		if rec := recover(); rec != nil {
772
-			err = fmt.Errorf("程序异常:%v", rec)
773
-		}
774
-		if err != nil {
775
-			service.SaveErrs(this.GetAdminUserInfo().CurrentOrgId, this.Ctx.Input, err)
776
-		}
777
-	}()
778
-	orgid := this.GetAdminUserInfo().CurrentOrgId
779
-	tmp := []*models.DrugwayDic{{ID: 0, Name: "全部"}}
780
-	list, _, err := service.GetDrugWayDics(orgid)
781
-	if err != nil {
782
-		this.ServeFailJsonSend(enums.ErrorCodeParamWrong, err.Error())
783
-		return
784
-	}
785
-	this.ServeSuccessJSON(map[string]interface{}{
786
-		"list": append(tmp, list...),
787
-	})
788
-	return
789
-}

+ 0 - 363
controllers/print_data_api_controller.go Просмотреть файл

@@ -1,363 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	service "XT_New/service/print_data_service/schedule_dialysis"
6
-	"XT_New/utils"
7
-	"fmt"
8
-	"strings"
9
-	"time"
10
-
11
-	"github.com/astaxie/beego"
12
-)
13
-
14
-func PrintDataAPIControllerRegistRouters() {
15
-	beego.Router("/api/print/schedule/dialysis", &PrintDataAPIController{}, "get:ScheduleDialysisRecordPrintData")
16
-	beego.Router("/api/print/stock", &PrintDataAPIController{}, "get:StockRecordPrintData")
17
-	beego.Router("/api/print/course", &PrintDataAPIController{}, "get:CourseRecordPrintData")
18
-	beego.Router("/api/print/getlastafterweight", &PrintDataAPIController{}, "get:GetLastAfterWeight")
19
-	beego.Router("/api/stock/getgooddetailprintlist", &PrintDataAPIController{}, "get:GetGoodDetailPrintList")
20
-
21
-}
22
-
23
-type PrintDataAPIController struct {
24
-	BaseAuthAPIController
25
-}
26
-
27
-// /api/print/schedule/dialysis [get]
28
-// @param ids:string 排班 id,以逗号隔开 ("1,2,3")
29
-func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
30
-	schIDStr := this.GetString("ids")
31
-
32
-	if len(schIDStr) == 0 {
33
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
34
-		return
35
-	}
36
-
37
-	idStrs := strings.Split(schIDStr, ",")
38
-	adminUserInfo := this.GetAdminUserInfo()
39
-
40
-	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 {
41
-		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
42
-		for _, item := range schedules {
43
-
44
-			//获取透析上机
45
-			order, _ := service.GetBatchDialysisOrder(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
46
-			item.DialysisOrder = order
47
-
48
-			//获取透析处方
49
-			prescription, _ := service.GetBatchPrescription(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
50
-			item.Prescription = prescription
51
-			//接诊评估
52
-			receiveTreatmentAsses, _ := service.GetBatchReceiveTreatmentAsses(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
53
-			item.ReceiveAssessment = receiveTreatmentAsses
54
-
55
-			//透前评估
56
-			assessmentBeforeDislysisVM, _ := service.GetBatchAssessmentBeforeDislysisVM(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
57
-			item.AssessmentBeforeDislysis = assessmentBeforeDislysisVM
58
-
59
-			//透后评估
60
-			assessmentAfterDislysisVM, _ := service.GetBatchAssessmentAfterDislysisVM(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
61
-			item.AssessmentAfterDislysis = assessmentAfterDislysisVM
62
-
63
-			//上次透后体重
64
-			lastAfterWeight, _ := service.GetBatchLastAfterWeight(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
65
-			item.LastAfterWeight = lastAfterWeight
66
-
67
-			//透析监测
68
-			monitor, _ := service.GetBatchMonitor(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
69
-			item.MonitoringRecords = monitor
70
-
71
-			//透析医嘱
72
-			advice, _ := service.GetBatchDoctorAdvice(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
73
-			item.Advices = advice
74
-
75
-			//获取His医嘱
76
-			doctorAdvice, _ := service.GetHisBatchDoctorAdvice(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
77
-			item.HisAdvices = doctorAdvice
78
-
79
-			//获取项目
80
-			project, _ := service.GetHisBatchProject(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
81
-			item.HisPrescriptionProject = project
82
-			//双人核对
83
-			dobuleCheck, _ := service.GetBatchDobuleCheck(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
84
-			item.DoubleCheck = dobuleCheck
85
-
86
-			//透析小结
87
-			summerVM, _ := service.GetBatchSummerVM(this.GetAdminUserInfo().CurrentOrgId, item.PatientID, item.ScheduleDate)
88
-			item.Summer = summerVM
89
-
90
-			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
91
-			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
92
-				item.Count = list.Count
93
-			}
94
-			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
95
-				if item.ScheduleDate <= 1640966400 {
96
-					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
97
-
98
-					item.Patient.TotalDialysis = listOne.Count
99
-					item.Count = listOne.Count
100
-				}
101
-
102
-				if item.ScheduleDate >= 1672502400 {
103
-					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
104
-
105
-					item.Patient.TotalDialysis = listOne.Count
106
-					item.Count = listOne.Count
107
-				}
108
-
109
-			}
110
-		}
111
-
112
-		if getScheduleErr != nil {
113
-			this.ErrorLog("获取打印透析记录失败:%v", getScheduleErr)
114
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
115
-			return
116
-		}
117
-
118
-		medicalStaffs, getMedicalStaffErr := service.GetMedicalStaffs(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
119
-
120
-		if getMedicalStaffErr != nil {
121
-			this.ErrorLog("获取医护人员失败:%v", getMedicalStaffErr)
122
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
123
-			return
124
-		}
125
-
126
-		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
127
-		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
128
-		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
129
-
130
-		this.ServeSuccessJSON(map[string]interface{}{
131
-			"schedules":      schedules,
132
-			"medical_staffs": medicalStaffs,
133
-			"users":          adminUser,
134
-			"templateInfo":   templateInfo,
135
-			"name":           name,
136
-		})
137
-	}
138
-
139
-	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 {
140
-		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
141
-		for _, item := range schedules {
142
-			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
143
-			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 && this.GetAdminUserInfo().CurrentOrgId != 10345 {
144
-				if this.GetAdminUserInfo().CurrentOrgId == 10445 {
145
-					listOrder, _ := service.GetDialysisOrderCountTen(item.PatientID, item.ScheduleDate)
146
-					item.Count = listOrder.DialysisTotal
147
-				}
148
-				if this.GetAdminUserInfo().CurrentOrgId != 10445 {
149
-					item.Count = list.Count
150
-				}
151
-
152
-			}
153
-			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 || this.GetAdminUserInfo().CurrentOrgId == 10345 {
154
-				//listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
155
-
156
-				//item.Patient.TotalDialysis = listOne.Count
157
-				//item.Count = listOne.Count
158
-
159
-				if item.ScheduleDate <= 1640966400 {
160
-					listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
161
-
162
-					item.Patient.TotalDialysis = listOne.Count
163
-					item.Count = listOne.Count
164
-				}
165
-
166
-				if item.ScheduleDate >= 1672502400 {
167
-					listOne, _ := service.GetDialysisOrderCountNight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
168
-
169
-					item.Patient.TotalDialysis = listOne.Count
170
-					item.Count = listOne.Count
171
-				}
172
-			}
173
-		}
174
-		if getScheduleErr != nil {
175
-			this.ErrorLog("获取打印透析记录失败:%v", getScheduleErr)
176
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
177
-			return
178
-		}
179
-
180
-		medicalStaffs, getMedicalStaffErr := service.GetMedicalStaffs(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
181
-		if getMedicalStaffErr != nil {
182
-			this.ErrorLog("获取医护人员失败:%v", getMedicalStaffErr)
183
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
184
-			return
185
-		}
186
-
187
-		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
188
-		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
189
-		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
190
-
191
-		this.ServeSuccessJSON(map[string]interface{}{
192
-			"schedules":      schedules,
193
-			"medical_staffs": medicalStaffs,
194
-			"users":          adminUser,
195
-			"templateInfo":   templateInfo,
196
-			"name":           name,
197
-		})
198
-	}
199
-
200
-}
201
-
202
-func (this *PrintDataAPIController) StockRecordPrintData() {
203
-	types, _ := this.GetInt("type", 0)
204
-	start_time := this.GetString("start_time")
205
-	end_time := this.GetString("end_time")
206
-	adminUserInfo := this.GetAdminUserInfo()
207
-
208
-	timeLayout := "2006-01-02"
209
-	loc, _ := time.LoadLocation("Local")
210
-	var startTime int64
211
-	if len(start_time) > 0 {
212
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
213
-		if err != nil {
214
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
215
-			return
216
-		}
217
-		startTime = theTime.Unix()
218
-	}
219
-	var endTime int64
220
-	if len(end_time) > 0 {
221
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
222
-		if err != nil {
223
-			utils.ErrorLog(err.Error())
224
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
225
-			return
226
-		}
227
-		endTime = theTime.Unix()
228
-	}
229
-
230
-	list, err := service.FindPrintStockGoodInfoByType(types, startTime, endTime, adminUserInfo.CurrentOrgId)
231
-	stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
232
-
233
-	info, err := service.GetCoutWareseOutInfo(startTime, endTime, adminUserInfo.CurrentOrgId)
234
-
235
-	infomationList, err := service.GetGoodInfomationList(adminUserInfo.CurrentOrgId)
236
-	if err != nil {
237
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
238
-	} else {
239
-		this.ServeSuccessJSON(map[string]interface{}{
240
-			"list":           list,
241
-			"type":           types,
242
-			"stockTotal":     stockTotal,
243
-			"info":           info,
244
-			"orgid":          adminUserInfo.CurrentOrgId,
245
-			"infomationList": infomationList,
246
-		})
247
-	}
248
-}
249
-
250
-func (this *PrintDataAPIController) CourseRecordPrintData() {
251
-	ids_str := this.GetString("ids")
252
-	ids_arr := strings.Split(ids_str, ",")
253
-	adminUserInfo := this.GetAdminUserInfo()
254
-	patient_id, _ := this.GetInt64("patient_id")
255
-
256
-	record, err := service.GetPatientCoursesRecords(adminUserInfo.CurrentOrgId, ids_arr)
257
-
258
-	//patient, _ := service.FindPatientWithDeviceById(adminUserInfo.CurrentOrgId, patient_id)
259
-	patient, _ := service.GetPatientDetail(adminUserInfo.CurrentOrgId, patient_id)
260
-
261
-	adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
262
-
263
-	operators, err := service.GetAdminUserEsTwo(adminUserInfo.CurrentOrgId)
264
-	if err != nil {
265
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
266
-		return
267
-	} else {
268
-		this.ServeSuccessJSON(map[string]interface{}{
269
-			"record":    record,
270
-			"patient":   patient,
271
-			"adminUser": adminUser,
272
-			"operators": operators,
273
-		})
274
-	}
275
-}
276
-
277
-func (this *PrintDataAPIController) GetLastAfterWeight() {
278
-	id, _ := this.GetInt64("id")
279
-	fmt.Print("id", id)
280
-	assmentdate, _ := this.GetInt64("assmentdate")
281
-
282
-	adminUserInfo := this.GetAdminUserInfo()
283
-	org_id := adminUserInfo.CurrentOrgId
284
-	weight, err := service.GetLastAfterWeight(org_id, id, assmentdate)
285
-	//fmt.Print("errr-------------",err)
286
-	if err != nil {
287
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
288
-		return
289
-	}
290
-	this.ServeSuccessJSON(map[string]interface{}{
291
-		"weight": weight,
292
-	})
293
-}
294
-
295
-func (this *PrintDataAPIController) GetGoodDetailPrintList() {
296
-
297
-	types, _ := this.GetInt("type", 0)
298
-	start_time := this.GetString("start_time")
299
-	end_time := this.GetString("end_time")
300
-	adminUserInfo := this.GetAdminUserInfo()
301
-
302
-	timeLayout := "2006-01-02"
303
-	loc, _ := time.LoadLocation("Local")
304
-	var startTime int64
305
-	if len(start_time) > 0 {
306
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
307
-		if err != nil {
308
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
309
-			return
310
-		}
311
-		startTime = theTime.Unix()
312
-	}
313
-	var endTime int64
314
-	if len(end_time) > 0 {
315
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
316
-		if err != nil {
317
-			utils.ErrorLog(err.Error())
318
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
319
-			return
320
-		}
321
-		endTime = theTime.Unix()
322
-	}
323
-	limit, _ := this.GetInt64("limit")
324
-	page, _ := this.GetInt64("page")
325
-
326
-	//入库详情
327
-	if types == 1 {
328
-		list, err := service.GetWarehouseInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
329
-		if err != nil {
330
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
331
-			return
332
-		}
333
-		this.ServeSuccessJSON(map[string]interface{}{
334
-			"list": list,
335
-		})
336
-	}
337
-
338
-	//出库详情
339
-	if types == 2 {
340
-		//list, err := service.GetWarehouseOutInfoGoodDetailPrintList(adminUserInfo.CurrentOrgId, startTime, endTime, limit, page)
341
-		list, _ := service.GetWarehouseOutInfoPrintList(adminUserInfo.CurrentOrgId, startTime, endTime)
342
-
343
-		stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, adminUserInfo.CurrentOrgId)
344
-		if err != nil {
345
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
346
-			return
347
-		}
348
-		this.ServeSuccessJSON(map[string]interface{}{
349
-			"list":       list,
350
-			"stockTotal": stockTotal,
351
-		})
352
-	}
353
-
354
-	//退库详情
355
-	if types == 4 {
356
-
357
-		list, _ := service.GetWarehouseCancelPrintList(adminUserInfo.CurrentOrgId, startTime, endTime)
358
-		this.ServeSuccessJSON(map[string]interface{}{
359
-			"list": list,
360
-		})
361
-	}
362
-
363
-}

Разница между файлами не показана из-за своего большого размера
+ 0 - 2414
controllers/public_api_controller.go


+ 0 - 864
controllers/qcd_api_controller.go Просмотреть файл

@@ -1,864 +0,0 @@
1
-package controllers
2
-
3
-import (
4
-	"XT_New/enums"
5
-	"XT_New/service"
6
-	"XT_New/utils"
7
-	"time"
8
-
9
-	"github.com/astaxie/beego"
10
-)
11
-
12
-type QcdApiController struct {
13
-	BaseAuthAPIController
14
-}
15
-
16
-func QcdApiRegistRouters() {
17
-	beego.Router("/api/qcd/dialysistotaldata", &QcdApiController{}, "get:GetDialysisTotalData")
18
-	beego.Router("/api/qcd/processindicatorsdata", &QcdApiController{}, "get:GetProcessIndicatorsData")
19
-	beego.Router("/api/qcd/oicdata", &QcdApiController{}, "get:GetOICData")
20
-	beego.Router("/api/qcd/oiqdata", &QcdApiController{}, "get:GetOIQData")
21
-	beego.Router("/api/qcd/patotaldata", &QcdApiController{}, "get:GetPATotalData")
22
-	beego.Router("/api/qcd/padialysisagedata", &QcdApiController{}, "get:GetPADialysisAgeData")
23
-	beego.Router("/api/qcd/paweightdata", &QcdApiController{}, "get:GetPAWeightData")
24
-	beego.Router("/api/qcd/pabloodpressuredata", &QcdApiController{}, "get:GetPABloodPressureData")
25
-	beego.Router("/api/qcd/pacomplicationdata", &QcdApiController{}, "get:GetPAComplicationData")
26
-	beego.Router("/api/qcd/painfectiousdiseasesdata", &QcdApiController{}, "get:GetPAInfectiousDiseasesData")
27
-	beego.Router("/api/qcd/papersonlapsetdata", &QcdApiController{}, "get:GetPersonLapsetoData")
28
-	beego.Router("/api/qcd/papersonweightdata", &QcdApiController{}, "get:GetPersonWeightData")
29
-	beego.Router("/api/qcd/papersonbloodpressuredata", &QcdApiController{}, "get:GetPersonBloodPressureData")
30
-	beego.Router("/api/qcd/papersonicdata", &QcdApiController{}, "get:GetPersonICData")
31
-	beego.Router("/api/qcd/papersonadvicedata", &QcdApiController{}, "get:GetPersonAdviceData")
32
-}
33
-
34
-func (c *QcdApiController) GetDialysisTotalData() {
35
-	page, _ := c.GetInt64("page", 1)
36
-	limit, _ := c.GetInt64("limit", 10)
37
-	lapseto, _ := c.GetInt64("lapseto", 0)
38
-	statisticalMethod, _ := c.GetInt64("statistical_method", 0)
39
-	modeID, _ := c.GetInt64("mode_id", 0)
40
-	startTime := c.GetString("start_time", "")
41
-	endTime := c.GetString("end_time", "")
42
-
43
-	if page <= 0 {
44
-		page = 1
45
-	}
46
-	if limit <= 0 {
47
-		limit = 10
48
-	}
49
-
50
-	adminUserInfo := c.GetAdminUserInfo()
51
-
52
-	timeLayout := "2006-01-02"
53
-	loc, _ := time.LoadLocation("Local")
54
-
55
-	var isStartTime bool
56
-	var theStartTIme int64
57
-	if len(startTime) > 0 {
58
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
59
-		if err != nil {
60
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
61
-			return
62
-		}
63
-		isStartTime = true
64
-		theStartTIme = theTime.Unix()
65
-	}
66
-	var isEndTime bool
67
-	var theEndtTIme int64
68
-	if len(endTime) > 0 {
69
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
70
-		if err != nil {
71
-			utils.ErrorLog(err.Error())
72
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
73
-			return
74
-		}
75
-		isEndTime = true
76
-		theEndtTIme = theTime.Unix()
77
-	}
78
-
79
-	data, ttd, total, _ := service.GetDialysisTotalData(adminUserInfo.CurrentOrgId, page, limit, lapseto, statisticalMethod, modeID, theStartTIme, theEndtTIme, isStartTime, isEndTime)
80
-
81
-	c.ServeSuccessJSON(map[string]interface{}{
82
-		"dtd":   data,
83
-		"ttd":   ttd,
84
-		"total": total,
85
-	})
86
-	return
87
-}
88
-
89
-func (c *QcdApiController) GetProcessIndicatorsData() {
90
-	page, _ := c.GetInt64("page", 1)
91
-	limit, _ := c.GetInt64("limit", 10)
92
-	lapseto, _ := c.GetInt64("lapseto", 0)
93
-	dialysisAge, _ := c.GetInt64("dialysis_age", 0)
94
-	projectID, _ := c.GetInt64("project_id", 0)
95
-	startTime := c.GetString("start_time", "")
96
-	endTime := c.GetString("end_time", "")
97
-
98
-	if page <= 0 {
99
-		page = 1
100
-	}
101
-	if limit <= 0 {
102
-		limit = 10
103
-	}
104
-
105
-	adminUserInfo := c.GetAdminUserInfo()
106
-
107
-	timeLayout := "2006-01-02"
108
-	loc, _ := time.LoadLocation("Local")
109
-
110
-	var isStartTime bool
111
-	var theStartTIme int64
112
-	if len(startTime) > 0 {
113
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
114
-		if err != nil {
115
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
116
-			return
117
-		}
118
-		isStartTime = true
119
-		theStartTIme = theTime.Unix()
120
-	}
121
-	var isEndTime bool
122
-	var theEndtTIme int64
123
-	if len(endTime) > 0 {
124
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
125
-		if err != nil {
126
-			utils.ErrorLog(err.Error())
127
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
128
-			return
129
-		}
130
-		isEndTime = true
131
-		theEndtTIme = theTime.Unix()
132
-	}
133
-
134
-	inspections, references, patients, counts, total, err := service.GetProcessIndicatorsData(adminUserInfo.CurrentOrgId, page, limit, lapseto, dialysisAge, projectID, theStartTIme, theEndtTIme, isStartTime, isEndTime)
135
-	if err != nil {
136
-		utils.ErrorLog(err.Error())
137
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
138
-		return
139
-	}
140
-	c.ServeSuccessJSON(map[string]interface{}{
141
-		"inspections":     inspections,
142
-		"references":      references,
143
-		"patients":        patients,
144
-		"unfinishedcount": counts[0].Count,
145
-		"total":           total,
146
-	})
147
-	return
148
-}
149
-
150
-func (c *QcdApiController) GetOICData() {
151
-	page, _ := c.GetInt64("page", 1)
152
-	limit, _ := c.GetInt64("limit", 10)
153
-	lapseto, _ := c.GetInt64("lapseto", 0)
154
-	dialysisAge, _ := c.GetInt64("dialysis_age", 0)
155
-	projectID, _ := c.GetInt64("project_id", 0)
156
-	itemID, _ := c.GetInt64("item_id", 0)
157
-	startTime := c.GetString("start_time", "")
158
-	endTime := c.GetString("end_time", "")
159
-
160
-	if page <= 0 {
161
-		page = 1
162
-	}
163
-	if limit <= 0 {
164
-		limit = 10
165
-	}
166
-
167
-	adminUserInfo := c.GetAdminUserInfo()
168
-
169
-	timeLayout := "2006-01-02"
170
-	loc, _ := time.LoadLocation("Local")
171
-
172
-	var isStartTime bool
173
-	var theStartTIme int64
174
-	if len(startTime) > 0 {
175
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
176
-		if err != nil {
177
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
178
-			return
179
-		}
180
-		isStartTime = true
181
-		theStartTIme = theTime.Unix()
182
-	}
183
-	var isEndTime bool
184
-	var theEndtTIme int64
185
-	if len(endTime) > 0 {
186
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
187
-		if err != nil {
188
-			utils.ErrorLog(err.Error())
189
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
190
-			return
191
-		}
192
-		isEndTime = true
193
-		theEndtTIme = theTime.Unix()
194
-	}
195
-
196
-	inspections, references, patients, counts, total, err := service.GetOICData(adminUserInfo.CurrentOrgId, page, limit, lapseto, dialysisAge, projectID, itemID, theStartTIme, theEndtTIme, isStartTime, isEndTime)
197
-	if err != nil {
198
-		utils.ErrorLog(err.Error())
199
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
200
-		return
201
-	}
202
-	c.ServeSuccessJSON(map[string]interface{}{
203
-		"inspections":     inspections,
204
-		"references":      references,
205
-		"patients":        patients,
206
-		"unfinishedcount": counts[0].Count,
207
-		"total":           total,
208
-	})
209
-	return
210
-}
211
-
212
-func (c *QcdApiController) GetOIQData() {
213
-	page, _ := c.GetInt64("page", 1)
214
-	limit, _ := c.GetInt64("limit", 10)
215
-	projectID, _ := c.GetInt64("project_id", 0)
216
-	startTime := c.GetString("start_time", "")
217
-	endTime := c.GetString("end_time", "")
218
-	searchKey := c.GetString("search", "")
219
-
220
-	if page <= 0 {
221
-		page = 1
222
-	}
223
-	if limit <= 0 {
224
-		limit = 10
225
-	}
226
-
227
-	adminUserInfo := c.GetAdminUserInfo()
228
-
229
-	timeLayout := "2006-01-02"
230
-	loc, _ := time.LoadLocation("Local")
231
-
232
-	var isStartTime bool
233
-	var theStartTIme int64
234
-	if len(startTime) > 0 {
235
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
236
-		if err != nil {
237
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
238
-			return
239
-		}
240
-		isStartTime = true
241
-		theStartTIme = theTime.Unix()
242
-	}
243
-	var isEndTime bool
244
-	var theEndtTIme int64
245
-	if len(endTime) > 0 {
246
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
247
-		if err != nil {
248
-			utils.ErrorLog(err.Error())
249
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
250
-			return
251
-		}
252
-		isEndTime = true
253
-		theEndtTIme = theTime.Unix()
254
-	}
255
-
256
-	inspections, references, patients, total, err := service.GetOIQData(adminUserInfo.CurrentOrgId, page, limit, projectID, theStartTIme, theEndtTIme, isStartTime, isEndTime, searchKey)
257
-	if err != nil {
258
-		utils.ErrorLog(err.Error())
259
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
260
-		return
261
-	}
262
-	c.ServeSuccessJSON(map[string]interface{}{
263
-		"inspections": inspections,
264
-		"references":  references,
265
-		"patients":    patients,
266
-		"total":       total,
267
-	})
268
-	return
269
-}
270
-
271
-func (c *QcdApiController) GetPATotalData() {
272
-	page, _ := c.GetInt64("page", 1)
273
-	limit, _ := c.GetInt64("limit", 10)
274
-	startTime := c.GetString("start_time", "")
275
-	endTime := c.GetString("end_time", "")
276
-	searchKey := c.GetString("search", "")
277
-	age, _ := c.GetInt64("age", 0)
278
-	lapseto, _ := c.GetInt64("lapseto", 0)
279
-	source, _ := c.GetInt64("source", 0)
280
-
281
-	if page <= 0 {
282
-		page = 1
283
-	}
284
-	if limit <= 0 {
285
-		limit = 10
286
-	}
287
-
288
-	adminUserInfo := c.GetAdminUserInfo()
289
-
290
-	timeLayout := "2006-01-02"
291
-	loc, _ := time.LoadLocation("Local")
292
-
293
-	var isStartTime bool
294
-	var theStartTIme int64
295
-	if len(startTime) > 0 {
296
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
297
-		if err != nil {
298
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
299
-			return
300
-		}
301
-		isStartTime = true
302
-		theStartTIme = theTime.Unix()
303
-	}
304
-	var isEndTime bool
305
-	var theEndtTIme int64
306
-	if len(endTime) > 0 {
307
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
308
-		if err != nil {
309
-			utils.ErrorLog(err.Error())
310
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
311
-			return
312
-		}
313
-		isEndTime = true
314
-		theEndtTIme = theTime.Unix()
315
-	}
316
-
317
-	patients, lapsetoOut, lapsetoIn, total, err := service.GetPATotalData(adminUserInfo.CurrentOrgId, page, limit, lapseto, source, age, theStartTIme, theEndtTIme, isStartTime, isEndTime, searchKey)
318
-	if err != nil {
319
-		utils.ErrorLog(err.Error())
320
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
321
-		return
322
-	}
323
-	c.ServeSuccessJSON(map[string]interface{}{
324
-		"patients":   patients,
325
-		"total":      total,
326
-		"lapsetoOut": lapsetoOut,
327
-		"lapsetoIn":  lapsetoIn,
328
-	})
329
-	return
330
-}
331
-
332
-func (c *QcdApiController) GetPADialysisAgeData() {
333
-	page, _ := c.GetInt64("page", 1)
334
-	limit, _ := c.GetInt64("limit", 10)
335
-	startTime := c.GetString("start_time", "")
336
-	endTime := c.GetString("end_time", "")
337
-	age, _ := c.GetInt64("age", 0)
338
-	dialysisAge, _ := c.GetInt64("dialysis_age", 0)
339
-	lapseto, _ := c.GetInt64("lapseto", 0)
340
-
341
-	if page <= 0 {
342
-		page = 1
343
-	}
344
-	if limit <= 0 {
345
-		limit = 10
346
-	}
347
-
348
-	adminUserInfo := c.GetAdminUserInfo()
349
-
350
-	timeLayout := "2006-01-02"
351
-	loc, _ := time.LoadLocation("Local")
352
-
353
-	var isStartTime bool
354
-	var theStartTIme int64
355
-	if len(startTime) > 0 {
356
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
357
-		if err != nil {
358
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
359
-			return
360
-		}
361
-		isStartTime = true
362
-		theStartTIme = theTime.Unix()
363
-	}
364
-	var isEndTime bool
365
-	var theEndtTIme int64
366
-	if len(endTime) > 0 {
367
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
368
-		if err != nil {
369
-			utils.ErrorLog(err.Error())
370
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
371
-			return
372
-		}
373
-		isEndTime = true
374
-		theEndtTIme = theTime.Unix()
375
-	}
376
-
377
-	patients, counts, total, err := service.GetPADialysisAgeData(adminUserInfo.CurrentOrgId, page, limit, lapseto, age, dialysisAge, theStartTIme, theEndtTIme, isStartTime, isEndTime)
378
-	if err != nil {
379
-		utils.ErrorLog(err.Error())
380
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
381
-		return
382
-	}
383
-	c.ServeSuccessJSON(map[string]interface{}{
384
-		"patients": patients,
385
-		"counts":   counts,
386
-		"total":    total,
387
-	})
388
-	return
389
-}
390
-
391
-func (c *QcdApiController) GetPAWeightData() {
392
-	page, _ := c.GetInt64("page", 1)
393
-	limit, _ := c.GetInt64("limit", 10)
394
-	startTime := c.GetString("start_time", "")
395
-	endTime := c.GetString("end_time", "")
396
-	age, _ := c.GetInt64("age", 0)
397
-	lapseto, _ := c.GetInt64("lapseto", 0)
398
-
399
-	if page <= 0 {
400
-		page = 1
401
-	}
402
-	if limit <= 0 {
403
-		limit = 10
404
-	}
405
-
406
-	adminUserInfo := c.GetAdminUserInfo()
407
-
408
-	timeLayout := "2006-01-02"
409
-	loc, _ := time.LoadLocation("Local")
410
-
411
-	var isStartTime bool
412
-	var theStartTIme int64
413
-	if len(startTime) > 0 {
414
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
415
-		if err != nil {
416
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
417
-			return
418
-		}
419
-		isStartTime = true
420
-		theStartTIme = theTime.Unix()
421
-	}
422
-	var isEndTime bool
423
-	var theEndtTIme int64
424
-	if len(endTime) > 0 {
425
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
426
-		if err != nil {
427
-			utils.ErrorLog(err.Error())
428
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
429
-			return
430
-		}
431
-		isEndTime = true
432
-		theEndtTIme = theTime.Unix()
433
-	}
434
-
435
-	weights, dryweight, weightincrease, afterweight, total, err := service.GetPAWeightData(adminUserInfo.CurrentOrgId, page, limit, lapseto, age, theStartTIme, theEndtTIme, isStartTime, isEndTime)
436
-	if err != nil {
437
-		utils.ErrorLog(err.Error())
438
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
439
-		return
440
-	}
441
-	c.ServeSuccessJSON(map[string]interface{}{
442
-		"weights":        weights,
443
-		"dryweight":      dryweight,
444
-		"weightincrease": weightincrease,
445
-		"afterweight":    afterweight,
446
-		"total":          total,
447
-	})
448
-	return
449
-}
450
-
451
-func (c *QcdApiController) GetPABloodPressureData() {
452
-	page, _ := c.GetInt64("page", 1)
453
-	limit, _ := c.GetInt64("limit", 10)
454
-	startTime := c.GetString("start_time", "")
455
-	endTime := c.GetString("end_time", "")
456
-	lapseto, _ := c.GetInt64("lapseto", 0)
457
-	dialysisStage, _ := c.GetInt64("dialysis_stage", 0)
458
-
459
-	if page <= 0 {
460
-		page = 1
461
-	}
462
-	if limit <= 0 {
463
-		limit = 10
464
-	}
465
-
466
-	adminUserInfo := c.GetAdminUserInfo()
467
-
468
-	timeLayout := "2006-01-02"
469
-	loc, _ := time.LoadLocation("Local")
470
-
471
-	var isStartTime bool
472
-	var theStartTIme int64
473
-	if len(startTime) > 0 {
474
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
475
-		if err != nil {
476
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
477
-			return
478
-		}
479
-		isStartTime = true
480
-		theStartTIme = theTime.Unix()
481
-	}
482
-	var isEndTime bool
483
-	var theEndtTIme int64
484
-	if len(endTime) > 0 {
485
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
486
-		if err != nil {
487
-			utils.ErrorLog(err.Error())
488
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
489
-			return
490
-		}
491
-		isEndTime = true
492
-		theEndtTIme = theTime.Unix()
493
-	}
494
-
495
-	bloodPressures, bps, total, err := service.GetPABloodPressureData(adminUserInfo.CurrentOrgId, page, limit, lapseto, dialysisStage, theStartTIme, theEndtTIme, isStartTime, isEndTime)
496
-	if err != nil {
497
-		utils.ErrorLog(err.Error())
498
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
499
-		return
500
-	}
501
-	c.ServeSuccessJSON(map[string]interface{}{
502
-		"blood_pressures": bloodPressures,
503
-		"bps":             bps,
504
-		"total":           total,
505
-	})
506
-	return
507
-}
508
-
509
-func (c *QcdApiController) GetPAComplicationData() {
510
-	page, _ := c.GetInt64("page", 1)
511
-	limit, _ := c.GetInt64("limit", 10)
512
-	startTime := c.GetString("start_time", "")
513
-	endTime := c.GetString("end_time", "")
514
-	age, _ := c.GetInt64("age", 0)
515
-	statisticalState, _ := c.GetInt64("statistical_state", 0)
516
-
517
-	if page <= 0 {
518
-		page = 1
519
-	}
520
-	if limit <= 0 {
521
-		limit = 10
522
-	}
523
-
524
-	adminUserInfo := c.GetAdminUserInfo()
525
-
526
-	timeLayout := "2006-01-02"
527
-	loc, _ := time.LoadLocation("Local")
528
-
529
-	var isStartTime bool
530
-	var theStartTIme int64
531
-	if len(startTime) > 0 {
532
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
533
-		if err != nil {
534
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
535
-			return
536
-		}
537
-		isStartTime = true
538
-		theStartTIme = theTime.Unix()
539
-	}
540
-	var isEndTime bool
541
-	var theEndtTIme int64
542
-	if len(endTime) > 0 {
543
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
544
-		if err != nil {
545
-			utils.ErrorLog(err.Error())
546
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
547
-			return
548
-		}
549
-		isEndTime = true
550
-		theEndtTIme = theTime.Unix()
551
-	}
552
-
553
-	complications, pcps, total, err := service.GetPAComplicationData(adminUserInfo.CurrentOrgId, page, limit, age, statisticalState, theStartTIme, theEndtTIme, isStartTime, isEndTime)
554
-	if err != nil {
555
-		utils.ErrorLog(err.Error())
556
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
557
-		return
558
-	}
559
-	c.ServeSuccessJSON(map[string]interface{}{
560
-		"complications": complications,
561
-		"pcps":          pcps,
562
-		"total":         total,
563
-	})
564
-	return
565
-}
566
-
567
-func (c *QcdApiController) GetPAInfectiousDiseasesData() {
568
-	page, _ := c.GetInt64("page", 1)
569
-	limit, _ := c.GetInt64("limit", 10)
570
-	startTime := c.GetString("start_time", "")
571
-	endTime := c.GetString("end_time", "")
572
-	age, _ := c.GetInt64("age", 0)
573
-	contagionType, _ := c.GetInt64("contagion_type", 0)
574
-	lapseto, _ := c.GetInt64("lapseto", 0)
575
-
576
-	if page <= 0 {
577
-		page = 1
578
-	}
579
-	if limit <= 0 {
580
-		limit = 10
581
-	}
582
-
583
-	adminUserInfo := c.GetAdminUserInfo()
584
-
585
-	timeLayout := "2006-01-02"
586
-	loc, _ := time.LoadLocation("Local")
587
-
588
-	var isStartTime bool
589
-	var theStartTIme int64
590
-	if len(startTime) > 0 {
591
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
592
-		if err != nil {
593
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
594
-			return
595
-		}
596
-		isStartTime = true
597
-		theStartTIme = theTime.Unix()
598
-	}
599
-	var isEndTime bool
600
-	var theEndtTIme int64
601
-	if len(endTime) > 0 {
602
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
603
-		if err != nil {
604
-			utils.ErrorLog(err.Error())
605
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
606
-			return
607
-		}
608
-		isEndTime = true
609
-		theEndtTIme = theTime.Unix()
610
-	}
611
-
612
-	patients, dsp, total, err := service.GetPAInfectiousDiseasesData(adminUserInfo.CurrentOrgId, page, limit, lapseto, age, contagionType, theStartTIme, theEndtTIme, isStartTime, isEndTime)
613
-	if err != nil {
614
-		utils.ErrorLog(err.Error())
615
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
616
-		return
617
-	}
618
-	c.ServeSuccessJSON(map[string]interface{}{
619
-		"patients": patients,
620
-		"dsp":      dsp,
621
-		"total":    total,
622
-	})
623
-	return
624
-}
625
-
626
-func (c *QcdApiController) GetPersonLapsetoData() {
627
-	page, _ := c.GetInt64("page", 1)
628
-	limit, _ := c.GetInt64("limit", 10)
629
-	patientId, _ := c.GetInt64("patient_id", 0)
630
-
631
-	if page <= 0 {
632
-		page = 1
633
-	}
634
-	if limit <= 0 {
635
-		limit = 10
636
-	}
637
-
638
-	adminUserInfo := c.GetAdminUserInfo()
639
-
640
-	patient, lapsetos, total, err := service.GetPersonLapsetoData(adminUserInfo.CurrentOrgId, patientId, page, limit)
641
-	if err != nil {
642
-		utils.ErrorLog(err.Error())
643
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
644
-		return
645
-	}
646
-	c.ServeSuccessJSON(map[string]interface{}{
647
-		"patient":  patient,
648
-		"lapsetos": lapsetos,
649
-		"total":    total,
650
-	})
651
-	return
652
-}
653
-
654
-func (c *QcdApiController) GetPersonWeightData() {
655
-	page, _ := c.GetInt64("page", 1)
656
-	limit, _ := c.GetInt64("limit", 10)
657
-	patientId, _ := c.GetInt64("patient_id", 0)
658
-	startTime := c.GetString("start_time", "")
659
-	endTime := c.GetString("end_time", "")
660
-
661
-	if page <= 0 {
662
-		page = 1
663
-	}
664
-	if limit <= 0 {
665
-		limit = 10
666
-	}
667
-	var isStartTime bool
668
-	var theStartTIme int64
669
-
670
-	timeLayout := "2006-01-02"
671
-	loc, _ := time.LoadLocation("Local")
672
-
673
-	if len(startTime) > 0 {
674
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
675
-		if err != nil {
676
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
677
-			return
678
-		}
679
-		isStartTime = true
680
-		theStartTIme = theTime.Unix()
681
-	}
682
-	var isEndTime bool
683
-	var theEndtTIme int64
684
-	if len(endTime) > 0 {
685
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
686
-		if err != nil {
687
-			utils.ErrorLog(err.Error())
688
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
689
-			return
690
-		}
691
-		isEndTime = true
692
-		theEndtTIme = theTime.Unix()
693
-	}
694
-
695
-	adminUserInfo := c.GetAdminUserInfo()
696
-
697
-	patient, weight, pie, total, err := service.GetPersonWeightData(adminUserInfo.CurrentOrgId, patientId, page, limit, theStartTIme, theEndtTIme, isStartTime, isEndTime)
698
-	if err != nil {
699
-		utils.ErrorLog(err.Error())
700
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
701
-		return
702
-	}
703
-	c.ServeSuccessJSON(map[string]interface{}{
704
-		"patient": patient,
705
-		"weight":  weight,
706
-		"pie":     pie,
707
-		"total":   total,
708
-	})
709
-	return
710
-}
711
-
712
-func (c *QcdApiController) GetPersonBloodPressureData() {
713
-	page, _ := c.GetInt64("page", 1)
714
-	limit, _ := c.GetInt64("limit", 10)
715
-	patientId, _ := c.GetInt64("patient_id", 0)
716
-	startTime := c.GetString("start_time", "")
717
-	endTime := c.GetString("end_time", "")
718
-
719
-	if page <= 0 {
720
-		page = 1
721
-	}
722
-	if limit <= 0 {
723
-		limit = 10
724
-	}
725
-	var isStartTime bool
726
-	var theStartTIme int64
727
-
728
-	timeLayout := "2006-01-02"
729
-	loc, _ := time.LoadLocation("Local")
730
-
731
-	if len(startTime) > 0 {
732
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
733
-		if err != nil {
734
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
735
-			return
736
-		}
737
-		isStartTime = true
738
-		theStartTIme = theTime.Unix()
739
-	}
740
-	var isEndTime bool
741
-	var theEndtTIme int64
742
-	if len(endTime) > 0 {
743
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
744
-		if err != nil {
745
-			utils.ErrorLog(err.Error())
746
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
747
-			return
748
-		}
749
-		isEndTime = true
750
-		theEndtTIme = theTime.Unix()
751
-	}
752
-
753
-	adminUserInfo := c.GetAdminUserInfo()
754
-
755
-	patient, bps, lines, total, err := service.GetPersonBloodPressureData(adminUserInfo.CurrentOrgId, patientId, page, limit, theStartTIme, theEndtTIme, isStartTime, isEndTime)
756
-	if err != nil {
757
-		utils.ErrorLog(err.Error())
758
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
759
-		return
760
-	}
761
-	c.ServeSuccessJSON(map[string]interface{}{
762
-		"patient": patient,
763
-		"bps":     bps,
764
-		"lines":   lines,
765
-		"total":   total,
766
-	})
767
-	return
768
-}
769
-
770
-func (c *QcdApiController) GetPersonICData() {
771
-	page, _ := c.GetInt64("page", 1)
772
-	limit, _ := c.GetInt64("limit", 10)
773
-	patientId, _ := c.GetInt64("patient_id", 0)
774
-
775
-	if page <= 0 {
776
-		page = 1
777
-	}
778
-	if limit <= 0 {
779
-		limit = 10
780
-	}
781
-	adminUserInfo := c.GetAdminUserInfo()
782
-
783
-	patient, inspections, references, total, err := service.GetPersonICData(adminUserInfo.CurrentOrgId, patientId, page, limit)
784
-	if err != nil {
785
-		utils.ErrorLog(err.Error())
786
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
787
-		return
788
-	}
789
-	c.ServeSuccessJSON(map[string]interface{}{
790
-		"patient":     patient,
791
-		"inspections": inspections,
792
-		"references":  references,
793
-		"total":       total,
794
-	})
795
-	return
796
-}
797
-
798
-func (c *QcdApiController) GetPersonAdviceData() {
799
-	page, _ := c.GetInt64("page", 1)
800
-	limit, _ := c.GetInt64("limit", 10)
801
-	patientId, _ := c.GetInt64("patient_id", 0)
802
-	adviceType, _ := c.GetInt64("advice_type", 0)
803
-	medicalType, _ := c.GetInt64("medical_type", 0)
804
-	startTime := c.GetString("start_time", "")
805
-	endTime := c.GetString("end_time", "")
806
-
807
-	if page <= 0 {
808
-		page = 1
809
-	}
810
-	if limit <= 0 {
811
-		limit = 10
812
-	}
813
-	var isStartTime bool
814
-	var theStartTIme int64
815
-
816
-	timeLayout := "2006-01-02"
817
-	loc, _ := time.LoadLocation("Local")
818
-
819
-	if len(startTime) > 0 {
820
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", startTime+" 00:00:00", loc)
821
-		if err != nil {
822
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
823
-			return
824
-		}
825
-		isStartTime = true
826
-		theStartTIme = theTime.Unix()
827
-	}
828
-	var isEndTime bool
829
-	var theEndtTIme int64
830
-	if len(endTime) > 0 {
831
-		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", endTime+" 23:59:59", loc)
832
-		if err != nil {
833
-			utils.ErrorLog(err.Error())
834
-			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
835
-			return
836
-		}
837
-		isEndTime = true
838
-		theEndtTIme = theTime.Unix()
839
-	}
840
-
841
-	adminUserInfo := c.GetAdminUserInfo()
842
-
843
-	patient, advices, total, err := service.GetPersonAdviceData(adminUserInfo.CurrentOrgId, patientId, page, limit, adviceType, medicalType, theStartTIme, theEndtTIme, isStartTime, isEndTime)
844
-	if err != nil {
845
-		utils.ErrorLog(err.Error())
846
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
847
-		return
848
-	}
849
-
850
-	users, err := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
851
-	if err != nil {
852
-		utils.ErrorLog(err.Error())
853
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
854
-		return
855
-	}
856
-
857
-	c.ServeSuccessJSON(map[string]interface{}{
858
-		"patient": patient,
859
-		"advices": advices,
860
-		"users":   users,
861
-		"total":   total,
862
-	})
863
-	return
864
-}

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


Некоторые файлы не были показаны из-за большого количества измененных файлов