Kaynağa Gözat

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

张保健 1 yıl önce
ebeveyn
işleme
78161bed49

+ 94 - 3
controllers/dialysis_api_controller.go Dosyayı Görüntüle

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

+ 3 - 1
models/dialysis.go Dosyayı Görüntüle

@@ -347,7 +347,7 @@ func (PredialysisEvaluationList) TableName() string {
347 347
 	return "xt_assessment_before_dislysis"
348 348
 }
349 349
 
350
-//更改的地方
350
+// 更改的地方
351 351
 type DoctorAdvices struct {
352 352
 	ID                         int64           `gorm:"column:id" json:"id" form:"id"`
353 353
 	GroupNo                    int64           `gorm:"column:groupno" json:"groupno" form:"groupno"`
@@ -403,6 +403,7 @@ type DoctorAdvices struct {
403 403
 	DialysisDialyszers         string          `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
404 404
 	DialysisIrrigation         string          `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
405 405
 	PushStartTime              int64           `gorm:"column:push_start_time" json:"push_start_time" form:"push_start_time"`
406
+	IsPrescription             int64           `gorm:"column:is_prescription" json:"is_prescription" form:"is_prescription"`
406 407
 }
407 408
 
408 409
 type DoctorAdvice struct {
@@ -458,6 +459,7 @@ type DoctorAdvice struct {
458 459
 	IsMedicine            int64           `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
459 460
 	PushStartTime         int64           `gorm:"column:push_start_time" json:"push_start_time" form:"push_start_time"`
460 461
 	IsSettle              int64           `gorm:"column:is_settle" json:"is_settle" form:"is_settle"`
462
+	IsPrescription        int64           `gorm:"column:is_prescription" json:"is_prescription" form:"is_prescription"`
461 463
 }
462 464
 
463 465
 func (DoctorAdvice) TableName() string {

+ 5 - 1
service/inspection_service.go Dosyayı Görüntüle

@@ -29,11 +29,15 @@ func GetPatientInspectionByDate(orgId, patientId, date, projectId int64) (inspec
29 29
 }
30 30
 
31 31
 func GetAdvices(orgid int64, patientid int64, recorddate int64) (advcie []*models.DoctorAdvice, err error) {
32
-
33 32
 	err = XTReadDB().Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id = ? and record_date = ? and status =1", patientid, orgid, recorddate).Find(&advcie).Error
34 33
 	return
35 34
 }
36 35
 
36
+func GetAdvicesByPrescription(orgid int64, patientid int64, recorddate int64) (advcie *models.DoctorAdvice, err error) {
37
+	err = XTReadDB().Model(&models.DoctorAdvice{}).Where("patient_id = ? and user_org_id = ? and record_date = ? and status =1 and is_prescription = 1", patientid, orgid, recorddate).Find(&advcie).Error
38
+	return
39
+}
40
+
37 41
 func CreatePatientInspection(inspectins []models.Inspection) (err error) {
38 42
 	if len(inspectins) == 0 {
39 43
 		err = errors.New("Inspections Cant be nil.")