소스 검색

新功能

csx 4 년 전
부모
커밋
6060757242

+ 3 - 3
controllers/dialysis_api_controller.go 파일 보기

@@ -3303,7 +3303,7 @@ func (c *DialysisApiController) PostAssessmentBeforeDislysis() {
3303 3303
 		dewater_amount = 0
3304 3304
 		if evaluation.DryWeight > 0 {
3305 3305
 			dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3306
-			if templateInfo.TemplateId == 17 {
3306
+			if templateInfo.TemplateId == 17 && templateInfo.TemplateId == 22 {
3307 3307
 				dewater_amount = dewater_amount * 1000
3308 3308
 			}
3309 3309
 			if dewater_amount <= 0 {
@@ -4858,7 +4858,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
4858 4858
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
4859 4859
 
4860 4860
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4861
-			if template.TemplateId == 6 { //adminInfo.CurrentOrgId == 9538
4861
+			if template.TemplateId == 6 || template.TemplateId == 22 { //adminInfo.CurrentOrgId == 9538
4862 4862
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4863 4863
 				record.UltrafiltrationRate = ultrafiltration_rate
4864 4864
 			}
@@ -4885,7 +4885,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
4885 4885
 		}
4886 4886
 	}
4887 4887
 
4888
-	if template.TemplateId == 6 || template.TemplateId == 20 {
4888
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 {
4889 4889
 		if ultrafiltration_rate > 0 && adminInfo.CurrentOrgId != 9538 {
4890 4890
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4891 4891
 			record.UltrafiltrationVolume = ultrafiltration_volume

+ 4 - 1
controllers/dialysis_record_api_controller.go 파일 보기

@@ -741,9 +741,11 @@ func (this *DialysisRecordAPIController) StartDialysis() {
741 741
 						}
742 742
 						//查出入库记录中最后一条记录
743 743
 						stockInInfo, _ := service.FindLastStockInInfoRecord(prescription.Niprocart, adminUserInfo.CurrentOrgId)
744
+
744 745
 						warehouseOutInfo.Price = stockInInfo.Price
745 746
 						warehouseOutInfo.GoodId = prescription.Niprocart
746 747
 						warehouseOutInfo.GoodTypeId = niprocart
748
+
747 749
 						err := service.AddSigleWarehouseOutInfo(warehouseOutInfo)
748 750
 
749 751
 						if err == nil {
@@ -762,6 +764,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
762 764
 							service.AddSigleAutoReduceRecordInfo(details)
763 765
 						}
764 766
 					}
767
+
765 768
 					if prescription.Jms > 0 {
766 769
 						warehouseOutInfo := &models.WarehouseOutInfo{
767 770
 							WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
@@ -2155,7 +2158,7 @@ func (this *DialysisRecordAPIController) StartDialysis() {
2155 2158
 			if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2156 2159
 
2157 2160
 				totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2158
-				if template.TemplateId == 6 || template.TemplateId == 20 {
2161
+				if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 {
2159 2162
 					ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2160 2163
 				}
2161 2164
 				// 只针对方济医院

+ 8 - 5
controllers/mobile_api_controllers/dialysis_api_controller.go 파일 보기

@@ -111,6 +111,7 @@ func (this *DialysisAPIController) Scheduals() {
111 111
 	} else { //缓存数据了数据,将redis缓存的json字符串转为map
112 112
 
113 113
 		var dat []map[string]interface{}
114
+
114 115
 		if err := json.Unmarshal([]byte(scheduals_json_str), &dat); err == nil {
115 116
 
116 117
 		} else {
@@ -2746,7 +2747,7 @@ func (this *DialysisAPIController) StartDialysis() {
2746 2747
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
2747 2748
 
2748 2749
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
2749
-			if template.TemplateId == 6 { //adminUserInfo.Org.Id == 9538
2750
+			if template.TemplateId == 6 || template.TemplateId == 22 { //adminUserInfo.Org.Id == 9538
2750 2751
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
2751 2752
 			}
2752 2753
 
@@ -5593,15 +5594,18 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5593 5594
 	fristrecord, _ := service.FindFirstMonitorRecordToday(patientID, adminInfo.Org.Id, monitorDate)
5594 5595
 
5595 5596
 	template, _ := service.GetOrgInfoTemplate(adminInfo.Org.Id)
5596
-	fmt.Println("1122233333")
5597 5597
 
5598 5598
 	var ultrafiltration_rate float64
5599 5599
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, theAssessmentDateTime, adminInfo.Org.Id)
5600 5600
 	if prescription.ID > 0 {
5601
+		fmt.Println("444444444")
5602
+
5601 5603
 		if prescription.TargetUltrafiltration > 0 && prescription.DialysisDurationHour > 0 {
5604
+			fmt.Println("4444444445555")
5602 5605
 
5603 5606
 			totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5604
-			if template.TemplateId == 6 {
5607
+			if template.TemplateId == 6 || template.TemplateId == 22 {
5608
+				fmt.Println("12222222")
5605 5609
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
5606 5610
 				record.UltrafiltrationRate = ultrafiltration_rate
5607 5611
 			}
@@ -5628,9 +5632,8 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5628 5632
 		}
5629 5633
 	}
5630 5634
 
5631
-	if template.TemplateId == 6 || template.TemplateId == 20 { //adminInfo.Org.Id == 9538
5635
+	if template.TemplateId == 6 || template.TemplateId == 20 || template.TemplateId == 22 { //adminInfo.Org.Id == 9538
5632 5636
 		if ultrafiltration_rate > 0 && adminInfo.Org.Id != 9538 {
5633
-			fmt.Println("11222344444444443333")
5634 5637
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
5635 5638
 			record.UltrafiltrationVolume = ultrafiltration_volume
5636 5639
 		}

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

@@ -885,9 +885,12 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
885 885
 	dewater_amount = 0
886 886
 	if evaluation.DryWeight > 0 {
887 887
 		dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
888
-		if template.TemplateId == 17 {
888
+
889
+		if template.TemplateId == 17 || template.TemplateId == 22 {
889 890
 			dewater_amount = dewater_amount * 1000
891
+
890 892
 		}
893
+
891 894
 		if dewater_amount <= 0 {
892 895
 			dewater_amount = 0
893 896
 		}

+ 6 - 3
controllers/new_mobile_api_controllers/management_analyse_api_controller.go 파일 보기

@@ -82,10 +82,13 @@ func (this *ManagementAnalyseApiController) StatisticsPatientChart() {
82 82
 	data, total_one, _ := management_service.GetPatientChartData(adminUserInfo.Org.Id, startTime, endTime, statistics_type)
83 83
 	total, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, statistics_type)
84 84
 
85
+	total_three, _ := management_service.GetLapsetoPatientTotal(adminUserInfo.Org.Id, 2)
86
+
85 87
 	this.ServeSuccessJSON(map[string]interface{}{
86
-		"chart_data": data,
87
-		"total_one":  total_one,
88
-		"total":      total,
88
+		"chart_data":  data,
89
+		"total_one":   total_one,
90
+		"total":       total,
91
+		"total_three": total + total_three,
89 92
 	})
90 93
 
91 94
 }

+ 1 - 1
routers/router.go 파일 보기

@@ -35,7 +35,7 @@ func init() {
35 35
 	controllers.ScheduleApiRegistRouters()
36 36
 	controllers.SignWeighAPIControllerRegistRouters()
37 37
 	controllers.InvoiceApiRegistRouters()
38
-	controllers.StockApiRegistRouters()
38
+	//controllers.StockApiRegistRouters()
39 39
 	controllers.StockGoodApiRegistRouters()
40 40
 	controllers.StockManagerApiRegistRouters()
41 41
 	controllers.PatientScheduleTemplateAPIControllerRegistRouters()

+ 14 - 5
service/management_service/management_analyse_service.go 파일 보기

@@ -17,8 +17,8 @@ func GetPatientChartData(user_org_id int64, start_time int64, end_time int64, st
17 17
 		break
18 18
 	case 2:
19 19
 		//err = db.Raw("select from_unixtime(assessment_date,'%Y-%m-%d') as date, weight_after as value from xt_assessment_after_dislysis  Where status = 1 AND user_org_id = ? AND patient_id = ?  AND assessment_date <= ? AND  assessment_date >= ? ", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
20
-		//err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 2 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
21
-		err = db.Raw("select from_unixtime(created_time,'%m-%d') as date, count(distinct id) as value  from xt_patients patient   Where  patient.user_org_id = ? AND patient.created_time >=? AND patient.created_time <=? AND patient.status = 1   AND patient.lapseto = 2  Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
20
+		err = db.Raw("select from_unixtime(lapseto_time,'%m-%d') as date, count(distinct patient_id) as value  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = 2 AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?   Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
21
+		//err = db.Raw("select from_unixtime(updated_time,'%m-%d') as date, count(distinct id) as value  from xt_patients patient   Where  patient.user_org_id = ? AND patient.updated_time >=? AND patient.updated_time <=? AND patient.status = 1   AND patient.lapseto = 2  Group by date", user_org_id, start_time, end_time).Scan(&datas).Error
22 22
 
23 23
 		break
24 24
 	}
@@ -45,9 +45,18 @@ func GetPatientTableData(orgID int64, page, limit, start, end int64, statistics_
45 45
 	var err error
46 46
 	var patients []*PatientTableStruct
47 47
 	readDb := service.XTReadDB()
48
-	//db := readDb.Raw("select from_unixtime(lapseto.`lapseto_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = ? AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?  ", orgID, statistics_type, start, end)
49
-	db := readDb.Raw("select from_unixtime(patient.`created_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from `xt_patients` patient Where patient.user_org_id = ? AND patient.status = 1 AND patient.lapseto = ?  AND patient.created_time >= ? AND patient.created_time <= ?  ", orgID, statistics_type, start, end)
50
-	err = db.Order("patient.created_time desc").Scan(&patients).Error
48
+	if statistics_type == 1 {
49
+		db := readDb.Raw("select from_unixtime(patient.`created_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from `xt_patients` patient Where patient.user_org_id = ? AND patient.status = 1 AND patient.lapseto = ?  AND patient.created_time >= ? AND patient.created_time <= ?  ", orgID, statistics_type, start, end)
50
+		err = db.Order("patient.created_time desc").Scan(&patients).Error
51
+
52
+	} else {
53
+
54
+		db := readDb.Raw("select from_unixtime(lapseto.`lapseto_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from xt_patient_lapseto lapseto JOIN `xt_patients` patient ON lapseto.`patient_id` = patient.id AND patient.user_org_id = ? Where lapseto.status = 1 AND lapseto.lapseto_type = ? AND lapseto.lapseto_time >= ? AND lapseto.lapseto_time <= ?  ", orgID, statistics_type, start, end)
55
+		//db := readDb.Raw("select from_unixtime(patient.`updated_time`,'%Y-%m-%d %H:%m') as date , patient.name as name, patient.`id_card_no` as id_card_no, patient.`gender` as gender  from `xt_patients` patient Where patient.user_org_id = ? AND patient.status = 1 AND patient.lapseto = ?  AND patient.updated_time >= ? AND patient.updated_time <= ?  ", orgID, statistics_type, start, end)
56
+		err = db.Group("lapseto.`patient_id`").Order("lapseto.lapseto_time desc").Scan(&patients).Error
57
+
58
+	}
59
+
51 60
 	return patients, total, err
52 61
 }
53 62
 

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

@@ -1186,7 +1186,7 @@ func FindAllGoodTypeByType(types int64) (goodType []*models.GoodsType, err error
1186 1186
 }
1187 1187
 
1188 1188
 func FindWarehouseInfoByGoodType(good_type_id int64, org_id int64) (info []*models.WarehousingInfo, err error) {
1189
-	err = readDb.Model(&models.WarehousingInfo{}).Preload("GoodInfo", "status = 1 AND org_id = ?", org_id).Where("good_type_id = ? AND status = 1 AND org_id = ?", good_type_id, org_id).Find(&info).Error
1189
+	err = readDb.Model(&models.WarehousingInfo{}).Preload("GoodInfo", " org_id = ? AND good_type_id = ? AND status = 1", org_id, good_type_id).Where(" org_id = ? AND good_type_id = ?  AND status = 1 ", org_id, good_type_id).Find(&info).Error
1190 1190
 	return info, err
1191 1191
 
1192 1192
 }