Bläddra i källkod

透析处方生成抗凝剂临时医嘱

张保健 1 år sedan
förälder
incheckning
4669f386f2
1 ändrade filer med 93 tillägg och 0 borttagningar
  1. 93 0
      controllers/dialysis_api_controller.go

+ 93 - 0
controllers/dialysis_api_controller.go Visa fil

@@ -434,6 +434,99 @@ func (c *DialysisApiController) PostPrescription() {
434 434
 		DialysisRemark:             dialysis_remark,
435 435
 	}
436 436
 
437
+	//长沙南雅医院,自动生成抗凝剂的临时处方
438
+	if adminUserInfo.CurrentOrgId == 10340 {
439
+		advice := models.DoctorAdvice{
440
+			UserOrgId:             adminUserInfo.CurrentOrgId,
441
+			PatientId:             patient,
442
+			GroupNo:               0,
443
+			AdviceType:            2,
444
+			AdviceDate:            recordDate.Unix(),
445
+			StartTime:             recordDate.Unix() + 7*60*60, // 根据排班班次,给默认时间
446
+			AdviceName:            "",                          // 根据抗凝剂转换为中文 + 首剂 + 维持 + 总量
447
+			AdviceDesc:            "",
448
+			ReminderDate:          0,
449
+			SingleDose:            0,
450
+			SingleDoseUnit:        "",
451
+			DrugSpec:              0,
452
+			DrugSpecUnit:          "",
453
+			PrescribingNumber:     0, // 前端传过来的开药数量
454
+			PrescribingNumberUnit: "支",
455
+			DeliveryWay:           "静脉注射",
456
+			ExecutionFrequency:    "上机前",
457
+			AdviceDoctor:          0,
458
+			Status:                1,
459
+			CreatedTime:           time.Now().Unix(),
460
+			UpdatedTime:           time.Now().Unix(),
461
+			IsPrescription:        1,
462
+		}
463
+		// 查询排班信息
464
+		schedulePatient, _ := service.GetScheduleByPatient(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
465
+		if schedulePatient.ID > 0 {
466
+			if schedulePatient.ScheduleType == 1 {
467
+				advice.StartTime = recordDate.Unix() + 7*60*60
468
+			}
469
+
470
+			if schedulePatient.ScheduleType == 2 {
471
+				advice.StartTime = recordDate.Unix() + 11*60*60
472
+			}
473
+		}
474
+		// 抗凝剂名称
475
+		switch anticoagulant {
476
+		case 1:
477
+			advice.AdviceName = "无肝素"
478
+			break
479
+		case 2:
480
+			advice.AdviceName = "普通肝素"
481
+			break
482
+		case 3:
483
+			advice.AdviceName = "低分子肝素"
484
+			break
485
+		case 4:
486
+			advice.AdviceName = "阿加曲班"
487
+			break
488
+		case 5:
489
+			advice.AdviceName = "枸橼酸钠"
490
+			break
491
+		case 6:
492
+			advice.AdviceName = "低分子肝素钙"
493
+			break
494
+		case 7:
495
+			advice.AdviceName = "低分子肝素钠"
496
+			break
497
+		case 8:
498
+			advice.AdviceName = "依诺肝素"
499
+			break
500
+		case 9:
501
+			advice.AdviceName = "达肝素"
502
+			break
503
+		case 10:
504
+			advice.AdviceName = "体外抗凝"
505
+			break
506
+		case 11:
507
+			advice.AdviceName = "那曲肝素"
508
+			break
509
+		case 12:
510
+			advice.AdviceName = "无抗凝剂"
511
+			break
512
+		}
513
+		advice.AdviceDesc = "首剂" + strconv.FormatFloat(anticoagulant_shouji, 'f', -1, 64) + "维持" + strconv.FormatFloat(anticoagulant_weichi, 'f', -1, 64) + "总量" + strconv.FormatFloat(anticoagulant_zongliang, 'f', -1, 64)
514
+		if appRole.UserType == 2 || appRole.UserType == 1 {
515
+			advice.AdviceDoctor = appRole.AdminUserId
516
+		}
517
+
518
+		// 患者的临时医嘱里查找是否有抗凝剂临时医嘱
519
+		advicePrescription, _ := service.GetAdvicesByPrescription(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
520
+		if advicePrescription.ID > 0 {
521
+			// 修改患者临时医嘱里的抗凝剂医嘱
522
+			advice.ID = advicePrescription.ID
523
+			service.UpdateDoctorAdvice(&advice)
524
+		} else {
525
+			// 新增患者临时医嘱里的抗凝剂医嘱
526
+			service.CreateDoctorAdvice(&advice)
527
+		}
528
+	}
529
+
437 530
 	if appRole.UserType == 2 || appRole.UserType == 1 {
438 531
 		prescription.PrescriptionDoctor = appRole.AdminUserId
439 532
 	}