|
@@ -5260,9 +5260,12 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
|
5260
|
5260
|
for _, adviceNameMap := range adviceNames {
|
5261
|
5261
|
adviceNameM := adviceNameMap.(map[string]interface{})
|
5262
|
5262
|
var advice models.GroupAdvice
|
|
5263
|
+
|
5263
|
5264
|
advice.Remark = Remark
|
5264
|
5265
|
advice.AdviceType = adviceType
|
|
5266
|
+
|
5265
|
5267
|
advice.StartTime = StartTime
|
|
5268
|
+
|
5266
|
5269
|
advice.AdviceDate = AdviceDate
|
5267
|
5270
|
|
5268
|
5271
|
advice.RecordDate = RecordDate
|
|
@@ -5372,6 +5375,11 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
|
5372
|
5375
|
advice.DrugNameId = drug_name_id
|
5373
|
5376
|
}
|
5374
|
5377
|
|
|
5378
|
+ if adviceNameM["groupno"] != nil || reflect.TypeOf(adviceNameM["groupno"]).String() == "float64" {
|
|
5379
|
+ groupno := int64(adviceNameM["groupno"].(float64))
|
|
5380
|
+ advice.GroupNo = groupno
|
|
5381
|
+ }
|
|
5382
|
+
|
5375
|
5383
|
if adviceNameM["template_id"] != nil && reflect.TypeOf(adviceNameM["template_id"]).String() == "string" {
|
5376
|
5384
|
template_id, _ := adviceNameM["template_id"].(string)
|
5377
|
5385
|
advice.TemplateId = template_id
|
|
@@ -5448,6 +5456,11 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
|
5448
|
5456
|
child.PrescribingNumberUnit = childPrescribingNumberUnit
|
5449
|
5457
|
}
|
5450
|
5458
|
|
|
5459
|
+ if childMap["groupno"] != nil || reflect.TypeOf(childMap["groupno"]).String() == "float64" {
|
|
5460
|
+ groupno := int64(childMap["groupno"].(float64))
|
|
5461
|
+ advice.GroupNo = groupno
|
|
5462
|
+ }
|
|
5463
|
+
|
5451
|
5464
|
child.DeliveryWay = advice.DeliveryWay
|
5452
|
5465
|
child.ExecutionFrequency = advice.ExecutionFrequency
|
5453
|
5466
|
advice.Children = append(advice.Children, &child)
|
|
@@ -5475,51 +5488,92 @@ func (c *DialysisAPIController) CreateRemindDoctorAdvice() {
|
5475
|
5488
|
PatientId: patient,
|
5476
|
5489
|
}
|
5477
|
5490
|
|
5478
|
|
- dialysisFinish, err := service.GetDialysisFinish(adminUserInfo.Org.Id, AdviceDate, 4, patient)
|
|
5491
|
+ dialysisFinish, _ := service.GetDialysisFinish(adminUserInfo.Org.Id, AdviceDate, 4, patient)
|
5479
|
5492
|
if dialysisFinish.ID == 0 {
|
5480
|
5493
|
service.CreateDialysisFinish(finish)
|
5481
|
5494
|
}
|
5482
|
5495
|
|
5483
|
|
- list, err := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, groupNo)
|
|
5496
|
+ if adminUserInfo.Org.Id == 10597 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10164 {
|
|
5497
|
+ list, err := service.CreateMGroupAdviceOne(adminUserInfo.Org.Id, advices, groupNo)
|
|
5498
|
+ for _, item := range advices {
|
|
5499
|
+ byterequest, _ := json.Marshal(item)
|
|
5500
|
+ adviceLog := models.XtDoctorAdviceLog{
|
|
5501
|
+ UserOrgId: adminUserInfo.Org.Id,
|
|
5502
|
+ PatientId: patient,
|
|
5503
|
+ AdminUserId: adminUserInfo.AdminUser.Id,
|
|
5504
|
+ Module: 1,
|
|
5505
|
+ ErrLog: string(byterequest),
|
|
5506
|
+ Status: 1,
|
|
5507
|
+ Ctime: time.Now().Unix(),
|
|
5508
|
+ Mtime: 0,
|
|
5509
|
+ Source: "手机端医嘱推送",
|
|
5510
|
+ RecordDate: item.AdviceDate,
|
|
5511
|
+ }
|
5484
|
5512
|
|
5485
|
|
- for _, item := range advices {
|
5486
|
|
- byterequest, _ := json.Marshal(item)
|
5487
|
|
- adviceLog := models.XtDoctorAdviceLog{
|
5488
|
|
- UserOrgId: adminUserInfo.Org.Id,
|
5489
|
|
- PatientId: patient,
|
5490
|
|
- AdminUserId: adminUserInfo.AdminUser.Id,
|
5491
|
|
- Module: 1,
|
5492
|
|
- ErrLog: string(byterequest),
|
5493
|
|
- Status: 1,
|
5494
|
|
- Ctime: time.Now().Unix(),
|
5495
|
|
- Mtime: 0,
|
5496
|
|
- Source: "手机端医嘱推送",
|
5497
|
|
- RecordDate: item.AdviceDate,
|
|
5513
|
+ service.CreateDoctorAdviceLog(adviceLog)
|
5498
|
5514
|
}
|
5499
|
5515
|
|
5500
|
|
- service.CreateDoctorAdviceLog(adviceLog)
|
5501
|
|
- }
|
|
5516
|
+ key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(RecordDate, 10) + ":doctor_advices"
|
|
5517
|
+ redis := service.RedisClient()
|
|
5518
|
+ //清空key 值
|
|
5519
|
+ redis.Set(key, "", time.Second)
|
5502
|
5520
|
|
5503
|
|
- key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(RecordDate, 10) + ":doctor_advices"
|
5504
|
|
- redis := service.RedisClient()
|
5505
|
|
- //清空key 值
|
5506
|
|
- redis.Set(key, "", time.Second)
|
|
5521
|
+ keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
|
|
5522
|
+ redis.Set(keyOne, "", time.Second)
|
5507
|
5523
|
|
5508
|
|
- keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
|
5509
|
|
- redis.Set(keyOne, "", time.Second)
|
|
5524
|
+ keyThree := "scheduals_" + adviceDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
|
|
5525
|
+ defer redis.Close()
|
|
5526
|
+ redis.Set(keyThree, "", time.Second)
|
|
5527
|
+ if err != nil {
|
|
5528
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
|
|
5529
|
+ return
|
|
5530
|
+ }
|
5510
|
5531
|
|
5511
|
|
- keyThree := "scheduals_" + adviceDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
|
5512
|
|
- defer redis.Close()
|
5513
|
|
- redis.Set(keyThree, "", time.Second)
|
5514
|
|
- if err != nil {
|
5515
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
|
5516
|
|
- return
|
5517
|
|
- }
|
|
5532
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
5533
|
+ "msg": "ok",
|
|
5534
|
+ "advices": list,
|
|
5535
|
+ })
|
|
5536
|
+ } else {
|
|
5537
|
+ list, err := service.CreateMGroupAdvice(adminUserInfo.Org.Id, advices, groupNo)
|
|
5538
|
+ for _, item := range advices {
|
|
5539
|
+ byterequest, _ := json.Marshal(item)
|
|
5540
|
+ adviceLog := models.XtDoctorAdviceLog{
|
|
5541
|
+ UserOrgId: adminUserInfo.Org.Id,
|
|
5542
|
+ PatientId: patient,
|
|
5543
|
+ AdminUserId: adminUserInfo.AdminUser.Id,
|
|
5544
|
+ Module: 1,
|
|
5545
|
+ ErrLog: string(byterequest),
|
|
5546
|
+ Status: 1,
|
|
5547
|
+ Ctime: time.Now().Unix(),
|
|
5548
|
+ Mtime: 0,
|
|
5549
|
+ Source: "手机端医嘱推送",
|
|
5550
|
+ RecordDate: item.AdviceDate,
|
|
5551
|
+ }
|
5518
|
5552
|
|
5519
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
5520
|
|
- "msg": "ok",
|
5521
|
|
- "advices": list,
|
5522
|
|
- })
|
|
5553
|
+ service.CreateDoctorAdviceLog(adviceLog)
|
|
5554
|
+ }
|
|
5555
|
+
|
|
5556
|
+ key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient, 10) + ":" + strconv.FormatInt(RecordDate, 10) + ":doctor_advices"
|
|
5557
|
+ redis := service.RedisClient()
|
|
5558
|
+ //清空key 值
|
|
5559
|
+ redis.Set(key, "", time.Second)
|
|
5560
|
+
|
|
5561
|
+ keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(AdviceDate, 10) + ":advice_list_all"
|
|
5562
|
+ redis.Set(keyOne, "", time.Second)
|
|
5563
|
+
|
|
5564
|
+ keyThree := "scheduals_" + adviceDate + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
|
|
5565
|
+ defer redis.Close()
|
|
5566
|
+ redis.Set(keyThree, "", time.Second)
|
|
5567
|
+ if err != nil {
|
|
5568
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateDoctorAdviceFail)
|
|
5569
|
+ return
|
|
5570
|
+ }
|
|
5571
|
+
|
|
5572
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
5573
|
+ "msg": "ok",
|
|
5574
|
+ "advices": list,
|
|
5575
|
+ })
|
|
5576
|
+ }
|
5523
|
5577
|
|
5524
|
5578
|
} else {
|
5525
|
5579
|
c.ServeSuccessJSON(map[string]interface{}{
|
|
@@ -8157,12 +8211,9 @@ func (c *DialysisAPIController) GetPatientDialysisRecordList() {
|
8157
|
8211
|
|
8158
|
8212
|
end_time := c.GetString("end_time")
|
8159
|
8213
|
|
8160
|
|
- fmt.Println("start_timeo2o2o2o2o2o", start_time)
|
8161
|
|
- fmt.Println("end_Time2o2o2o2ooo22", end_time)
|
8162
|
8214
|
var startdateunix int64
|
8163
|
8215
|
if len(start_time) > 0 {
|
8164
|
8216
|
theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
8165
|
|
- fmt.Println("theTim3333333333333333333333e", theTime)
|
8166
|
8217
|
if err != nil {
|
8167
|
8218
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
8168
|
8219
|
return
|
|
@@ -8190,20 +8241,34 @@ func (c *DialysisAPIController) GetPatientDialysisRecordList() {
|
8190
|
8241
|
|
8191
|
8242
|
org_id := c.GetMobileAdminUserInfo().Org.Id
|
8192
|
8243
|
|
8193
|
|
- if org_id == 10579 {
|
8194
|
|
- list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
|
|
8244
|
+ //if org_id == 10579 {
|
|
8245
|
+ // list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
|
|
8246
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
8247
|
+ // "list": list,
|
|
8248
|
+ // })
|
|
8249
|
+ // return
|
|
8250
|
+ //} else {
|
|
8251
|
+ // list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
|
|
8252
|
+ // c.ServeSuccessJSON(map[string]interface{}{
|
|
8253
|
+ // "list": list,
|
|
8254
|
+ // })
|
|
8255
|
+ // return
|
|
8256
|
+ //}
|
|
8257
|
+ if org_id == 9538 || org_id == 10101 {
|
|
8258
|
+ list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
|
8195
|
8259
|
c.ServeSuccessJSON(map[string]interface{}{
|
8196
|
8260
|
"list": list,
|
8197
|
8261
|
})
|
8198
|
8262
|
return
|
8199
|
8263
|
} else {
|
8200
|
|
- list, _ := service.GetPatientDialysisRecordList(id, startdateunix, enddateunix)
|
|
8264
|
+ list, _ := service.GetPatientDialysisRecordListOne(id, startdateunix, enddateunix)
|
8201
|
8265
|
c.ServeSuccessJSON(map[string]interface{}{
|
8202
|
8266
|
"list": list,
|
8203
|
8267
|
})
|
8204
|
|
- return
|
8205
|
8268
|
}
|
8206
|
8269
|
|
|
8270
|
+ return
|
|
8271
|
+
|
8207
|
8272
|
}
|
8208
|
8273
|
|
8209
|
8274
|
func (c *DialysisAPIController) BathDeleteAdviceList() {
|