Bladeren bron

历史排班

28169 1 jaar geleden
bovenliggende
commit
8a2faa88c3

BIN
XT_New.exe Bestand weergeven


+ 49 - 0
controllers/his_api_controller.go Bestand weergeven

@@ -100,6 +100,55 @@ func HisManagerApiRegistRouters() {
100 100
 
101 101
 	beego.Router("/api/batch/settleaccount", &HisApiController{}, "get:GetBatchSettleAccounts")
102 102
 
103
+	beego.Router("/api/monthhispatient", &HisApiController{}, "get:GetMonthHisPatient")
104
+
105
+}
106
+func (c *HisApiController) GetMonthHisPatient() {
107
+	record_date := c.GetString("record_date")
108
+	//order_status, _ := c.GetInt64("type")
109
+
110
+	timeLayout := "2006-01-02"
111
+	loc, _ := time.LoadLocation("Local")
112
+	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
113
+	if err != nil {
114
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
115
+		return
116
+	}
117
+	recordDateTime := theTime.Unix()
118
+	adminInfo := c.GetAdminUserInfo()
119
+	var tempPatients []service.NewTempPatients
120
+	//tempPatients, _ := service.GetAllChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime)
121
+	// 获取当前时间
122
+	now := time.Now()
123
+	// 获取本月的第一天
124
+	firstDay := time.Date(now.Year(), now.Month(), 1, 0, 0, 0, 0, now.Location())
125
+	// 获取下个月的第一天
126
+	nextMonth := firstDay.AddDate(0, 1, 0)
127
+	// 获取本月的最后一天
128
+	lastDay := nextMonth.Add(-time.Nanosecond)
129
+	tempPatients, _ = service.GetMonthNewAllUnChargeHisPatientList(adminInfo.CurrentOrgId, "", recordDateTime, firstDay.Unix(), lastDay.Unix())
130
+
131
+	chargePatients, _ := service.GetChargeHisPatientList(adminInfo.CurrentOrgId, recordDateTime)
132
+
133
+	var patients []service.NewTempPatients
134
+	var patients_two []service.NewTempPatients
135
+
136
+	for _, item := range tempPatients {
137
+		//过滤掉没挂号的和没开处方的
138
+		if len(item.HisPatient) > 0 && len(item.HisPrescription) > 0 {
139
+			patients = append(patients, item)
140
+		}
141
+		////过滤掉没挂号的
142
+		//if len(item.HisPatient) > 0 {
143
+		//	patients_two = append(patients_two, item)
144
+		//}
145
+	}
146
+	c.ServeSuccessJSON(map[string]interface{}{
147
+		"list":           patients,
148
+		"list_two":       patients_two,
149
+		"chargePatients": chargePatients,
150
+	})
151
+
103 152
 }
104 153
 
105 154
 func (c *HisApiController) GetBatchSettleAccounts() {

+ 6 - 4
controllers/mobile_api_controllers/dialysis_api_controller.go Bestand weergeven

@@ -3193,7 +3193,7 @@ func (this *DialysisAPIController) StartDialysis() {
3193 3193
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
3194 3194
 
3195 3195
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
3196
-			if (template.TemplateId == 6 || template.TemplateId == 32) && adminUserInfo.Org.Id != 9671 { //adminUserInfo.Org.Id == 9538
3196
+			if (template.TemplateId == 6 || template.TemplateId == 32 || template.TemplateId == 65) && adminUserInfo.Org.Id != 9671 { //adminUserInfo.Org.Id == 9538
3197 3197
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3198 3198
 			}
3199 3199
 
@@ -4123,13 +4123,15 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4123 4123
 
4124 4124
 	_, evaluation := service.FindPredialysisEvaluationByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
4125 4125
 	fmt.Println(evaluation)
4126
-
4126
+	fmt.Println("prescription.ID", prescription.ID)
4127 4127
 	if prescription.ID > 0 {
4128 4128
 
4129 4129
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4130 4130
 
4131 4131
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4132
-			if template.TemplateId == 6 && adminInfo.Org.Id != 9538 {
4132
+			fmt.Println("hahhdahahah", template.TemplateId)
4133
+			if (template.TemplateId == 6 || template.TemplateId == 65) && adminInfo.Org.Id != 9538 {
4134
+				fmt.Println("hahhdahahah")
4133 4135
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4134 4136
 				record.UltrafiltrationRate = ultrafiltration_rate
4135 4137
 
@@ -4205,7 +4207,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4205 4207
 		}
4206 4208
 	}
4207 4209
 
4208
-	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 { //adminInfo.Org.Id == 9538
4210
+	if template.TemplateId == 6 || template.TemplateId == 65 || template.TemplateId == 20 || template.TemplateId == 22 || template.TemplateId == 32 || template.TemplateId == 34 || template.TemplateId == 36 || template.TemplateId == 41 || template.TemplateId == 43 || template.TemplateId == 47 || template.TemplateId == 54 { //adminInfo.Org.Id == 9538
4209 4211
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
4210 4212
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4211 4213
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 25 - 0
service/his_service.go Bestand weergeven

@@ -2785,3 +2785,28 @@ func GetHisPrescriptionProjectByIDTwoone(id int64) (projects models.HisPrescript
2785 2785
 	err = readDb.Model(&models.HisPrescriptionProject{}).Preload("GoodInfo", "status = 1").Preload("HisProject", "status = 1").Where("id = ? AND status = 1", id).First(&projects).Error
2786 2786
 	return
2787 2787
 }
2788
+
2789
+func GetMonthNewAllUnChargeHisPatientList(org_id int64, keywords string, record_date int64, start_date int64, end_date int64) (patients []NewTempPatients, err error) {
2790
+	db := readDb.Model(&NewTempPatients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
2791
+	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
2792
+		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ?", org_id, record_date)
2793
+	})
2794
+	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1  AND p_type <> 1 AND order_status <> 2 AND order_status <> 3 and record_date >= ? and record_date <= ?", org_id, start_date, end_date)
2795
+	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Error
2796
+
2797
+	for _, item := range patients {
2798
+		for _, sumItem := range item.HisPatient {
2799
+			if len(sumItem.VMHisOrders) > 0 {
2800
+				sumItem.VMHisOrder.OrderStatus = sumItem.VMHisOrders[len(sumItem.VMHisOrders)-1].OrderStatus
2801
+			}
2802
+		}
2803
+
2804
+	}
2805
+
2806
+	return
2807
+}
2808
+
2809
+func GetChargeHisPatientList(org_id int64, record_date int64) (order []*HisOrder, err error) {
2810
+	err = readDb.Model(&models.HisOrder{}).Preload("Patients", "status = 1").Where("settle_accounts_date = ? and user_org_id = ? AND status = 1 and order_status = 2", record_date, org_id).Find(&order).Error
2811
+	return
2812
+}

+ 1 - 1
service/patient_service.go Bestand weergeven

@@ -1596,7 +1596,7 @@ func MobileGetMonitorsWithPatient(orgID int64, keyword string, page int) ([]*mod
1596 1596
 }
1597 1597
 
1598 1598
 func GetPatientByKeyWord(orgID int64, keywords string) (patient []*models.Patients, err error) {
1599
-	db := readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1", orgID)
1599
+	db := readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1 and lapseto = 1", orgID)
1600 1600
 	fmt.Println("keywords22222223322332322332322323323", keywords)
1601 1601
 	if len(keywords) > 0 {
1602 1602
 		likekey := "%" + keywords + "%"