Quellcode durchsuchen

时间选择更新

XMLWAN vor 4 Jahren
Ursprung
Commit
0b04f90bea

+ 26 - 1
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Datei anzeigen

@@ -1157,6 +1157,16 @@ func (this *NewDialysisApiController) DeleteManagement() {
1157 1157
 	return
1158 1158
 }
1159 1159
 
1160
+func (this *NewDialysisApiController) DeleteChild() {
1161
+	id, _ := this.GetInt64("id")
1162
+	err := service.DeleteChild(id)
1163
+	fmt.Println("错误是什么", err)
1164
+	returnData := make(map[string]interface{}, 0)
1165
+	returnData["msg"] = "ok"
1166
+	this.ServeSuccessJSON(returnData)
1167
+	return
1168
+}
1169
+
1160 1170
 func (this *NewDialysisApiController) UpdatedPatient() {
1161 1171
 
1162 1172
 	adminInfo := this.GetMobileAdminUserInfo()
@@ -1512,6 +1522,8 @@ func (this *NewDialysisApiController) GetInspection() {
1512 1522
 	fmt.Print("limit", limit)
1513 1523
 	page, _ := this.GetInt64("page")
1514 1524
 	fmt.Print("page", page)
1525
+	projectid, _ := this.GetInt64("projectid")
1526
+	fmt.Print("projectid", projectid)
1515 1527
 	adminInfo := this.GetMobileAdminUserInfo()
1516 1528
 	orgid := adminInfo.Org.Id
1517 1529
 	fmt.Print("patient", patient)
@@ -1522,7 +1534,7 @@ func (this *NewDialysisApiController) GetInspection() {
1522 1534
 	//if len(inspection) == 0 {
1523 1535
 	//
1524 1536
 	//}
1525
-	inspection, total, err := service.GetInspection(patient.BloodId, startime, endtime, limit, page, orgid)
1537
+	inspection, total, err := service.GetInspection(patient.BloodId, startime, endtime, limit, page, orgid, projectid)
1526 1538
 	if err != nil {
1527 1539
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1528 1540
 		return
@@ -1615,3 +1627,16 @@ func (this *NewDialysisApiController) SaveFeed() {
1615 1627
 		"feedback": feedback,
1616 1628
 	})
1617 1629
 }
1630
+
1631
+func (this *NewDialysisApiController) DeleteInspection() {
1632
+	admininfo := this.GetMobileAdminUserInfo()
1633
+	orgid := admininfo.Org.Id
1634
+	date, _ := this.GetInt64("date")
1635
+	fmt.Println("date", date)
1636
+	err := service.DeleteInspection(date, orgid)
1637
+	fmt.Println("删除失败", err)
1638
+	returnData := make(map[string]interface{}, 0)
1639
+	returnData["msg"] = "手机号码已存在"
1640
+	this.ServeSuccessJSON(returnData)
1641
+	return
1642
+}

+ 2 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Datei anzeigen

@@ -94,4 +94,6 @@ func NewMobileAPIControllersRegisterRouters() {
94 94
 	beego.Router("/m/api/patient/getpatientname", &NewDialysisApiController{}, "Get:GetPatientName")
95 95
 	beego.Router("/m/api/patient/getinspectiondetail", &NewDialysisApiController{}, "Get:GetInspectionDetail")
96 96
 	beego.Router("/m/api/patient/savefeed", &NewDialysisApiController{}, "Get:SaveFeed")
97
+	beego.Router("/m/api/patient/deletechild", &NewDialysisApiController{}, "Delete:DeleteChild")
98
+	beego.Router("/m/api/patient/deleteinspection", &NewDialysisApiController{}, "Delete:DeleteInspection")
97 99
 }

+ 19 - 24
service/patientmanage_service.go Datei anzeigen

@@ -491,8 +491,8 @@ func GetNewDoctorAdvice(patientID int64, advice_type int64, start int64, end int
491 491
 	if end > 0 {
492 492
 		db = db.Where("start_time<=?", end)
493 493
 	}
494
-	offset := (page - 1) * limit
495
-	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, 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.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Offset(offset).Limit(limit).Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&doctoradvice).Error
494
+	//offset := (page - 1) * limit
495
+	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, 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.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&doctoradvice).Error
496 496
 	fmt.Print("err", err)
497 497
 	return
498 498
 
@@ -848,7 +848,7 @@ func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.SgjUserAdminRo
848 848
 func GetDoctorAdviceDetail(id int64, orgid int64) (advices []*models.DoctorAdvices, err error) {
849 849
 
850 850
 	db := XTReadDB().Table("xt_doctor_advice as x")
851
-	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
851
+	err = db.Order("x.id desc").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
852 852
 
853 853
 	return advices, err
854 854
 }
@@ -859,6 +859,12 @@ func DeleteManagement(groupid int64, orgid int64) error {
859 859
 	return err
860 860
 }
861 861
 
862
+func DeleteChild(id int64) error {
863
+
864
+	err := XTWriteDB().Model(models.DoctorAdvice{}).Where("id=?", id).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
865
+	return err
866
+}
867
+
862 868
 func GetNewPatient(id int64) (models.XtPatientsNew, error) {
863 869
 	patientsNew := models.XtPatientsNew{}
864 870
 	err := XTReadDB().Model(&patientsNew).Where("id=?", id).Find(&patientsNew).Error
@@ -910,33 +916,13 @@ func GetInspectionByOrgId(orgid int64) (*models.XtInspectionReference, error) {
910 916
 
911 917
 }
912 918
 
913
-//func GetInspectionById(patientid int64,startime int64,endtime int64,orgId int64)(inspection []*models.XtInspectionReference,err error)  {
914
-//
915
-//  db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
916
-//  if patientid > 0 {
917
-//    db = db.Where("x.patient_id = ?", patientid)
918
-//  }
919
-//  if startime > 0 {
920
-//    db = db.Where("x.inspect_date >= ?", startime)
921
-//  }
922
-//  if endtime > 0 {
923
-//    db = db.Where("x.inspect_date<=?", endtime)
924
-//  }
925
-//  if orgId > 0 {
926
-//    db = db.Where("x.org_id = ?", orgId)
927
-//  }
928
-//  err = db.Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,x.created_time").Find(inspection).Error
929
-//
930
-//  return inspection,err
931
-//}
932
-
933 919
 func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
934 920
 
935 921
 	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
936 922
 	return inspection, err
937 923
 }
938 924
 
939
-func GetInspection(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (inspection []*models.Inspection, total int64, err error) {
925
+func GetInspection(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64, projectid int64) (inspection []*models.Inspection, total int64, err error) {
940 926
 
941 927
 	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
942 928
 	if patientid > 0 {
@@ -951,6 +937,9 @@ func GetInspection(patientid int64, startime int64, endtime int64, limit int64,
951 937
 	if orgid > 0 {
952 938
 		db = db.Where("x.org_id = ?", orgid)
953 939
 	}
940
+	if projectid > 0 {
941
+		db = db.Where("x.project_id = ?", projectid)
942
+	}
954 943
 	err = db.Count(&total).Order("x.inspect_date desc").Group("x.id").
955 944
 		Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,x.created_time").Find(&inspection).Error
956 945
 	return inspection, total, err
@@ -984,3 +973,9 @@ func CreateFeedBack(feedback *models.XtPatientFeedback) error {
984 973
 	err := XTWriteDB().Model(&feedback).Create(&feedback).Error
985 974
 	return err
986 975
 }
976
+
977
+func DeleteInspection(date int64, orgid int64) error {
978
+
979
+	err := XTWriteDB().Model(models.Inspection{}).Where("inspect_date = ? and org_id = ?", date, orgid).Update(map[string]interface{}{"status": 0, "updated_time": time.Now().Unix()}).Error
980
+	return err
981
+}