XMLWAN преди 4 години
родител
ревизия
e69387d254

+ 33 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Целия файл

@@ -564,6 +564,7 @@ func (this *NewDialysisApiController) GetDoctorAdvices() {
564 564
 	adminInfo := this.GetMobileAdminUserInfo()
565 565
 	orgid := adminInfo.Org.Id
566 566
 	id, _ := this.GetInt64("id")
567
+	appid := adminInfo.App.Id
567 568
 	fmt.Print("id", id)
568 569
 	//跟据新表id获取老表id
569 570
 	newPatientInfo, _ := service.GetPatientDetailTwo(id)
@@ -587,9 +588,11 @@ func (this *NewDialysisApiController) GetDoctorAdvices() {
587 588
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
588 589
 		return
589 590
 	}
591
+	doctor, err := service.GetAllDoctorTwo(orgid, appid)
590 592
 	this.ServeSuccessJSON(map[string]interface{}{
591 593
 		"advice": advice,
592 594
 		"total":  total,
595
+		"doctor": doctor,
593 596
 	})
594 597
 }
595 598
 
@@ -1103,3 +1106,33 @@ func (this *NewDialysisApiController) GetDialysisrecord() {
1103 1106
 		"doctor":         doctor,
1104 1107
 	})
1105 1108
 }
1109
+
1110
+func (this *NewDialysisApiController) GetDoctorAdviceDetail() {
1111
+	adminUser := this.GetMobileAdminUserInfo()
1112
+	orgid := adminUser.Org.Id
1113
+	appid := adminUser.App.Id
1114
+	id, _ := this.GetInt64("id")
1115
+	doctorAdvicedetail, err := service.GetDoctorAdviceDetail(id, orgid)
1116
+	doctor, err := service.GetAllDoctorTwo(orgid, appid)
1117
+	if err != nil {
1118
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1119
+		return
1120
+	}
1121
+	this.ServeSuccessJSON(map[string]interface{}{
1122
+		"doctorAdvicedetail": doctorAdvicedetail,
1123
+		"doctor":             doctor,
1124
+	})
1125
+}
1126
+
1127
+func (this *NewDialysisApiController) DeleteManagement() {
1128
+	groupno, _ := this.GetInt64("id")
1129
+	fmt.Print("id是什么", groupno)
1130
+	orgId := this.GetMobileAdminUserInfo().Org.Id
1131
+	fmt.Print("机构ID", orgId)
1132
+	err := service.DeleteManagement(groupno, orgId)
1133
+	fmt.Println("错误是什么", err)
1134
+	returnData := make(map[string]interface{}, 0)
1135
+	returnData["msg"] = "ok"
1136
+	this.ServeSuccessJSON(returnData)
1137
+	return
1138
+}

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Целия файл

@@ -64,4 +64,6 @@ func NewMobileAPIControllersRegisterRouters() {
64 64
 	beego.Router("/m/api/patient/getlongdialysisdetail", &NewDialysisApiController{}, "Get:GetLongDialysisDetail")
65 65
 	beego.Router("/m/api/patient/deletelongdialysis", &NewDialysisApiController{}, "Delete:DeleteLongDialysis")
66 66
 	beego.Router("/m/api/patient/getdialysisrecord", &NewDialysisApiController{}, "Get:GetDialysisrecord")
67
+	beego.Router("/m/api/patient/getdoctoradvicedetail", &NewDialysisApiController{}, "Get:GetDoctorAdviceDetail")
68
+	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
67 69
 }

+ 1 - 0
models/dialysis.go Целия файл

@@ -336,6 +336,7 @@ type DoctorAdvices struct {
336 336
 	ChildDoctorAdvice     []*DoctorAdvice `gorm:"ForeignKey:ParentId;AssociationForeignKey:ID" json:"child"`
337 337
 	TemplateId            string          `gorm:"column:template_id" json:"template_id"`
338 338
 	UserName              string          `gorm:"column:user_name" json:"user_name" form:"user_name"`
339
+	Name                  string          `gorm:"column:name" json:"name" form:"name"`
339 340
 }
340 341
 
341 342
 type DoctorAdvice struct {

+ 14 - 0
service/patientmanage_service.go Целия файл

@@ -799,3 +799,17 @@ func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.App_Role, err
799 799
 	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = ? ", orgid, appid, 1).Find(&appRole).Error
800 800
 	return appRole, err
801 801
 }
802
+
803
+func GetDoctorAdviceDetail(id int64, orgid int64) (advices []*models.DoctorAdvices, err error) {
804
+
805
+	db := XTReadDB().Table("xt_doctor_advice as x")
806
+	err = db.Select("x.id,x.user_org_id,x.patient_id,x.advice_type,x.advice_date,x.start_time,x.advice_name,x.advice_desc,x.reminder_date,x.single_dose,x.single_dose_unit,x.prescribing_number,x.prescribing_number_unit,x.delivery_way,x.execution_frequency,x.advice_doctor,x.status,x.created_time,x.updated_time,x.advice_affirm,x.remark,x.stop_time,x.stop_reason,x.stop_doctor,x.stop_state,x.parent_id,x.execution_time,x.execution_staff,x.execution_state,x.checker,x.record_date,x.dialysis_order_id,x.check_time,x.check_state,x.drug_spec,x.drug_spec_unit,x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.template_id,x.modifier,s.name").Joins("left join xt_patients as s on s.id=x.patient_id").Where("x.groupno = ? and x.status = 1 and x.user_org_id = ?", id, orgid).Scan(&advices).Error
807
+
808
+	return advices, err
809
+}
810
+
811
+func DeleteManagement(groupid int64, orgid int64) error {
812
+
813
+	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("groupno=? and user_org_id = ?", groupid, orgid).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
814
+	return err
815
+}