소스 검색

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

csx 4 년 전
부모
커밋
6ab02f6499

+ 76 - 52
controllers/mobile_api_controllers/check_weight_api_controller.go 파일 보기

@@ -562,17 +562,17 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
562 562
 			}
563 563
 		}
564 564
 
565
-		if dialysisPrescribe != nil {
566
-			dialysisPrescribe.UpdatedTime = time.Now().Unix()
567
-			dialysisPrescribe.RecordDate = theAssessmentDateTime
568
-			dialysisPrescribe.DewaterAmount = dewater_amount
569
-			dialysisPrescribe.TargetUltrafiltration = dewater_amount
570
-			dialysisPrescribe.Status = 1
571
-			updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
572
-			if updateErr != nil {
573
-				c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
574
-			}
575
-		}
565
+		// if dialysisPrescribe != nil {
566
+		// 	dialysisPrescribe.UpdatedTime = time.Now().Unix()
567
+		// 	dialysisPrescribe.RecordDate = theAssessmentDateTime
568
+		// 	dialysisPrescribe.DewaterAmount = dewater_amount
569
+		// 	dialysisPrescribe.TargetUltrafiltration = dewater_amount
570
+		// 	dialysisPrescribe.Status = 1
571
+		// 	updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
572
+		// 	if updateErr != nil {
573
+		// 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
574
+		// 	}
575
+		// }
576 576
 
577 577
 		theEvaluation, getPEErr := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, theAssessmentDateTime)
578 578
 		if getPEErr != nil {
@@ -745,41 +745,64 @@ func (c *CheckWeightApiController) GetPatientListForSchedules() {
745 745
 	})
746 746
 }
747 747
 
748
-//func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
749
-//	patient_name := c.GetString("patient_name")                   //脉率
750
-//	thisTime := time.Now()
751
-//	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
752
-//	timeLayout := "2006-01-02 15:04:05"
753
-//	loc, _ := time.LoadLocation("Local")
754
-//	theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
755
-//	syncTime := theStartTime.Unix()
756
-//	adminUserInfo := c.GetMobileAdminUserInfo()
757
-//	if len(patient_name) == 0 {
758
-//		patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
759
-//	} else {
760
-//		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
761
-//	}
762
-//	patientSchedule := make([]map[string]interface{},0)
763
-//	for _, item := range patientList {
764
-//		patientTemp := make(map[string]interface{})
765
-//		patientTemp["patient_id"] = item.PatientId
766
-//		patientTemp["patient_name"] = item.Patient.Name
767
-//		patientTemp["schedule_type"] = item.ScheduleType
768
-//		patientSchedule = append(patientSchedule, patientTemp)
769
-//	}
770
-//
771
-//	if error != nil {
772
-//		c.ErrorLog("获取病人列表失败:%v", error)
773
-//		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
774
-//		return
775
-//	}
776
-//	serviceTime := time.Now().Unix()
777
-//	c.ServeSuccessJSON(map[string]interface{}{
778
-//		"patientlist": patientSchedule,
779
-//		"total":       total,
780
-//		"servicetime": serviceTime,
781
-//	})
782
-//}
748
+func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
749
+	patient_name := c.GetString("patient_name")                   //脉率
750
+	thisTime := time.Now()
751
+	scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
752
+	timeLayout := "2006-01-02 15:04:05"
753
+	loc, _ := time.LoadLocation("Local")
754
+	theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
755
+	syncTime := theStartTime.Unix()
756
+	adminUserInfo := c.GetMobileAdminUserInfo()
757
+	if len(patient_name) == 0 {
758
+		patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
759
+		patientSchedule := make([]map[string]interface{}, 0)
760
+		for _, item := range patientList {
761
+			patientTemp := make(map[string]interface{})
762
+			patientTemp["patient_id"] = item.PatientId
763
+			patientTemp["patient_name"] = item.Patient.Name
764
+			patientTemp["schedule_type"] = item.ScheduleType
765
+			patientSchedule = append(patientSchedule, patientTemp)
766
+		}
767
+
768
+		if error != nil {
769
+			c.ErrorLog("获取病人列表失败:%v", error)
770
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
771
+			return
772
+		}
773
+		serviceTime := time.Now().Unix()
774
+		c.ServeSuccessJSON(map[string]interface{}{
775
+			"patientlist": patientSchedule,
776
+			"total":       total,
777
+			"servicetime": serviceTime,
778
+		})
779
+	} else {
780
+		patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime,patient_name)
781
+		patientSchedule := make([]map[string]interface{},0)
782
+		for _, item := range patientList {
783
+			if item.Patient.ID > 0 {
784
+				patientTemp := make(map[string]interface{})
785
+				patientTemp["patient_id"] = item.PatientId
786
+				patientTemp["patient_name"] = item.Patient.Name
787
+				patientTemp["schedule_type"] = item.ScheduleType
788
+				patientSchedule = append(patientSchedule, patientTemp)
789
+			}
790
+		}
791
+
792
+		if error != nil {
793
+			c.ErrorLog("获取病人列表失败:%v", error)
794
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
795
+			return
796
+		}
797
+
798
+		serviceTime := time.Now().Unix()
799
+		c.ServeSuccessJSON(map[string]interface{}{
800
+			"patientlist": patientSchedule,
801
+			"total":       total,
802
+			"servicetime": serviceTime,
803
+		})
804
+	}
805
+}
783 806
 
784 807
 func (c *CheckWeightApiController) GetPatientListById() {
785 808
 	patientId, _ := c.GetInt64("patient_id", 0)
@@ -799,6 +822,7 @@ func (c *CheckWeightApiController) GetPatientListById() {
799 822
 		"patientinfo": patient,
800 823
 	})
801 824
 }
825
+
802 826
 func (c *CheckWeightApiController) GetPatientInfoDialysis() {
803 827
 	id, _ := c.GetInt64("patient", 0)
804 828
 	if id <= 0 {
@@ -865,12 +889,12 @@ func (c *CheckWeightApiController) GetPatientInfoDialysis() {
865 889
 		}
866 890
 
867 891
 		// 排队叫号的签到
868
-		ssoDomain := beego.AppConfig.String("call_domain")
869
-		api := ssoDomain + "/index/patientsign/" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + "/" + strconv.FormatInt(id, 10)
870
-		values := make(url.Values)
871
-
872
-		http.PostForm(api, values)
873
-
892
+		go func (){
893
+			ssoDomain := beego.AppConfig.String("call_domain")
894
+			api := ssoDomain + "/index/patientsign/" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + "/" + strconv.FormatInt(id, 10)
895
+			values := make(url.Values)
896
+			http.PostForm(api, values)
897
+		} ()
874 898
 	} else {
875 899
 		nextSchedule, _ := service.GetNextSchedule(adminUserInfo.Org.Id, endTime, id)
876 900
 		if len(nextSchedule) <= 0 {

+ 1 - 0
controllers/mobile_api_controllers/dialysis_api_controller_extend.go 파일 보기

@@ -80,6 +80,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
80 80
 	replacementRate, _ := this.GetFloat("replacement_rate")
81 81
 	displacementQuantity, _ := this.GetFloat("displacement_quantity")
82 82
 	ktv, _ := this.GetFloat("ktv")
83
+	fmt.Println("ktv -------------------", ktv)
83 84
 	symptom := this.GetString("symptom")
84 85
 	dispose := this.GetString("dispose")
85 86
 	conductivity, _ := this.GetFloat("conductivity")

+ 1 - 1
controllers/mobile_api_controllers/mobile_api_router_register.go 파일 보기

@@ -13,7 +13,7 @@ func MobileAPIControllersRegisterRouters() {
13 13
 	beego.Router("/m/api/checkbeforedialysis", &CheckWeightApiController{}, "get:GetPatientInfoBeforeDialysis")
14 14
 	beego.Router("/m/api/getpatientlist", &CheckWeightApiController{}, "get:GetPatientList")
15 15
 	beego.Router("/m/api/getschedulepatient", &CheckWeightApiController{}, "get:GetPatientListForSchedules")
16
-	//beego.Router("/m/api/getschedulepatientfind", &CheckWeightApiController{}, "get:GetPatientListForSchedulesFind")
16
+	beego.Router("/m/api/getschedulepatientfind", &CheckWeightApiController{}, "get:GetPatientListForSchedulesFind")
17 17
 	beego.Router("/m/api/getpatientinfo", &CheckWeightApiController{}, "get:GetPatientListById")
18 18
 	beego.Router("/m/api/checkdialysis", &CheckWeightApiController{}, "get:GetPatientInfoDialysis")
19 19
 	beego.Router("/m/api/savecheckdialysis", &CheckWeightApiController{}, "Post:SavePatientInfoDialysis")

+ 2 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go 파일 보기

@@ -841,6 +841,8 @@ func (this *NewDialysisApiController) GetlongDialysisrecord() {
841 841
 	adminInfo := this.GetMobileAdminUserInfo()
842 842
 	orgid := adminInfo.Org.Id
843 843
 	dialysisrecord, total, err := service.GetlongDialysisrecord(patient.BloodId, startime, endtime, limit, page, orgid)
844
+	//获取当日患者的透后实际超滤量
845
+	//afterRecord, err := service.GetDialysAfterRecord(patient.BloodId, startime, endtime, orgid)
844 846
 	if err != nil {
845 847
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
846 848
 		return

+ 1 - 1
service/patient_service.go 파일 보기

@@ -96,7 +96,7 @@ func GetPatientListBySchedules(orgID int64, syncTime int64) (patients []*models.
96 96
 }
97 97
 
98 98
 func GetPatientListBySchedulesFind(orgID int64, syncTime int64, patient_name string) (patients []*models.SchedulePatients, total int64, err error) {
99
-	db := readDb.Model(&models.SchedulePatients{}).Where("user_org_id=?  AND  status=1  AND  schedule_date = ?", orgID, syncTime).Preload("Patient", "status = 1 AND user_org_id = ? and name like '%?%' ", orgID, patient_name)
99
+	db := readDb.Model(&models.SchedulePatients{}).Where("user_org_id=?  AND  status=1  AND  schedule_date = ?", orgID, syncTime).Preload("Patient", "status = 1 AND user_org_id = ? and name like ? ", orgID, "%"+patient_name+"%")
100 100
 	err = db.Count(&total).Find(&patients).Error
101 101
 	return
102 102
 }

+ 20 - 0
service/patientmanage_service.go 파일 보기

@@ -1445,3 +1445,23 @@ func AddPatientLapseto(lapseto *models.PatientLapseto) error {
1445 1445
 	err := XTWriteDB().Create(&lapseto).Error
1446 1446
 	return err
1447 1447
 }
1448
+
1449
+func GetDialysAfterRecord(patientid int64, startime int64, endtime int64, orgid int64) (dislysis []*models.XtAssessmentAfterDislysis, err error) {
1450
+
1451
+	db := XTReadDB().Model(&dislysis)
1452
+	if startime > 0 {
1453
+		db = db.Where("assessment_date >= ?", startime)
1454
+	}
1455
+	if endtime > 0 {
1456
+		db = db.Where("assessment_date <= ?", endtime)
1457
+	}
1458
+	if patientid > 0 {
1459
+		db = db.Where("patient_id = ?", patientid)
1460
+	}
1461
+	if orgid > 0 {
1462
+		db = db.Where("user_org_id = ?", orgid)
1463
+	}
1464
+	err = db.Find(dislysis).Error
1465
+
1466
+	return dislysis, err
1467
+}