|
@@ -0,0 +1,833 @@
|
|
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/jinzhu/gorm"
|
|
12
|
+ "strconv"
|
|
13
|
+ "strings"
|
|
14
|
+ "time"
|
|
15
|
+)
|
|
16
|
+
|
|
17
|
+type HisProjectApiController struct {
|
|
18
|
+ BaseAuthAPIController
|
|
19
|
+}
|
|
20
|
+
|
|
21
|
+func HisProjectRouters() {
|
|
22
|
+
|
|
23
|
+ beego.Router("/api/his/saveproject", &HisProjectApiController{}, "Get:SaveProject")
|
|
24
|
+ beego.Router("/api/his/getprojectlist", &HisProjectApiController{}, "Get:GetProjectList")
|
|
25
|
+ beego.Router("/api/his/getprojectdetail", &HisProjectApiController{}, "Get:GetProjectDetail")
|
|
26
|
+ beego.Router("/api/his/updatedproject", &HisProjectApiController{}, "Get:UpdatedProject")
|
|
27
|
+ beego.Router("/api/his/deletehisproject", &HisProjectApiController{}, "Get:DeleteHisProject")
|
|
28
|
+ beego.Router("/api/his/saveprojectteam", &HisProjectApiController{}, "Get:SaveProjectTeam")
|
|
29
|
+ beego.Router("/api/his/getprojectteamlist", &HisProjectApiController{}, "Get:GetProjectTeamList")
|
|
30
|
+ beego.Router("/api/his/getprojectteamdetail", &HisProjectApiController{}, "Get:GetProjectTeamDetail")
|
|
31
|
+ beego.Router("/api/his/updateprojectteam", &HisProjectApiController{}, "Get:UpdatedProjectTeam")
|
|
32
|
+ beego.Router("/api/his/deleteprojectteam", &HisProjectApiController{}, "Get:DeleteProjectTeam")
|
|
33
|
+ beego.Router("/api/his/savedepartment", &HisProjectApiController{}, "Get:SaveDePartment")
|
|
34
|
+ beego.Router("/api/his/getdepartmentlist", &HisProjectApiController{}, "Get:GetDepartMentList")
|
|
35
|
+ beego.Router("/api/his/getdepartmentdetail", &HisProjectApiController{}, "Get:GetDepartMentDetail")
|
|
36
|
+ beego.Router("/api/his/updagtedepartment", &HisProjectApiController{}, "Get:UpdatedDeparment")
|
|
37
|
+ beego.Router("/api/his/deletedeparment", &HisProjectApiController{}, "Get:DeleteDepartment")
|
|
38
|
+ beego.Router("/api/his/getallprojectlist", &HisProjectApiController{}, "Get:GetAllProjectList")
|
|
39
|
+ beego.Router("/api/his/addprojectlist", &HisProjectApiController{}, "Get:AddProjectList")
|
|
40
|
+ beego.Router("/api/his/deleteproject", &HisProjectApiController{}, "Get:DeleteProject")
|
|
41
|
+ beego.Router("/api/his/gethisproject", &HisProjectApiController{}, "Get:GetHisProject")
|
|
42
|
+ beego.Router("/api/his/getprojectteam", &HisProjectApiController{}, "Get:GetProjectTeam")
|
|
43
|
+ beego.Router("/api/his/getalldoctorlist", &HisProjectApiController{}, "Get:GetAllDoctorList")
|
|
44
|
+ beego.Router("/api/his/savehispatient", &HisProjectApiController{}, "Get:SaveHisPatient")
|
|
45
|
+ //获取今日血透排班的患者
|
|
46
|
+ beego.Router("/api/his/getbloodpatient", &HisProjectApiController{}, "Get:GetBloodPatientList")
|
|
47
|
+ //获取患者的今日透析处方
|
|
48
|
+ beego.Router("/api/his/gethisprescription", &HisProjectApiController{}, "Get:GetHisPrescription")
|
|
49
|
+ //新增附加费用
|
|
50
|
+ beego.Router("/api/his/additionalcharge", &HisProjectApiController{}, "Post:AdditionalCharge")
|
|
51
|
+ //获取治疗单
|
|
52
|
+ beego.Router("/api/his/gettreatlist", &HisProjectApiController{}, "Get:GetTreatmentList")
|
|
53
|
+ beego.Router("/api/his/getpatientinformation", &HisProjectApiController{}, "Get:GetPatientInformation")
|
|
54
|
+ beego.Router("/api/hist/getallprojecteam", &HisProjectApiController{}, "Get:GetAllProjectTeam")
|
|
55
|
+}
|
|
56
|
+
|
|
57
|
+func (this *HisProjectApiController) SaveProject() {
|
|
58
|
+
|
|
59
|
+ project_name := this.GetString("project_name")
|
|
60
|
+ pinyin := this.GetString("pinyin")
|
|
61
|
+ wubi := this.GetString("wubi")
|
|
62
|
+ price := this.GetString("price")
|
|
63
|
+ price_float, err := strconv.ParseFloat(price, 64)
|
|
64
|
+ unit := this.GetString("unit")
|
|
65
|
+ cost_classify, _ := this.GetInt64("cost_classify")
|
|
66
|
+ executive_section, _ := this.GetInt64("executive_section")
|
|
67
|
+ medical_coverage, _ := this.GetInt64("medical_coverage")
|
|
68
|
+ statistical_classification, _ := this.GetInt64("statistical_classification")
|
|
69
|
+ disease_directory, _ := this.GetInt64("disease_directory")
|
|
70
|
+ is_record, _ := this.GetInt64("is_record")
|
|
71
|
+ medical_code := this.GetString("medical_code")
|
|
72
|
+ tube_color, _ := this.GetInt64("tube_color")
|
|
73
|
+ medical_status, _ := this.GetInt64("medical_status")
|
|
74
|
+ remark := this.GetString("remark")
|
|
75
|
+ sign, _ := this.GetInt64("sign")
|
|
76
|
+ default_number := this.GetString("default_number")
|
|
77
|
+ is_charge, _ := this.GetInt64("is_charge")
|
|
78
|
+ is_estimate, _ := this.GetInt64("is_estimate")
|
|
79
|
+ is_workload, _ := this.GetInt64("is_workload")
|
|
80
|
+ sort := this.GetString("sort")
|
|
81
|
+ is_advice, _ := this.GetInt64("is_advice")
|
|
82
|
+ is_default, _ := this.GetInt64("is_default")
|
|
83
|
+ single_dose := this.GetString("single_dose")
|
|
84
|
+ delivery_way := this.GetString("delivery_way")
|
|
85
|
+ execution_frequency := this.GetString("execution_frequency")
|
|
86
|
+ number_days := this.GetString("number_days")
|
|
87
|
+ total := this.GetString("total")
|
|
88
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
89
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
90
|
+ hisProject := models.XtHisProject{
|
|
91
|
+ ProjectName: project_name,
|
|
92
|
+ Pinyin: pinyin,
|
|
93
|
+ Wubi: wubi,
|
|
94
|
+ Price: price_float,
|
|
95
|
+ Unit: unit,
|
|
96
|
+ CostClassify: cost_classify,
|
|
97
|
+ ExecutiveSection: executive_section,
|
|
98
|
+ MedicalCoverage: medical_coverage,
|
|
99
|
+ StatisticalClassification: statistical_classification,
|
|
100
|
+ DiseaseDirectory: disease_directory,
|
|
101
|
+ IsRecord: is_record,
|
|
102
|
+ MedicalCode: medical_code,
|
|
103
|
+ TubeColor: tube_color,
|
|
104
|
+ MedicalStatus: medical_status,
|
|
105
|
+ Remark: remark,
|
|
106
|
+ Sign: sign,
|
|
107
|
+ DefaultNumber: default_number,
|
|
108
|
+ IsCharge: is_charge,
|
|
109
|
+ IsEstimate: is_estimate,
|
|
110
|
+ IsWorkload: is_workload,
|
|
111
|
+ Sort: sort,
|
|
112
|
+ DoctorAdvice: is_advice,
|
|
113
|
+ IsDefault: is_default,
|
|
114
|
+ UserOrgId: orgId,
|
|
115
|
+ Status: 1,
|
|
116
|
+ CreatedTime: time.Now().Unix(),
|
|
117
|
+ SingleDose: single_dose,
|
|
118
|
+ DeliveryWay: delivery_way,
|
|
119
|
+ ExecutionFrequency: execution_frequency,
|
|
120
|
+ NumberDays: number_days,
|
|
121
|
+ Total: total,
|
|
122
|
+ }
|
|
123
|
+ //查询项目名称是否存在
|
|
124
|
+ _, errcode := service.GetHisProjectIsExist(project_name, orgId)
|
|
125
|
+ fmt.Println("9999999999999", errcode)
|
|
126
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
127
|
+ fmt.Println("222")
|
|
128
|
+ err = service.CreateHisProject(&hisProject)
|
|
129
|
+ if err != nil {
|
|
130
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
131
|
+ return
|
|
132
|
+ }
|
|
133
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
134
|
+ "hisProject": hisProject,
|
|
135
|
+ })
|
|
136
|
+ return
|
|
137
|
+ } else if errcode == nil {
|
|
138
|
+ fmt.Println("3333")
|
|
139
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
140
|
+ return
|
|
141
|
+ }
|
|
142
|
+}
|
|
143
|
+
|
|
144
|
+func (this *HisProjectApiController) GetProjectList() {
|
|
145
|
+
|
|
146
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
147
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
148
|
+ limit, _ := this.GetInt64("limit")
|
|
149
|
+ page, _ := this.GetInt64("page")
|
|
150
|
+ is_charge, _ := this.GetInt64("is_charge")
|
|
151
|
+ is_start, _ := this.GetInt64("is_start")
|
|
152
|
+ keyword := this.GetString("keyword")
|
|
153
|
+ projecList, total, err := service.GetHisProjectList(orgId, limit, page, is_charge, is_start, keyword)
|
|
154
|
+ fmt.Println("err", err)
|
|
155
|
+ if err != nil {
|
|
156
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
157
|
+ return
|
|
158
|
+ }
|
|
159
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
160
|
+ "projecList": projecList,
|
|
161
|
+ "total": total,
|
|
162
|
+ })
|
|
163
|
+ return
|
|
164
|
+}
|
|
165
|
+
|
|
166
|
+func (this *HisProjectApiController) GetProjectDetail() {
|
|
167
|
+ id, _ := this.GetInt64("id")
|
|
168
|
+ projectDetail, err := service.GetProjectDetail(id)
|
|
169
|
+ if err != nil {
|
|
170
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
171
|
+ return
|
|
172
|
+ }
|
|
173
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
174
|
+ "projecDetail": projectDetail,
|
|
175
|
+ })
|
|
176
|
+ return
|
|
177
|
+}
|
|
178
|
+
|
|
179
|
+func (this *HisProjectApiController) UpdatedProject() {
|
|
180
|
+
|
|
181
|
+ id, _ := this.GetInt64("id")
|
|
182
|
+ project_name := this.GetString("project_name")
|
|
183
|
+ pinyin := this.GetString("pinyin")
|
|
184
|
+ wubi := this.GetString("wubi")
|
|
185
|
+ price := this.GetString("price")
|
|
186
|
+ price_float, _ := strconv.ParseFloat(price, 64)
|
|
187
|
+ unit := this.GetString("unit")
|
|
188
|
+ cost_classify, _ := this.GetInt64("cost_classify")
|
|
189
|
+ executive_section, _ := this.GetInt64("executive_section")
|
|
190
|
+ medical_coverage, _ := this.GetInt64("medical_coverage")
|
|
191
|
+ statistical_classification, _ := this.GetInt64("statistical_classification")
|
|
192
|
+ disease_directory, _ := this.GetInt64("disease_directory")
|
|
193
|
+ is_record, _ := this.GetInt64("is_record")
|
|
194
|
+ medical_code := this.GetString("medical_code")
|
|
195
|
+ tube_color, _ := this.GetInt64("tube_color")
|
|
196
|
+ medical_status, _ := this.GetInt64("medical_status")
|
|
197
|
+ remark := this.GetString("remark")
|
|
198
|
+ sign, _ := this.GetInt64("sign")
|
|
199
|
+ default_number := this.GetString("default_number")
|
|
200
|
+ is_charge, _ := this.GetInt64("is_charge")
|
|
201
|
+ is_estimate, _ := this.GetInt64("is_estimate")
|
|
202
|
+ is_workload, _ := this.GetInt64("is_workload")
|
|
203
|
+ sort := this.GetString("sort")
|
|
204
|
+ is_advice, _ := this.GetInt64("is_advice")
|
|
205
|
+ is_default, _ := this.GetInt64("is_default")
|
|
206
|
+ single_dose := this.GetString("single_dose")
|
|
207
|
+ delivery_way := this.GetString("delivery_way")
|
|
208
|
+ execution_frequency := this.GetString("execution_frequency")
|
|
209
|
+ number_days := this.GetString("number_days")
|
|
210
|
+ total := this.GetString("total")
|
|
211
|
+ hisProject := models.XtHisProject{
|
|
212
|
+ ProjectName: project_name,
|
|
213
|
+ Pinyin: pinyin,
|
|
214
|
+ Wubi: wubi,
|
|
215
|
+ Price: price_float,
|
|
216
|
+ Unit: unit,
|
|
217
|
+ CostClassify: cost_classify,
|
|
218
|
+ ExecutiveSection: executive_section,
|
|
219
|
+ MedicalCoverage: medical_coverage,
|
|
220
|
+ StatisticalClassification: statistical_classification,
|
|
221
|
+ DiseaseDirectory: disease_directory,
|
|
222
|
+ IsRecord: is_record,
|
|
223
|
+ MedicalCode: medical_code,
|
|
224
|
+ TubeColor: tube_color,
|
|
225
|
+ MedicalStatus: medical_status,
|
|
226
|
+ Remark: remark,
|
|
227
|
+ Sign: sign,
|
|
228
|
+ DefaultNumber: default_number,
|
|
229
|
+ IsCharge: is_charge,
|
|
230
|
+ IsEstimate: is_estimate,
|
|
231
|
+ IsWorkload: is_workload,
|
|
232
|
+ Sort: sort,
|
|
233
|
+ DoctorAdvice: is_advice,
|
|
234
|
+ IsDefault: is_default,
|
|
235
|
+ UpdatedTime: time.Now().Unix(),
|
|
236
|
+ SingleDose: single_dose,
|
|
237
|
+ DeliveryWay: delivery_way,
|
|
238
|
+ ExecutionFrequency: execution_frequency,
|
|
239
|
+ NumberDays: number_days,
|
|
240
|
+ Total: total,
|
|
241
|
+ }
|
|
242
|
+
|
|
243
|
+ err := service.UpdatedProject(id, &hisProject)
|
|
244
|
+ if err != nil {
|
|
245
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
246
|
+ return
|
|
247
|
+ }
|
|
248
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
249
|
+ "hisProject": hisProject,
|
|
250
|
+ })
|
|
251
|
+ return
|
|
252
|
+}
|
|
253
|
+
|
|
254
|
+func (this *HisProjectApiController) DeleteHisProject() {
|
|
255
|
+
|
|
256
|
+ id, _ := this.GetInt64("id")
|
|
257
|
+ err := service.DeleteHisProject(id)
|
|
258
|
+ if err != nil {
|
|
259
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
260
|
+ return
|
|
261
|
+ }
|
|
262
|
+ returnData := make(map[string]interface{}, 0)
|
|
263
|
+ returnData["msg"] = "ok"
|
|
264
|
+ this.ServeSuccessJSON(returnData)
|
|
265
|
+ return
|
|
266
|
+}
|
|
267
|
+
|
|
268
|
+func (this *HisProjectApiController) SaveProjectTeam() {
|
|
269
|
+
|
|
270
|
+ project_team := this.GetString("project_team")
|
|
271
|
+
|
|
272
|
+ price := this.GetString("price")
|
|
273
|
+ price_float, _ := strconv.ParseFloat(price, 64)
|
|
274
|
+ pinyin := this.GetString("pinyin")
|
|
275
|
+ wubi := this.GetString("wubi")
|
|
276
|
+ tube_color, _ := this.GetInt64("tube_color")
|
|
277
|
+ team_type, _ := this.GetInt64("team_type")
|
|
278
|
+ remark := this.GetString("remark")
|
|
279
|
+ ids := this.GetString("ids")
|
|
280
|
+
|
|
281
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
282
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
283
|
+ projectTeam := models.XtHisProjectTeam{
|
|
284
|
+ ProjectTeam: project_team,
|
|
285
|
+ Price: price_float,
|
|
286
|
+ Pinyin: pinyin,
|
|
287
|
+ Wubi: wubi,
|
|
288
|
+ TubeColor: tube_color,
|
|
289
|
+ TeamType: team_type,
|
|
290
|
+ Remark: remark,
|
|
291
|
+ UserOrgId: orgId,
|
|
292
|
+ Status: 1,
|
|
293
|
+ CreatedTime: time.Now().Unix(),
|
|
294
|
+ ProjectId: ids,
|
|
295
|
+ }
|
|
296
|
+ fmt.Println(projectTeam)
|
|
297
|
+
|
|
298
|
+ _, errcodes := service.GetHisProjectByNameOne(project_team, orgId)
|
|
299
|
+
|
|
300
|
+ if errcodes == gorm.ErrRecordNotFound {
|
|
301
|
+
|
|
302
|
+ err := service.CreatedProjectTeam(&projectTeam)
|
|
303
|
+ if err != nil {
|
|
304
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
305
|
+ return
|
|
306
|
+ }
|
|
307
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
308
|
+ "projectTeam": projectTeam,
|
|
309
|
+ })
|
|
310
|
+ return
|
|
311
|
+ } else if errcodes == nil {
|
|
312
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
313
|
+ return
|
|
314
|
+ }
|
|
315
|
+}
|
|
316
|
+
|
|
317
|
+func (this *HisProjectApiController) GetProjectTeamList() {
|
|
318
|
+
|
|
319
|
+ limit, _ := this.GetInt64("limit")
|
|
320
|
+ page, _ := this.GetInt64("page")
|
|
321
|
+ keyword := this.GetString("keyword")
|
|
322
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
323
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
324
|
+ projectTeamList, total, err := service.GetProjectTeamList(limit, page, orgId, keyword)
|
|
325
|
+ if err != nil {
|
|
326
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
327
|
+ return
|
|
328
|
+ }
|
|
329
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
330
|
+ "projectTeamList": projectTeamList,
|
|
331
|
+ "total": total,
|
|
332
|
+ })
|
|
333
|
+ return
|
|
334
|
+}
|
|
335
|
+
|
|
336
|
+func (this *HisProjectApiController) GetProjectTeamDetail() {
|
|
337
|
+
|
|
338
|
+ id, _ := this.GetInt64("id")
|
|
339
|
+ projectTeamDetail, err := service.GetProjectTeamDetail(id)
|
|
340
|
+ if err != nil {
|
|
341
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
342
|
+ return
|
|
343
|
+ }
|
|
344
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
345
|
+ "projectTeamDetail": projectTeamDetail,
|
|
346
|
+ })
|
|
347
|
+ return
|
|
348
|
+}
|
|
349
|
+
|
|
350
|
+func (this *HisProjectApiController) UpdatedProjectTeam() {
|
|
351
|
+
|
|
352
|
+ id, _ := this.GetInt64("id")
|
|
353
|
+ project_team := this.GetString("project_team")
|
|
354
|
+ price := this.GetString("price")
|
|
355
|
+ price_float, _ := strconv.ParseFloat(price, 64)
|
|
356
|
+ pinyin := this.GetString("pinyin")
|
|
357
|
+ wubi := this.GetString("wubi")
|
|
358
|
+ tube_color, _ := this.GetInt64("tube_color")
|
|
359
|
+ team_type, _ := this.GetInt64("team_type")
|
|
360
|
+ remark := this.GetString("remark")
|
|
361
|
+ ids := this.GetString("ids")
|
|
362
|
+ projectTeam := models.XtHisProjectTeam{
|
|
363
|
+ ProjectTeam: project_team,
|
|
364
|
+ Price: price_float,
|
|
365
|
+ Pinyin: pinyin,
|
|
366
|
+ Wubi: wubi,
|
|
367
|
+ TubeColor: tube_color,
|
|
368
|
+ TeamType: team_type,
|
|
369
|
+ Remark: remark,
|
|
370
|
+ ProjectId: ids,
|
|
371
|
+ }
|
|
372
|
+
|
|
373
|
+ err := service.UpdatedProjectTeam(id, &projectTeam)
|
|
374
|
+ if err != nil {
|
|
375
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
376
|
+ return
|
|
377
|
+ }
|
|
378
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
379
|
+ "projectTeam": projectTeam,
|
|
380
|
+ })
|
|
381
|
+ return
|
|
382
|
+}
|
|
383
|
+
|
|
384
|
+func (this *HisProjectApiController) DeleteProjectTeam() {
|
|
385
|
+
|
|
386
|
+ id, _ := this.GetInt64("id")
|
|
387
|
+ err := service.DeleteProjectTeam(id)
|
|
388
|
+ if err != nil {
|
|
389
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
390
|
+ return
|
|
391
|
+ }
|
|
392
|
+ returnData := make(map[string]interface{}, 0)
|
|
393
|
+ returnData["msg"] = "ok"
|
|
394
|
+ this.ServeSuccessJSON(returnData)
|
|
395
|
+ return
|
|
396
|
+}
|
|
397
|
+
|
|
398
|
+func (this *HisProjectApiController) SaveDePartment() {
|
|
399
|
+
|
|
400
|
+ name := this.GetString("name")
|
|
401
|
+ number := this.GetString("number")
|
|
402
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
403
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
404
|
+ department := models.XtHisDepartment{
|
|
405
|
+ Name: name,
|
|
406
|
+ Number: number,
|
|
407
|
+ UserOrgId: orgId,
|
|
408
|
+ CreatedTime: time.Now().Unix(),
|
|
409
|
+ Status: 1,
|
|
410
|
+ }
|
|
411
|
+ err := service.CreateDePartment(&department)
|
|
412
|
+ if err != nil {
|
|
413
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
414
|
+ return
|
|
415
|
+ }
|
|
416
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
417
|
+ "department": department,
|
|
418
|
+ })
|
|
419
|
+ return
|
|
420
|
+}
|
|
421
|
+
|
|
422
|
+func (this *HisProjectApiController) GetDepartMentList() {
|
|
423
|
+
|
|
424
|
+ limit, _ := this.GetInt64("limit")
|
|
425
|
+ page, _ := this.GetInt64("page")
|
|
426
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
427
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
428
|
+ departMentList, total, err := service.GetDepartMentList(limit, page, orgId)
|
|
429
|
+ if err != nil {
|
|
430
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
431
|
+ return
|
|
432
|
+ }
|
|
433
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
434
|
+ "departMentList": departMentList,
|
|
435
|
+ "total": total,
|
|
436
|
+ })
|
|
437
|
+ return
|
|
438
|
+}
|
|
439
|
+
|
|
440
|
+func (this *HisProjectApiController) GetDepartMentDetail() {
|
|
441
|
+
|
|
442
|
+ id, _ := this.GetInt64("id")
|
|
443
|
+ departDetail, err := service.GetDepartMentDetail(id)
|
|
444
|
+ if err != nil {
|
|
445
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
446
|
+ return
|
|
447
|
+ }
|
|
448
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
449
|
+ "departDetail": departDetail,
|
|
450
|
+ })
|
|
451
|
+ return
|
|
452
|
+}
|
|
453
|
+
|
|
454
|
+func (this *HisProjectApiController) UpdatedDeparment() {
|
|
455
|
+
|
|
456
|
+ id, _ := this.GetInt64("id")
|
|
457
|
+ name := this.GetString("name")
|
|
458
|
+ number := this.GetString("number")
|
|
459
|
+ department := models.XtHisDepartment{
|
|
460
|
+ Name: name,
|
|
461
|
+ Number: number,
|
|
462
|
+ }
|
|
463
|
+ err := service.UpdatedDepartment(id, &department)
|
|
464
|
+ if err != nil {
|
|
465
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
466
|
+ return
|
|
467
|
+ }
|
|
468
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
469
|
+ "department": department,
|
|
470
|
+ })
|
|
471
|
+ return
|
|
472
|
+}
|
|
473
|
+
|
|
474
|
+func (this *HisProjectApiController) DeleteDepartment() {
|
|
475
|
+
|
|
476
|
+ id, _ := this.GetInt64("id")
|
|
477
|
+ err := service.DeleteDepartment(id)
|
|
478
|
+ if err != nil {
|
|
479
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
480
|
+ return
|
|
481
|
+ }
|
|
482
|
+ returnData := make(map[string]interface{}, 0)
|
|
483
|
+ returnData["msg"] = "ok"
|
|
484
|
+ this.ServeSuccessJSON(returnData)
|
|
485
|
+ return
|
|
486
|
+}
|
|
487
|
+
|
|
488
|
+func (this *HisProjectApiController) GetBloodPatientList() {
|
|
489
|
+
|
|
490
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
491
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
492
|
+ fmt.Println("org", orgId)
|
|
493
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
494
|
+ timeLayout := "2006-01-02 15:04:05"
|
|
495
|
+ fmt.Println("timeStr:", timeStr)
|
|
496
|
+ timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
|
|
497
|
+ timenow := timeStringToTime.Unix()
|
|
498
|
+
|
|
499
|
+ //统计血透排班的患者
|
|
500
|
+ scheduleList, err := service.GetBloodPatientList(orgId, timenow)
|
|
501
|
+ //统计当日挂号的患者
|
|
502
|
+ hisPatient, _ := service.GetHisPatient(orgId, timenow)
|
|
503
|
+ //统计今天开处方的患者
|
|
504
|
+ prescription, _ := service.HisPrescription(orgId, timenow)
|
|
505
|
+ if err != nil {
|
|
506
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
507
|
+ return
|
|
508
|
+ }
|
|
509
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
510
|
+ "scheduleList": scheduleList,
|
|
511
|
+ "hisPatient": hisPatient,
|
|
512
|
+ "prescription": prescription,
|
|
513
|
+ })
|
|
514
|
+ return
|
|
515
|
+}
|
|
516
|
+
|
|
517
|
+func (this *HisProjectApiController) GetHisPrescription() {
|
|
518
|
+
|
|
519
|
+ id, _ := this.GetInt64("id")
|
|
520
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
521
|
+ timeLayout := "2006-01-02 15:04:05"
|
|
522
|
+ fmt.Println("timeStr:", timeStr)
|
|
523
|
+ timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
|
|
524
|
+ timenow := timeStringToTime.Unix()
|
|
525
|
+ prescriptionList, err := service.GetHisPrescriptionByPatientId(id, timenow)
|
|
526
|
+ if err != nil {
|
|
527
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
528
|
+ return
|
|
529
|
+ }
|
|
530
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
531
|
+ "prescriptionList": prescriptionList,
|
|
532
|
+ })
|
|
533
|
+ return
|
|
534
|
+}
|
|
535
|
+
|
|
536
|
+func (this *HisProjectApiController) AdditionalCharge() {
|
|
537
|
+
|
|
538
|
+ dataBody := make(map[string]interface{}, 0)
|
|
539
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
|
|
540
|
+ fmt.Println(err)
|
|
541
|
+ patient_id := int64(dataBody["patient_id"].(float64))
|
|
542
|
+ fmt.Println("patient_id2222222222", patient_id)
|
|
543
|
+ medicineData, _ := dataBody["medicineData"].([]interface{})
|
|
544
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
545
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
546
|
+ admin_user_id := adminUserInfo.AdminUser.Id
|
|
547
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
548
|
+ timeLayout := "2006-01-02 15:04:05"
|
|
549
|
+ fmt.Println("timeStr:", timeStr)
|
|
550
|
+ timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
|
|
551
|
+ timenow := timeStringToTime.Unix()
|
|
552
|
+ for _, item := range medicineData {
|
|
553
|
+ items := item.(map[string]interface{})
|
|
554
|
+ drug_id := int64(items["id"].(float64))
|
|
555
|
+ money := int64(items["money"].(float64))
|
|
556
|
+ monStr := strconv.FormatInt(money, 10)
|
|
557
|
+ monneyStr, _ := strconv.ParseFloat(monStr, 64)
|
|
558
|
+ additionalCharge := models.HisAdditionalCharge{
|
|
559
|
+ DrugId: drug_id,
|
|
560
|
+ UserOrgId: orgId,
|
|
561
|
+ PatientId: patient_id,
|
|
562
|
+ RecordDate: timenow,
|
|
563
|
+ Money: monneyStr,
|
|
564
|
+ Status: 1,
|
|
565
|
+ AdminUserId: admin_user_id,
|
|
566
|
+ CreatedTime: time.Now().Unix(),
|
|
567
|
+ }
|
|
568
|
+
|
|
569
|
+ err := service.CreateAdditionalCharge(&additionalCharge)
|
|
570
|
+ if err != nil {
|
|
571
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
572
|
+ return
|
|
573
|
+ }
|
|
574
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
575
|
+ "additionalCharge": additionalCharge,
|
|
576
|
+ })
|
|
577
|
+ return
|
|
578
|
+ }
|
|
579
|
+}
|
|
580
|
+
|
|
581
|
+func (this *HisProjectApiController) GetTreatmentList() {
|
|
582
|
+
|
|
583
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
584
|
+ timeStr := time.Now().Format("2006-01-02")
|
|
585
|
+ timeLayout := "2006-01-02 15:04:05"
|
|
586
|
+ fmt.Println("timeStr:", timeStr)
|
|
587
|
+ timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
|
|
588
|
+ timenow := timeStringToTime.Unix()
|
|
589
|
+ treatmentList, err := service.GetTreatmentList(patient_id, timenow)
|
|
590
|
+ if err != nil {
|
|
591
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
592
|
+ return
|
|
593
|
+ }
|
|
594
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
595
|
+ "treatmentList": treatmentList,
|
|
596
|
+ })
|
|
597
|
+ return
|
|
598
|
+}
|
|
599
|
+
|
|
600
|
+func (this *HisProjectApiController) GetAllProjectList() {
|
|
601
|
+
|
|
602
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
603
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
604
|
+ projectList, err := service.GetAllProjectList(orgId)
|
|
605
|
+ //获取列表数据
|
|
606
|
+ hisprojectlist, err := service.GetHisProjectListByOrgId(orgId)
|
|
607
|
+
|
|
608
|
+ if err != nil {
|
|
609
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
610
|
+ return
|
|
611
|
+ }
|
|
612
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
613
|
+ "projectList": projectList,
|
|
614
|
+ "hisprojectlist": hisprojectlist,
|
|
615
|
+ })
|
|
616
|
+ return
|
|
617
|
+}
|
|
618
|
+
|
|
619
|
+func (this *HisProjectApiController) AddProjectList() {
|
|
620
|
+
|
|
621
|
+ id, _ := this.GetInt64("id")
|
|
622
|
+ number, _ := this.GetInt64("number")
|
|
623
|
+ fmt.Println(id, number)
|
|
624
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
625
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
626
|
+ projectList := models.XtHisProjectList{
|
|
627
|
+ ProjectId: id,
|
|
628
|
+ Number: number,
|
|
629
|
+ UserOrgId: orgId,
|
|
630
|
+ Status: 1,
|
|
631
|
+ CreatedTime: time.Now().Unix(),
|
|
632
|
+ }
|
|
633
|
+ err := service.CreateProjectList(&projectList)
|
|
634
|
+
|
|
635
|
+ if err != nil {
|
|
636
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
637
|
+ return
|
|
638
|
+ }
|
|
639
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
640
|
+ "projectList": projectList,
|
|
641
|
+ })
|
|
642
|
+ return
|
|
643
|
+}
|
|
644
|
+
|
|
645
|
+func (this *HisProjectApiController) GetPatientInformation() {
|
|
646
|
+
|
|
647
|
+ id, _ := this.GetInt64("id")
|
|
648
|
+ information, err := service.GetHisPatientInformation(id)
|
|
649
|
+ if err != nil {
|
|
650
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
651
|
+ return
|
|
652
|
+ }
|
|
653
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
654
|
+ "information": information,
|
|
655
|
+ })
|
|
656
|
+ return
|
|
657
|
+}
|
|
658
|
+
|
|
659
|
+func (this *HisProjectApiController) DeleteProject() {
|
|
660
|
+
|
|
661
|
+ id, _ := this.GetInt64("id")
|
|
662
|
+ err := service.DeleteProjectList(id)
|
|
663
|
+ if err != nil {
|
|
664
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")
|
|
665
|
+ return
|
|
666
|
+ }
|
|
667
|
+ returnData := make(map[string]interface{}, 0)
|
|
668
|
+ returnData["msg"] = "ok"
|
|
669
|
+ this.ServeSuccessJSON(returnData)
|
|
670
|
+ return
|
|
671
|
+}
|
|
672
|
+
|
|
673
|
+func (this *HisProjectApiController) GetHisProject() {
|
|
674
|
+
|
|
675
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
676
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
677
|
+ project, err := service.GetHisProject(orgId)
|
|
678
|
+ if err != nil {
|
|
679
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
680
|
+ return
|
|
681
|
+ }
|
|
682
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
683
|
+ "project": project,
|
|
684
|
+ })
|
|
685
|
+}
|
|
686
|
+
|
|
687
|
+func (this *HisProjectApiController) GetProjectTeam() {
|
|
688
|
+
|
|
689
|
+ strids := this.GetString("strids")
|
|
690
|
+
|
|
691
|
+ idStrs := strings.Split(strids, ",")
|
|
692
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
693
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
694
|
+ team, err := service.GetProjectTeam(idStrs, orgId)
|
|
695
|
+ if err != nil {
|
|
696
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
697
|
+ return
|
|
698
|
+ }
|
|
699
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
700
|
+ "team": team,
|
|
701
|
+ })
|
|
702
|
+}
|
|
703
|
+
|
|
704
|
+func (this *HisProjectApiController) GetAllDoctorList() {
|
|
705
|
+
|
|
706
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
707
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
708
|
+ appId := adminUserInfo.CurrentAppId
|
|
709
|
+ //获取所有的医生
|
|
710
|
+ doctor, err := service.GetAllDoctor(orgId, appId)
|
|
711
|
+ //获取所有的科室
|
|
712
|
+ department, err := service.GetAllDepartMent(orgId)
|
|
713
|
+ if err != nil {
|
|
714
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
715
|
+ return
|
|
716
|
+ }
|
|
717
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
718
|
+ "doctor": doctor,
|
|
719
|
+ "department": department,
|
|
720
|
+ })
|
|
721
|
+}
|
|
722
|
+
|
|
723
|
+func (this *HisProjectApiController) SaveHisPatient() {
|
|
724
|
+ timeLayout := "2006-01-02"
|
|
725
|
+ loc, _ := time.LoadLocation("Local")
|
|
726
|
+ age, _ := this.GetInt64("age")
|
|
727
|
+
|
|
728
|
+ birthday := this.GetString("birthDay")
|
|
729
|
+ birthdays, _ := time.ParseInLocation(timeLayout+" 15:04:05", birthday+" 00:00:00", loc)
|
|
730
|
+ birthUnix := birthdays.Unix()
|
|
731
|
+ certificates, _ := this.GetInt64("certificates")
|
|
732
|
+ cost_checked, _ := this.GetInt64("costChecked")
|
|
733
|
+ cost, _ := this.GetInt64("cost")
|
|
734
|
+ costs := strconv.FormatInt(cost, 10)
|
|
735
|
+ cost_float, _ := strconv.ParseFloat(costs, 64)
|
|
736
|
+ department, _ := this.GetInt64("department")
|
|
737
|
+ doctor, _ := this.GetInt64("doctor")
|
|
738
|
+ medicalcare, _ := this.GetInt64("medicalCare")
|
|
739
|
+ idcard := this.GetString("idCard")
|
|
740
|
+ medicalExpenses, _ := this.GetInt64("medicalExpenses")
|
|
741
|
+ medicalExpense := strconv.FormatInt(medicalExpenses, 10)
|
|
742
|
+ medicalExpense_float, _ := strconv.ParseFloat(medicalExpense, 64)
|
|
743
|
+ medicalinsurancecard := this.GetString("medicalInsuranceCard")
|
|
744
|
+
|
|
745
|
+ name := this.GetString("name")
|
|
746
|
+ register, _ := this.GetInt64("register")
|
|
747
|
+ registrationfee, _ := this.GetInt64("registrationFee")
|
|
748
|
+ registrationfees := strconv.FormatInt(registrationfee, 10)
|
|
749
|
+ registrationfees_float, _ := strconv.ParseFloat(registrationfees, 64)
|
|
750
|
+ settlementValue, _ := this.GetInt64("settlementValue")
|
|
751
|
+ sex, _ := this.GetInt64("sex")
|
|
752
|
+ total, _ := this.GetInt64("total")
|
|
753
|
+ totals := strconv.FormatInt(total, 10)
|
|
754
|
+ totals_float, _ := strconv.ParseFloat(totals, 64)
|
|
755
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
756
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
757
|
+
|
|
758
|
+ bloodPatient, errcode := service.GetBloodPatientByIdCard(idcard, orgId)
|
|
759
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
760
|
+ patient := models.XtHisPatient{
|
|
761
|
+ Age: age,
|
|
762
|
+ Birthday: birthUnix,
|
|
763
|
+ IdType: certificates,
|
|
764
|
+ CostOfProduction: cost_float,
|
|
765
|
+ Departments: department,
|
|
766
|
+ AdminUserId: doctor,
|
|
767
|
+ MedicalTreatmentType: medicalcare,
|
|
768
|
+ IdCardNo: idcard,
|
|
769
|
+ IsNeedCostOfProduction: cost_checked,
|
|
770
|
+ TreatmentCost: medicalExpense_float,
|
|
771
|
+ MedicalInsuranceNumber: medicalinsurancecard,
|
|
772
|
+ Name: name,
|
|
773
|
+ RegisterType: register,
|
|
774
|
+ RegisterCost: registrationfees_float,
|
|
775
|
+ BalanceAccountsType: settlementValue,
|
|
776
|
+ Gender: sex,
|
|
777
|
+ Total: totals_float,
|
|
778
|
+ UserOrgId: orgId,
|
|
779
|
+ }
|
|
780
|
+ err := service.CreateHisPatient(&patient)
|
|
781
|
+ if err != nil {
|
|
782
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
783
|
+ return
|
|
784
|
+ }
|
|
785
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
786
|
+ "patient": patient,
|
|
787
|
+ })
|
|
788
|
+ } else if errcode == nil {
|
|
789
|
+ patient := models.XtHisPatient{
|
|
790
|
+ Age: age,
|
|
791
|
+ Birthday: birthUnix,
|
|
792
|
+ IdType: certificates,
|
|
793
|
+ CostOfProduction: cost_float,
|
|
794
|
+ Departments: department,
|
|
795
|
+ AdminUserId: doctor,
|
|
796
|
+ MedicalTreatmentType: medicalcare,
|
|
797
|
+ IdCardNo: idcard,
|
|
798
|
+ IsNeedCostOfProduction: cost_checked,
|
|
799
|
+ TreatmentCost: medicalExpense_float,
|
|
800
|
+ MedicalInsuranceNumber: medicalinsurancecard,
|
|
801
|
+ Name: name,
|
|
802
|
+ RegisterType: register,
|
|
803
|
+ RegisterCost: registrationfees_float,
|
|
804
|
+ BalanceAccountsType: settlementValue,
|
|
805
|
+ Gender: sex,
|
|
806
|
+ Total: totals_float,
|
|
807
|
+ UserOrgId: orgId,
|
|
808
|
+ PatientId: bloodPatient.ID,
|
|
809
|
+ }
|
|
810
|
+ err := service.CreateHisPatient(&patient)
|
|
811
|
+ if err != nil {
|
|
812
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
813
|
+ return
|
|
814
|
+ }
|
|
815
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
816
|
+ "patient": patient,
|
|
817
|
+ })
|
|
818
|
+ }
|
|
819
|
+}
|
|
820
|
+
|
|
821
|
+func (this *HisProjectApiController) GetAllProjectTeam() {
|
|
822
|
+
|
|
823
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
824
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
825
|
+ team, err := service.GetAllProjectTeam(orgId)
|
|
826
|
+ if err != nil {
|
|
827
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
828
|
+ return
|
|
829
|
+ }
|
|
830
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
831
|
+ "team": team,
|
|
832
|
+ })
|
|
833
|
+}
|