|
@@ -22,12 +22,632 @@ func PatientDataConfigAPIControllerRegistRouters() {
|
22
|
22
|
beego.Router("/api/patient/rescues", &PatientDataConfigAPIController{}, "get:Rescues")
|
23
|
23
|
beego.Router("/api/patient/rescue/create", &PatientDataConfigAPIController{}, "post:CreateRescue")
|
24
|
24
|
beego.Router("/api/patient/rescue/delete", &PatientDataConfigAPIController{}, "post:DeleteRescue")
|
|
25
|
+
|
|
26
|
+ beego.Router("/api/patient/sickhistory", &PatientDataConfigAPIController{}, "get:GetSickHistorys")
|
|
27
|
+ beego.Router("/api/patient/sickhistory/create", &PatientDataConfigAPIController{}, "get:CreateSickHistory")
|
|
28
|
+ beego.Router("/api/patient/sickhistory/delete", &PatientDataConfigAPIController{}, "post:DeleteSickHistory")
|
|
29
|
+ beego.Router("/api/patient/sickhistory/modify", &PatientDataConfigAPIController{}, "get:ModifySickHistory")
|
|
30
|
+
|
|
31
|
+ beego.Router("/api/patient/physiquecheck", &PatientDataConfigAPIController{}, "get:GetPhysiqueChecks")
|
|
32
|
+ beego.Router("/api/patient/physiquecheck/create", &PatientDataConfigAPIController{}, "get:CreatePhysiqueCheck")
|
|
33
|
+ beego.Router("/api/patient/physiquecheck/delete", &PatientDataConfigAPIController{}, "post:DeletePhysiqueCheck")
|
|
34
|
+ beego.Router("/api/patient/physiquecheck/modify", &PatientDataConfigAPIController{}, "get:ModifyPhysiqueCheck")
|
|
35
|
+
|
25
|
36
|
}
|
26
|
37
|
|
27
|
38
|
type PatientDataConfigAPIController struct {
|
28
|
39
|
BaseAuthAPIController
|
29
|
40
|
}
|
30
|
41
|
|
|
42
|
+func (this *PatientDataConfigAPIController) GetSickHistorys() {
|
|
43
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
44
|
+ startTimeYMDStr := this.GetString("start_time")
|
|
45
|
+ endTimeYMDStr := this.GetString("end_time")
|
|
46
|
+ if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
|
|
47
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
48
|
+ return
|
|
49
|
+ }
|
|
50
|
+ endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
|
|
51
|
+ startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
|
|
52
|
+ endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
|
|
53
|
+ if parseStartTimeErr != nil || parseEndTimeErr != nil {
|
|
54
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
|
|
55
|
+ return
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
59
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
60
|
+ if getPatientErr != nil {
|
|
61
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
62
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
63
|
+ return
|
|
64
|
+ } else if patient == nil {
|
|
65
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
66
|
+ return
|
|
67
|
+ }
|
|
68
|
+
|
|
69
|
+ records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
|
|
70
|
+ if getRecordsErr != nil {
|
|
71
|
+ this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
|
|
72
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
73
|
+ return
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
|
|
77
|
+ if getAllAdminsErr != nil {
|
|
78
|
+ this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
|
|
79
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
80
|
+ return
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
84
|
+ "records": records,
|
|
85
|
+ "doctors": admins,
|
|
86
|
+ })
|
|
87
|
+}
|
|
88
|
+func (this *PatientDataConfigAPIController) CreateSickHistory() {
|
|
89
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
90
|
+ content := this.GetString("content")
|
|
91
|
+ record_time_str := this.GetString("record_time")
|
|
92
|
+ title := this.GetString("title")
|
|
93
|
+ is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
|
|
94
|
+ is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
|
|
95
|
+ is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
|
|
96
|
+ guominyaowu_desc := this.GetString("guominyaowu_desc")
|
|
97
|
+ doctor_id, _ := this.GetInt64("doctor_id")
|
|
98
|
+
|
|
99
|
+ if patientID <= 0 || len(content) == 0 {
|
|
100
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
101
|
+ return
|
|
102
|
+ }
|
|
103
|
+
|
|
104
|
+ if len(record_time_str) == 0 {
|
|
105
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
106
|
+ return
|
|
107
|
+ }
|
|
108
|
+
|
|
109
|
+ checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
|
|
110
|
+
|
|
111
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
112
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
113
|
+ if getPatientErr != nil {
|
|
114
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
115
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
116
|
+ return
|
|
117
|
+ } else if patient == nil {
|
|
118
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
119
|
+ return
|
|
120
|
+ }
|
|
121
|
+
|
|
122
|
+ now := time.Now().Unix()
|
|
123
|
+ record := models.XtPatientSickHistory{
|
|
124
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
125
|
+ PatientId: patientID,
|
|
126
|
+ Recorder: adminUserInfo.AdminUser.Id,
|
|
127
|
+ RecordTime: checkDate.Unix(),
|
|
128
|
+ Content: content,
|
|
129
|
+ Status: 1,
|
|
130
|
+ Title: title,
|
|
131
|
+ IsShenyizhiHistory: is_shenyizhishi,
|
|
132
|
+ IsFumoDialysisHistory: is_fumotouxishi,
|
|
133
|
+ HypersusceptibilityDesc: guominyaowu_desc,
|
|
134
|
+ IsHypersusceptibility: is_guominyaowu,
|
|
135
|
+ Ctime: now,
|
|
136
|
+ Mtime: now,
|
|
137
|
+ DoctorId: doctor_id,
|
|
138
|
+ }
|
|
139
|
+
|
|
140
|
+ createErr := service.CreatePatientSickHistory(&record)
|
|
141
|
+ if createErr != nil {
|
|
142
|
+ this.ErrorLog("创建患者病史记录失败:%v", createErr)
|
|
143
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
144
|
+ return
|
|
145
|
+ }
|
|
146
|
+
|
|
147
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
148
|
+ "record": record,
|
|
149
|
+ })
|
|
150
|
+}
|
|
151
|
+func (this *PatientDataConfigAPIController) DeleteSickHistory() {
|
|
152
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
153
|
+ idsStr := this.GetString("ids")
|
|
154
|
+ if patientID <= 0 || len(idsStr) == 0 {
|
|
155
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
156
|
+ return
|
|
157
|
+ }
|
|
158
|
+
|
|
159
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
160
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
161
|
+ if getPatientErr != nil {
|
|
162
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
163
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
164
|
+ return
|
|
165
|
+ } else if patient == nil {
|
|
166
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
167
|
+ return
|
|
168
|
+ }
|
|
169
|
+
|
|
170
|
+ recordIDStrs := strings.Split(idsStr, ",")
|
|
171
|
+ recordIDs := make([]int64, 0, len(recordIDStrs))
|
|
172
|
+ for _, idStr := range recordIDStrs {
|
|
173
|
+ id, parseErr := strconv.Atoi(idStr)
|
|
174
|
+ if parseErr != nil {
|
|
175
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
176
|
+ return
|
|
177
|
+ }
|
|
178
|
+ recordIDs = append(recordIDs, int64(id))
|
|
179
|
+ }
|
|
180
|
+
|
|
181
|
+ deleteErr := service.DeletePatientSickHistoryInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
|
|
182
|
+ if deleteErr != nil {
|
|
183
|
+ this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
|
|
184
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
185
|
+ return
|
|
186
|
+ }
|
|
187
|
+ this.ServeSuccessJSON(nil)
|
|
188
|
+}
|
|
189
|
+func (this *PatientDataConfigAPIController) ModifySickHistory() {
|
|
190
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
191
|
+ content := this.GetString("content")
|
|
192
|
+ id, _ := this.GetInt64("id", 0)
|
|
193
|
+ record_time_str := this.GetString("record_time")
|
|
194
|
+ title := this.GetString("title")
|
|
195
|
+
|
|
196
|
+ is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
|
|
197
|
+ is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
|
|
198
|
+ is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
|
|
199
|
+ guominyaowu_desc := this.GetString("guominyaowu_desc")
|
|
200
|
+ doctor_id, _ := this.GetInt64("doctor_id")
|
|
201
|
+
|
|
202
|
+ if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
|
|
203
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
204
|
+ return
|
|
205
|
+ }
|
|
206
|
+ //timeLayout := "2006-01-02"
|
|
207
|
+ //loc, _ := time.LoadLocation("Local")
|
|
208
|
+ checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
|
|
209
|
+
|
|
210
|
+ fmt.Println("checkDate--------------", checkDate)
|
|
211
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
212
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
213
|
+ if getPatientErr != nil {
|
|
214
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
215
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
216
|
+ return
|
|
217
|
+ } else if patient == nil {
|
|
218
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
219
|
+ return
|
|
220
|
+ }
|
|
221
|
+
|
|
222
|
+ now := time.Now().Unix()
|
|
223
|
+
|
|
224
|
+ record := models.XtPatientSickHistory{
|
|
225
|
+ ID: id,
|
|
226
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
227
|
+ PatientId: patientID,
|
|
228
|
+ Recorder: adminUserInfo.AdminUser.Id,
|
|
229
|
+ Content: content,
|
|
230
|
+ Status: 1,
|
|
231
|
+ Ctime: now,
|
|
232
|
+ Mtime: now,
|
|
233
|
+ Title: title,
|
|
234
|
+ RecordTime: checkDate.Unix(),
|
|
235
|
+ IsShenyizhiHistory: is_shenyizhishi,
|
|
236
|
+ IsFumoDialysisHistory: is_fumotouxishi,
|
|
237
|
+ HypersusceptibilityDesc: guominyaowu_desc,
|
|
238
|
+ IsHypersusceptibility: is_guominyaowu,
|
|
239
|
+ DoctorId: doctor_id,
|
|
240
|
+ }
|
|
241
|
+ createErr := service.ModifyPatientSickHistory(&record)
|
|
242
|
+ if createErr != nil {
|
|
243
|
+ this.ErrorLog("创建患者抢救记录失败:%v", createErr)
|
|
244
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
245
|
+ return
|
|
246
|
+ }
|
|
247
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
248
|
+ "record": record,
|
|
249
|
+ })
|
|
250
|
+}
|
|
251
|
+
|
|
252
|
+func (this *PatientDataConfigAPIController) GetPhysiqueChecks() {
|
|
253
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
254
|
+ startTimeYMDStr := this.GetString("start_time")
|
|
255
|
+ endTimeYMDStr := this.GetString("end_time")
|
|
256
|
+ if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
|
|
257
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
258
|
+ return
|
|
259
|
+ }
|
|
260
|
+ endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
|
|
261
|
+ startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
|
|
262
|
+ endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
|
|
263
|
+ if parseStartTimeErr != nil || parseEndTimeErr != nil {
|
|
264
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
|
|
265
|
+ return
|
|
266
|
+ }
|
|
267
|
+
|
|
268
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
269
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
270
|
+ if getPatientErr != nil {
|
|
271
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
272
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
273
|
+ return
|
|
274
|
+ } else if patient == nil {
|
|
275
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
276
|
+ return
|
|
277
|
+ }
|
|
278
|
+
|
|
279
|
+ records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
|
|
280
|
+ if getRecordsErr != nil {
|
|
281
|
+ this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
|
|
282
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
283
|
+ return
|
|
284
|
+ }
|
|
285
|
+
|
|
286
|
+ admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
|
|
287
|
+ if getAllAdminsErr != nil {
|
|
288
|
+ this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
|
|
289
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
290
|
+ return
|
|
291
|
+ }
|
|
292
|
+
|
|
293
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
294
|
+ "records": records,
|
|
295
|
+ "doctors": admins,
|
|
296
|
+ })
|
|
297
|
+}
|
|
298
|
+func (this *PatientDataConfigAPIController) CreatePhysiqueCheck() {
|
|
299
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
300
|
+ doctor_id, _ := this.GetInt64("doctor_id")
|
|
301
|
+ record_time_str := this.GetString("record_time")
|
|
302
|
+ t := this.GetString("t")
|
|
303
|
+ p := this.GetString("p")
|
|
304
|
+ r := this.GetString("r")
|
|
305
|
+ bp_left := this.GetString("bp_left")
|
|
306
|
+ bp_right := this.GetString("bp_right")
|
|
307
|
+ pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
|
|
308
|
+ tiwei, _ := this.GetInt64("tiwei")
|
|
309
|
+ fuzhong, _ := this.GetInt64("fuzhong")
|
|
310
|
+ chuxuedian, _ := this.GetInt64("chuxuedian")
|
|
311
|
+
|
|
312
|
+ fayu, _ := this.GetInt64("fayu")
|
|
313
|
+ yinyang, _ := this.GetInt64("yinyang")
|
|
314
|
+ shenzhi, _ := this.GetInt64("shenzhi")
|
|
315
|
+ pifunianmo, _ := this.GetInt64("pifunianmo")
|
|
316
|
+ buwei := this.GetString("buwei")
|
|
317
|
+ chengdu := this.GetString("chengdu")
|
|
318
|
+ pixiachuxue, _ := this.GetInt64("pixiachuxue")
|
|
319
|
+ zidian, _ := this.GetInt64("zidian")
|
|
320
|
+ pifuwendu, _ := this.GetInt64("pifuwendu")
|
|
321
|
+ qita := this.GetString("qita")
|
|
322
|
+
|
|
323
|
+ linbazhongda, _ := this.GetInt64("linbazhongda")
|
|
324
|
+ linbabuwei := this.GetString("linbabuwei")
|
|
325
|
+
|
|
326
|
+ yanlian, _ := this.GetInt64("yanlian")
|
|
327
|
+ tongkong, _ := this.GetInt64("tongkong")
|
|
328
|
+ zuo := this.GetString("zuo")
|
|
329
|
+ you := this.GetString("you")
|
|
330
|
+
|
|
331
|
+ duiguangfanshe := this.GetString("duiguangfanshe")
|
|
332
|
+ biantaoti := this.GetString("biantaoti")
|
|
333
|
+ yanbu := this.GetString("yanbu")
|
|
334
|
+ toubuqita := this.GetString("toubuqita")
|
|
335
|
+ huxiyin := this.GetString("huxiyin")
|
|
336
|
+
|
|
337
|
+ xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
|
|
338
|
+ feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
|
|
339
|
+ luoyin, _ := this.GetInt64("luoyin")
|
|
340
|
+ desc := this.GetString("desc")
|
|
341
|
+
|
|
342
|
+ xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
|
|
343
|
+ xinlv, _ := this.GetInt64("xinlv")
|
|
344
|
+ xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
|
|
345
|
+ zayin, _ := this.GetInt64("zayin")
|
|
346
|
+ fujiayin, _ := this.GetInt64("fujiayin")
|
|
347
|
+ xinzangdesc := this.GetString("xinzangdesc")
|
|
348
|
+
|
|
349
|
+ fushuizheng, _ := this.GetInt64("fushuizheng")
|
|
350
|
+ ganjingjingmai := this.GetString("ganjingjingmai")
|
|
351
|
+
|
|
352
|
+ gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
|
|
353
|
+ gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
|
|
354
|
+ pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
|
|
355
|
+ pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
|
|
356
|
+
|
|
357
|
+ shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
|
|
358
|
+ shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
|
|
359
|
+ fubu_desc := this.GetString("fubu_desc")
|
|
360
|
+ oth_desc := this.GetString("oth_desc")
|
|
361
|
+
|
|
362
|
+ if patientID <= 0 {
|
|
363
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
364
|
+ return
|
|
365
|
+ }
|
|
366
|
+
|
|
367
|
+ if len(record_time_str) == 0 {
|
|
368
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
369
|
+ return
|
|
370
|
+ }
|
|
371
|
+
|
|
372
|
+ checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
|
|
373
|
+
|
|
374
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
375
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
376
|
+ if getPatientErr != nil {
|
|
377
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
378
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
379
|
+ return
|
|
380
|
+ } else if patient == nil {
|
|
381
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
382
|
+ return
|
|
383
|
+ }
|
|
384
|
+
|
|
385
|
+ now := time.Now().Unix()
|
|
386
|
+ record := models.XtPatientPhysiqueCheck{
|
|
387
|
+ DoctorId: doctor_id,
|
|
388
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
389
|
+ PatientId: patientID,
|
|
390
|
+ Recorder: adminUserInfo.AdminUser.Id,
|
|
391
|
+ RecordTime: checkDate.Unix(),
|
|
392
|
+ Status: 1,
|
|
393
|
+ Ctime: now,
|
|
394
|
+ Mtime: now,
|
|
395
|
+ T: t,
|
|
396
|
+ P: p,
|
|
397
|
+ R: r,
|
|
398
|
+ BpRight: bp_right,
|
|
399
|
+ BpLeft: bp_left,
|
|
400
|
+ Pinxuerongmao: pinxuerongmao,
|
|
401
|
+ Tiwei: tiwei,
|
|
402
|
+ Fuzhong: fuzhong,
|
|
403
|
+ Chuxuedian: chuxuedian,
|
|
404
|
+ Fayu: fayu,
|
|
405
|
+ Yinyang: yinyang,
|
|
406
|
+ Shenzhi: shenzhi,
|
|
407
|
+ Pifunianmo: pifunianmo,
|
|
408
|
+ Buwei: buwei,
|
|
409
|
+ Chengdu: chengdu,
|
|
410
|
+ Pixiachuxue: pixiachuxue,
|
|
411
|
+ Zidian: zidian,
|
|
412
|
+ Pifuwendu: pifuwendu,
|
|
413
|
+ Qita: qita,
|
|
414
|
+ Linbazhongda: linbazhongda,
|
|
415
|
+ Linbabuwei: linbabuwei,
|
|
416
|
+ Yanlian: yanlian,
|
|
417
|
+ Tongkong: tongkong,
|
|
418
|
+ Zuo: zuo,
|
|
419
|
+ You: you,
|
|
420
|
+ Duiguangfanshe: duiguangfanshe,
|
|
421
|
+ Biantaoti: biantaoti,
|
|
422
|
+ Yanbu: yanbu,
|
|
423
|
+ Toubuqita: toubuqita,
|
|
424
|
+ Huxiyin: huxiyin,
|
|
425
|
+ Xiongmomocayin: xiongmomocayin,
|
|
426
|
+ Feizhangbuwei: feizhangbuwei,
|
|
427
|
+ Luoyin: luoyin,
|
|
428
|
+ Desc: desc,
|
|
429
|
+ Xinzangdaxiao: xinzangdaxiao,
|
|
430
|
+ Xinlv: xinlv,
|
|
431
|
+ Xinbaomocasheng: xinbaomocasheng,
|
|
432
|
+ Zayin: zayin,
|
|
433
|
+ Fujiayin: fujiayin,
|
|
434
|
+ Xinzangdesc: xinzangdesc,
|
|
435
|
+ Fushuizheng: fushuizheng,
|
|
436
|
+ Ganjingjingmai: ganjingjingmai,
|
|
437
|
+ GangzhangYatong: gangzhang_yatong,
|
|
438
|
+ GangzhangKoutong: gangzhang_koutong,
|
|
439
|
+ PizhangKoutong: pizhang_koutong,
|
|
440
|
+ PizhangYatong: pizhang_yatong,
|
|
441
|
+ ShenzhangKoutong: shenzhang_koutong,
|
|
442
|
+ ShenzhangYatong: shenzhang_yatong,
|
|
443
|
+ FubuDesc: fubu_desc,
|
|
444
|
+ OthDesc: oth_desc,
|
|
445
|
+ }
|
|
446
|
+ createErr := service.CreatePatientPhysiqueCheck(&record)
|
|
447
|
+ if createErr != nil {
|
|
448
|
+ this.ErrorLog("创建患者病史记录失败:%v", createErr)
|
|
449
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
450
|
+ return
|
|
451
|
+ }
|
|
452
|
+
|
|
453
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
454
|
+ "record": record,
|
|
455
|
+ })
|
|
456
|
+}
|
|
457
|
+func (this *PatientDataConfigAPIController) DeletePhysiqueCheck() {
|
|
458
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
459
|
+ idsStr := this.GetString("ids")
|
|
460
|
+ if patientID <= 0 || len(idsStr) == 0 {
|
|
461
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
462
|
+ return
|
|
463
|
+ }
|
|
464
|
+
|
|
465
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
466
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
467
|
+ if getPatientErr != nil {
|
|
468
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
469
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
470
|
+ return
|
|
471
|
+ } else if patient == nil {
|
|
472
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
473
|
+ return
|
|
474
|
+ }
|
|
475
|
+
|
|
476
|
+ recordIDStrs := strings.Split(idsStr, ",")
|
|
477
|
+ recordIDs := make([]int64, 0, len(recordIDStrs))
|
|
478
|
+ for _, idStr := range recordIDStrs {
|
|
479
|
+ id, parseErr := strconv.Atoi(idStr)
|
|
480
|
+ if parseErr != nil {
|
|
481
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
482
|
+ return
|
|
483
|
+ }
|
|
484
|
+ recordIDs = append(recordIDs, int64(id))
|
|
485
|
+ }
|
|
486
|
+
|
|
487
|
+ deleteErr := service.DeletePatientPhysiqueCheckInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
|
|
488
|
+ if deleteErr != nil {
|
|
489
|
+ this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
|
|
490
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
491
|
+ return
|
|
492
|
+ }
|
|
493
|
+ this.ServeSuccessJSON(nil)
|
|
494
|
+}
|
|
495
|
+func (this *PatientDataConfigAPIController) ModifyPhysiqueCheck() {
|
|
496
|
+ patientID, _ := this.GetInt64("patient_id")
|
|
497
|
+ id, _ := this.GetInt64("id", 0)
|
|
498
|
+ doctor_id, _ := this.GetInt64("doctor_id", 0)
|
|
499
|
+
|
|
500
|
+ record_time_str := this.GetString("record_time")
|
|
501
|
+
|
|
502
|
+ if patientID <= 0 || id == 0 || len(record_time_str) == 0 {
|
|
503
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
504
|
+ return
|
|
505
|
+ }
|
|
506
|
+ t := this.GetString("t")
|
|
507
|
+ p := this.GetString("p")
|
|
508
|
+ r := this.GetString("r")
|
|
509
|
+ bp_left := this.GetString("bp_left")
|
|
510
|
+ bp_right := this.GetString("bp_right")
|
|
511
|
+ pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
|
|
512
|
+ tiwei, _ := this.GetInt64("tiwei")
|
|
513
|
+ fuzhong, _ := this.GetInt64("fuzhong")
|
|
514
|
+ chuxuedian, _ := this.GetInt64("chuxuedian")
|
|
515
|
+
|
|
516
|
+ fayu, _ := this.GetInt64("fayu")
|
|
517
|
+ yinyang, _ := this.GetInt64("yinyang")
|
|
518
|
+ shenzhi, _ := this.GetInt64("shenzhi")
|
|
519
|
+ pifunianmo, _ := this.GetInt64("pifunianmo")
|
|
520
|
+ buwei := this.GetString("buwei")
|
|
521
|
+ chengdu := this.GetString("chengdu")
|
|
522
|
+ pixiachuxue, _ := this.GetInt64("pixiachuxue")
|
|
523
|
+ zidian, _ := this.GetInt64("zidian")
|
|
524
|
+ pifuwendu, _ := this.GetInt64("pifuwendu")
|
|
525
|
+ qita := this.GetString("qita")
|
|
526
|
+
|
|
527
|
+ linbazhongda, _ := this.GetInt64("linbazhongda")
|
|
528
|
+ linbabuwei := this.GetString("linbabuwei")
|
|
529
|
+
|
|
530
|
+ yanlian, _ := this.GetInt64("yanlian")
|
|
531
|
+ tongkong, _ := this.GetInt64("tongkong")
|
|
532
|
+ zuo := this.GetString("zuo")
|
|
533
|
+ you := this.GetString("you")
|
|
534
|
+
|
|
535
|
+ duiguangfanshe := this.GetString("duiguangfanshe")
|
|
536
|
+ biantaoti := this.GetString("biantaoti")
|
|
537
|
+ yanbu := this.GetString("yanbu")
|
|
538
|
+ toubuqita := this.GetString("toubuqita")
|
|
539
|
+ huxiyin := this.GetString("huxiyin")
|
|
540
|
+
|
|
541
|
+ xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
|
|
542
|
+ feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
|
|
543
|
+ luoyin, _ := this.GetInt64("luoyin")
|
|
544
|
+ desc := this.GetString("desc")
|
|
545
|
+
|
|
546
|
+ xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
|
|
547
|
+ xinlv, _ := this.GetInt64("xinlv")
|
|
548
|
+ xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
|
|
549
|
+ zayin, _ := this.GetInt64("zayin")
|
|
550
|
+ fujiayin, _ := this.GetInt64("fujiayin")
|
|
551
|
+ xinzangdesc := this.GetString("xinzangdesc")
|
|
552
|
+
|
|
553
|
+ fushuizheng, _ := this.GetInt64("fushuizheng")
|
|
554
|
+ ganjingjingmai := this.GetString("ganjingjingmai")
|
|
555
|
+
|
|
556
|
+ gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
|
|
557
|
+ gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
|
|
558
|
+ pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
|
|
559
|
+ pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
|
|
560
|
+
|
|
561
|
+ shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
|
|
562
|
+ shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
|
|
563
|
+ fubu_desc := this.GetString("fubu_desc")
|
|
564
|
+ oth_desc := this.GetString("oth_desc")
|
|
565
|
+
|
|
566
|
+ checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
|
|
567
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
568
|
+ patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
|
|
569
|
+ if getPatientErr != nil {
|
|
570
|
+ this.ErrorLog("获取患者信息失败:%v", getPatientErr)
|
|
571
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
572
|
+ return
|
|
573
|
+ } else if patient == nil {
|
|
574
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
|
|
575
|
+ return
|
|
576
|
+ }
|
|
577
|
+ now := time.Now().Unix()
|
|
578
|
+
|
|
579
|
+ record := models.XtPatientPhysiqueCheck{
|
|
580
|
+ ID: id,
|
|
581
|
+ OrgId: adminUserInfo.CurrentOrgId,
|
|
582
|
+ PatientId: patientID,
|
|
583
|
+ Recorder: adminUserInfo.AdminUser.Id,
|
|
584
|
+ RecordTime: checkDate.Unix(),
|
|
585
|
+ DoctorId: doctor_id,
|
|
586
|
+ Status: 1,
|
|
587
|
+ Ctime: now,
|
|
588
|
+ Mtime: now,
|
|
589
|
+ T: t,
|
|
590
|
+ P: p,
|
|
591
|
+ R: r,
|
|
592
|
+ BpRight: bp_right,
|
|
593
|
+ BpLeft: bp_left,
|
|
594
|
+ Pinxuerongmao: pinxuerongmao,
|
|
595
|
+ Tiwei: tiwei,
|
|
596
|
+ Fuzhong: fuzhong,
|
|
597
|
+ Chuxuedian: chuxuedian,
|
|
598
|
+ Fayu: fayu,
|
|
599
|
+ Yinyang: yinyang,
|
|
600
|
+ Shenzhi: shenzhi,
|
|
601
|
+ Pifunianmo: pifunianmo,
|
|
602
|
+ Buwei: buwei,
|
|
603
|
+ Chengdu: chengdu,
|
|
604
|
+ Pixiachuxue: pixiachuxue,
|
|
605
|
+ Zidian: zidian,
|
|
606
|
+ Pifuwendu: pifuwendu,
|
|
607
|
+ Qita: qita,
|
|
608
|
+ Linbazhongda: linbazhongda,
|
|
609
|
+ Linbabuwei: linbabuwei,
|
|
610
|
+ Yanlian: yanlian,
|
|
611
|
+ Tongkong: tongkong,
|
|
612
|
+ Zuo: zuo,
|
|
613
|
+ You: you,
|
|
614
|
+ Duiguangfanshe: duiguangfanshe,
|
|
615
|
+ Biantaoti: biantaoti,
|
|
616
|
+ Yanbu: yanbu,
|
|
617
|
+ Toubuqita: toubuqita,
|
|
618
|
+ Huxiyin: huxiyin,
|
|
619
|
+ Xiongmomocayin: xiongmomocayin,
|
|
620
|
+ Feizhangbuwei: feizhangbuwei,
|
|
621
|
+ Luoyin: luoyin,
|
|
622
|
+ Desc: desc,
|
|
623
|
+ Xinzangdaxiao: xinzangdaxiao,
|
|
624
|
+ Xinlv: xinlv,
|
|
625
|
+ Xinbaomocasheng: xinbaomocasheng,
|
|
626
|
+ Zayin: zayin,
|
|
627
|
+ Fujiayin: fujiayin,
|
|
628
|
+ Xinzangdesc: xinzangdesc,
|
|
629
|
+ Fushuizheng: fushuizheng,
|
|
630
|
+ Ganjingjingmai: ganjingjingmai,
|
|
631
|
+ GangzhangYatong: gangzhang_yatong,
|
|
632
|
+ GangzhangKoutong: gangzhang_koutong,
|
|
633
|
+ PizhangKoutong: pizhang_koutong,
|
|
634
|
+ PizhangYatong: pizhang_yatong,
|
|
635
|
+ ShenzhangKoutong: shenzhang_koutong,
|
|
636
|
+ ShenzhangYatong: shenzhang_yatong,
|
|
637
|
+ FubuDesc: fubu_desc,
|
|
638
|
+ OthDesc: oth_desc,
|
|
639
|
+ }
|
|
640
|
+ createErr := service.ModifyPatientPhysiqueCheck(&record)
|
|
641
|
+ if createErr != nil {
|
|
642
|
+ this.ErrorLog("修改患者体格检查失败:%v", createErr)
|
|
643
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
644
|
+ return
|
|
645
|
+ }
|
|
646
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
647
|
+ "record": record,
|
|
648
|
+ })
|
|
649
|
+}
|
|
650
|
+
|
31
|
651
|
// /api/patient/courses [get]
|
32
|
652
|
// @param patient_id:int
|
33
|
653
|
// @param start_time:string (yyyy-MM-dd)
|