28169 3 veckor sedan
förälder
incheckning
43531d6f1a

Binär
XT_New.exe Visa fil


+ 6 - 6
controllers/base_api_controller.go Visa fil

@@ -82,7 +82,7 @@ func (this *BaseAuthAPIController) Prepare() {
82 82
 		userAdmin.ModifyTime = 1530786071
83 83
 		var subscibe models.ServeSubscibe
84 84
 		subscibe.ID = 11
85
-		subscibe.OrgId = 10278 //机构id 10344
85
+		subscibe.OrgId = 10164 //机构id 10344
86 86
 		subscibe.PeriodStart = 1547447814
87 87
 		subscibe.PeriodEnd = 1550039814
88 88
 		subscibe.State = 1
@@ -92,8 +92,8 @@ func (this *BaseAuthAPIController) Prepare() {
92 92
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93 93
 		subscibes[4] = &subscibe
94 94
 		var adminUserInfo service.AdminUserInfo
95
-		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
96
-		adminUserInfo.CurrentAppId = 3467  //4
95
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
96
+		adminUserInfo.CurrentAppId = 12123 //4
97 97
 		adminUserInfo.AdminUser = &userAdmin
98 98
 		adminUserInfo.Subscibes = subscibes
99 99
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -327,7 +327,7 @@ func (this *BaseServeAPIController) Prepare() {
327 327
 		userAdmin.ModifyTime = 1530786071
328 328
 		var subscibe models.ServeSubscibe
329 329
 		subscibe.ID = 11
330
-		subscibe.OrgId = 10278 //机构id小英10344或4
330
+		subscibe.OrgId = 10164 //机构id小英10344或4
331 331
 		subscibe.PeriodStart = 1538035409
332 332
 		subscibe.PeriodEnd = 1569571409
333 333
 		subscibe.State = 1
@@ -337,8 +337,8 @@ func (this *BaseServeAPIController) Prepare() {
337 337
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338 338
 		subscibes[4] = &subscibe
339 339
 		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 10278 //机构id小英9675或4
341
-		adminUserInfo.CurrentAppId = 3467  //4
340
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
341
+		adminUserInfo.CurrentAppId = 12123 //4
342 342
 		adminUserInfo.AdminUser = &userAdmin
343 343
 		adminUserInfo.Subscibes = subscibes
344 344
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 22 - 4
controllers/dialysis_api_controller.go Visa fil

@@ -1,17 +1,18 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/service"
6
-	"XT_New/utils"
7 4
 	"encoding/json"
8 5
 	"fmt"
9
-	"github.com/jinzhu/gorm"
10 6
 	"math"
11 7
 	"reflect"
12 8
 	"strconv"
13 9
 	"strings"
14 10
 
11
+	"XT_New/models"
12
+	"XT_New/service"
13
+	"XT_New/utils"
14
+	"github.com/jinzhu/gorm"
15
+
15 16
 	//"strings"
16 17
 	"time"
17 18
 
@@ -143,6 +144,8 @@ func DialysisApiRegistRouters() {
143 144
 	beego.Router("/api/patient/getdialysisgatherlist", &DialysisApiController{}, "Get:GetDialysisGatherList")
144 145
 
145 146
 	beego.Router("/api/getpatientdialysisrecordlist", &DialysisApiController{}, "Get:GetPatientDialysisRecordList")
147
+
148
+	beego.Router("/api/patient/getpatientrecordlist", &DialysisApiController{}, "Get:GetPatientRecordList")
146 149
 }
147 150
 
148 151
 func (c *DialysisApiController) GetQueueCall() {
@@ -2152,6 +2155,7 @@ func (c *DialysisApiController) PostAssessmentAfterDislysis() {
2152 2155
 	assessment.TransfusionVolume = data.TransfusionVolume
2153 2156
 	assessment.Condenser = data.Condenser
2154 2157
 	assessment.LastAfterWeight = data.LastAfterWeight
2158
+	assessment.DisplaceLiquiValue = data.DisplaceLiquiValue
2155 2159
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
2156 2160
 
2157 2161
 	if assessment.ID > 0 {
@@ -7677,3 +7681,17 @@ func (this *DialysisApiController) GetPatientDialysisRecordList() {
7677 7681
 
7678 7682
 	return
7679 7683
 }
7684
+
7685
+func (this *DialysisApiController) GetPatientRecordList() {
7686
+
7687
+	patient_id, _ := this.GetInt64("patient_id")
7688
+	orgId := this.GetAdminUserInfo().CurrentOrgId
7689
+	beforList, _ := service.GetPatientBeforRecordList(patient_id, orgId)
7690
+	afterList, _ := service.GetPatientAfterRecordList(patient_id, orgId)
7691
+
7692
+	this.ServeSuccessJSON(map[string]interface{}{
7693
+		"beforList": beforList,
7694
+		"afterList": afterList,
7695
+	})
7696
+
7697
+}

+ 23 - 1
controllers/his_api_controller.go Visa fil

@@ -17,6 +17,7 @@ import (
17 17
 	"XT_New/utils"
18 18
 	"github.com/astaxie/beego"
19 19
 	"github.com/jinzhu/gorm"
20
+	"github.com/mozillazg/go-pinyin"
20 21
 	"github.com/shopspring/decimal"
21 22
 )
22 23
 
@@ -3101,7 +3102,7 @@ func (c *HisApiController) CreateHisPrescription() {
3101 3102
 	var adviceList []models.HisDoctorAdviceInfo
3102 3103
 	var projectList []models.HisPrescriptionProject
3103 3104
 
3104
-	if adminInfo.CurrentOrgId == 10489 {
3105
+	if adminInfo.CurrentOrgId == 10489 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 10164 {
3105 3106
 		if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
3106 3107
 			prescriptions, _ := dataBody["prescriptions"].([]interface{})
3107 3108
 
@@ -11529,6 +11530,26 @@ func (c *HisApiController) PostProjectInformation() {
11529 11530
 	errLogs, _ := service.FindPatientExportLog(c.GetAdminUserInfo().CurrentOrgId, export_time)
11530 11531
 	if len(projectList) > 0 {
11531 11532
 		for _, item := range projectList {
11533
+
11534
+			hans := item.ProjectName // 要转换的汉字字符串
11535
+			// 创建一个拼音转换器
11536
+			p := pinyin.NewArgs()
11537
+
11538
+			// 将汉字转为拼音
11539
+			pinyinSlice := pinyin.Pinyin(hans, p)
11540
+
11541
+			// 输出拼音
11542
+			fmt.Println("Pinyin:", pinyinSlice)
11543
+
11544
+			// 获取首字母
11545
+			firstLetter := ""
11546
+			for _, py := range pinyinSlice {
11547
+				if len(py) > 0 {
11548
+					firstLetter += string(py[0][0])
11549
+				}
11550
+			}
11551
+
11552
+			item.FirstLetter = firstLetter
11532 11553
 			project := models.HisProject{
11533 11554
 				ProjectName:                 item.ProjectName,
11534 11555
 				Price:                       item.Price,
@@ -11557,6 +11578,7 @@ func (c *HisApiController) PostProjectInformation() {
11557 11578
 				Remark:                      item.Remark,
11558 11579
 				SocialSecurityDirectoryCode: item.SocialSecurityDirectoryCode,
11559 11580
 				ExecutionFrequency:          item.ExecutionFrequency,
11581
+				FirstLetter:                 item.FirstLetter,
11560 11582
 			}
11561 11583
 
11562 11584
 			_, errcodeproject := service.GetProjectByNameIsExsit(item.ProjectName, orgId)

+ 17 - 8
controllers/mobile_api_controllers/dialysis_api_controller.go Visa fil

@@ -1399,6 +1399,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1399 1399
 	accumulated_blood_volume := c.GetString("accumulated_blood_volume")
1400 1400
 	transfusion_volume := c.GetString("transfusion_volume")
1401 1401
 	last_after_weight := c.GetString("last_after_weight")
1402
+	displace_liqui_value := c.GetString("displace_liqui_value")
1402 1403
 	if id <= 0 {
1403 1404
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1404 1405
 		return
@@ -1508,6 +1509,7 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1508 1509
 		AccumulatedBloodVolume:       accumulated_blood_volume,
1509 1510
 		TransfusionVolume:            transfusion_volume,
1510 1511
 		LastAfterWeight:              last_after_weight,
1512
+		DisplaceLiquiValue:           displace_liqui_value,
1511 1513
 	}
1512 1514
 
1513 1515
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.Org.Id, adminUserInfo.AdminUser.Id, adminUserInfo.App.Id)
@@ -1642,8 +1644,10 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1642 1644
 		assessmentAfterDislysis.ID = assessmentAfter.ID
1643 1645
 		recordDialysis, _ := service.GetSigleAssessmentAfterDislysisRecord(assessmentAfterDislysis.PatientId, assessmentAfter.AssessmentDate, assessmentAfter.UserOrgId)
1644 1646
 
1645
-		if assessmentAfterDislysis.WeightAfter == 0 {
1646
-			assessmentAfterDislysis.WeightAfter = recordDialysis.WeightAfter
1647
+		if assessmentAfterDislysis.UserOrgId != 10340 {
1648
+			if assessmentAfterDislysis.WeightAfter == 0 {
1649
+				assessmentAfterDislysis.WeightAfter = recordDialysis.WeightAfter
1650
+			}
1647 1651
 		}
1648 1652
 		err := service.UpdateAssessmentAfterDislysisRecord(&assessmentAfterDislysis)
1649 1653
 
@@ -3381,9 +3385,9 @@ func (this *DialysisAPIController) StartDialysis() {
3381 3385
 		tempdispose = "引血" + strconv.FormatInt(blood_drawing, 10) + "ml/min"
3382 3386
 	}
3383 3387
 
3384
-	if blood_drawing > 0 && adminUserInfo.Org.Id == 10629 {
3385
-		tempdispose = "引血" + strconv.FormatInt(blood_drawing, 10) + "ml/min"
3386
-	}
3388
+	//if blood_drawing > 0 && adminUserInfo.Org.Id == 10629 {
3389
+	//	tempdispose = "引血" + strconv.FormatInt(blood_drawing, 10) + "ml/min"
3390
+	//}
3387 3391
 
3388 3392
 	var ultrafiltration_rate float64
3389 3393
 	_, prescription := service.FindDialysisPrescriptionByReordDate(patientID, schedulestartTime, adminUserInfo.Org.Id)
@@ -3466,6 +3470,11 @@ func (this *DialysisAPIController) StartDialysis() {
3466 3470
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3467 3471
 			}
3468 3472
 
3473
+			if adminUserInfo.Org.Id == 10644 {
3474
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
3475
+				ultrafiltration_rate = ultrafiltration_rate / 1000
3476
+			}
3477
+
3469 3478
 		}
3470 3479
 	}
3471 3480
 
@@ -4495,7 +4504,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4495 4504
 
4496 4505
 			}
4497 4506
 
4498
-			if adminInfo.Org.Id == 10460 {
4507
+			if adminInfo.Org.Id == 10460 || adminInfo.Org.Id == 10644 {
4499 4508
 
4500 4509
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration / float64(totalMin) * 60 * 1000)
4501 4510
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
@@ -4559,7 +4568,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
4559 4568
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
4560 4569
 	}
4561 4570
 
4562
-	if adminInfo.Org.Id == 10460 {
4571
+	if adminInfo.Org.Id == 10460 || adminInfo.Org.Id == 10644 {
4563 4572
 
4564 4573
 		ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
4565 4574
 
@@ -9670,7 +9679,7 @@ func (this *DialysisAPIController) ExectionMobileAdvice() {
9670 9679
 			}
9671 9680
 
9672 9681
 			creater := this.GetMobileAdminUserInfo().AdminUser.Id
9673
-			fmt.Println("creater2332243244224242424", creater)
9682
+
9674 9683
 			//执行医嘱
9675 9684
 			errs := service.ExectionBloodMobileAdvice(orgId, idSplit, theTime.Unix(), creater)
9676 9685
 			advices, _ := service.FindAllDoctorAdviceByIds(orgId, idSplit)

+ 26 - 16
controllers/mobile_api_controllers/patient_api_controller.go Visa fil

@@ -1665,23 +1665,25 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1665 1665
 					}
1666 1666
 				}
1667 1667
 
1668
+				//fmt.Println("config+++++++++++", config.IsOpen)
1669
+				//fmt.Println("config+++++++++++", item.UserOrgId)
1668 1670
 				//
1669
-				if config.IsOpen == 1 && item.UserOrgId == 10188 {
1670
-
1671
-					service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1672
-					//更新字典里面的库存
1673
-					stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1674
-					var sum_count int64
1675
-					for _, its := range stockInfo {
1676
-						if its.MaxUnit == medical.MaxUnit {
1677
-							its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1678
-						}
1679
-						sum_count += its.StockMaxNumber + its.StockMinNumber
1680
-					}
1681
-					service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1682
-					//剩余库存
1683
-					service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1684
-				}
1671
+				//if config.IsOpen == 1 && item.UserOrgId == 10210 {
1672
+				//
1673
+				//	service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1674
+				//	//更新字典里面的库存
1675
+				//	stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, item.UserOrgId, item.DrugId)
1676
+				//	var sum_count int64
1677
+				//	for _, its := range stockInfo {
1678
+				//		if its.MaxUnit == medical.MaxUnit {
1679
+				//			its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
1680
+				//		}
1681
+				//		sum_count += its.StockMaxNumber + its.StockMinNumber
1682
+				//	}
1683
+				//	service.UpdateBaseDrugSumTwo(item.DrugId, sum_count, item.UserOrgId)
1684
+				//	//剩余库存
1685
+				//	service.UpdateDrugStockCount(item.DrugId, item.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1686
+				//}
1685 1687
 
1686 1688
 			}
1687 1689
 		}
@@ -3278,6 +3280,14 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
3278 3280
 
3279 3281
 		}
3280 3282
 	}
3283
+	//针对长沙南雅的问题
3284
+	if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10164 {
3285
+		if len(evaluation.SymptomBeforeDialysis) == 0 {
3286
+			predialysisEvaluation, _ := service.GetPredialysisEvaluation(id, adminUserInfo.Org.Id)
3287
+			evaluation.SymptomBeforeDialysis = predialysisEvaluation.SymptomBeforeDialysis
3288
+		}
3289
+
3290
+	}
3281 3291
 
3282 3292
 	err = service.UpadatePredialysisEvaluation(&evaluation)
3283 3293
 

+ 18 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Visa fil

@@ -429,7 +429,7 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
429 429
 	}
430 430
 
431 431
 	//查询排班里面的空透析器
432
-	if orgid == 10375 {
432
+	if orgid == 10375 || orgid == 10510 || orgid == 9538 {
433 433
 
434 434
 		schedulesFive, _ := service.GetMobileScheduleListByScheduleDateOne(orgid, startTime)
435 435
 
@@ -451,6 +451,23 @@ func (this *StaffScheduleApiController) GetAllZonePb() {
451 451
 				service.UpdateSchOne(item.ID, item.DialysisMachineName)
452 452
 			}
453 453
 
454
+			if item.ScheduleDate < timeNewDate.Unix() {
455
+				prescriptionList, _ := service.GetDialysisPrescriptionList(item.PatientId, item.UserOrgId, item.ScheduleDate)
456
+				var DialysisMachineName string
457
+				if len(prescriptionList.DialysisDialyszers) > 0 {
458
+					DialysisMachineName = prescriptionList.DialysisDialyszers
459
+				}
460
+				if len(prescriptionList.DialyzerPerfusionApparatus) > 0 {
461
+					DialysisMachineName = DialysisMachineName + "," + prescriptionList.DialyzerPerfusionApparatus
462
+				}
463
+
464
+				if len(prescriptionList.DialysisIrrigation) > 0 {
465
+					DialysisMachineName = DialysisMachineName + "," + prescriptionList.DialysisIrrigation
466
+				}
467
+				item.DialysisMachineName = DialysisMachineName
468
+				service.UpdateSchOne(item.ID, item.DialysisMachineName)
469
+			}
470
+
454 471
 		}
455 472
 
456 473
 	}

+ 30 - 3
controllers/patient_api_controller.go Visa fil

@@ -372,9 +372,6 @@ func (c *PatientApiController) CreatePatient() {
372 372
 	// 将汉字转为拼音
373 373
 	pinyinSlice := pinyin.Pinyin(hans, p)
374 374
 
375
-	// 输出拼音
376
-	fmt.Println("Pinyin:", pinyinSlice)
377
-
378 375
 	// 获取首字母
379 376
 	firstLetter := ""
380 377
 	for _, py := range pinyinSlice {
@@ -495,6 +492,7 @@ func (c *PatientApiController) CreatePatient() {
495 492
 		InfectiousRemark:             patient.InfectiousRemark,
496 493
 		AllergicHistory:              patient.AllergicHistory,
497 494
 		PatientAddress:               patient.PatientAddress,
495
+		PrintDate:                    patient.PrintDate,
498 496
 	}
499 497
 	patientsNew.FirstLetter = firstLetter
500 498
 
@@ -735,6 +733,7 @@ func (c *PatientApiController) EditPatient() {
735 733
 		InfectiousRemark:          patient.InfectiousRemark,
736 734
 		AllergicHistory:           patient.AllergicHistory,
737 735
 		PatientAddress:            patient.PatientAddress,
736
+		PrintDate:                 patient.PrintDate,
738 737
 	}
739 738
 	//	//更新病人ID获取新表病人ID
740 739
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -5366,6 +5365,14 @@ func patientFormData(patient *models.Patients, data []byte, method string) (cont
5366 5365
 		patient.PatientAddress = patient_address
5367 5366
 	}
5368 5367
 
5368
+	if patientBody["print_date"] != nil && reflect.TypeOf(patientBody["print_date"]).String() == "string" {
5369
+		print_date := patientBody["print_date"].(string)
5370
+		printDateTime, err := time.ParseInLocation(timeLayout, print_date, loc)
5371
+		if err == nil {
5372
+			patient.PrintDate = printDateTime.Unix()
5373
+		}
5374
+	}
5375
+
5369 5376
 	return
5370 5377
 
5371 5378
 }
@@ -5891,6 +5898,26 @@ func (c *PatientApiController) ExportPatients() {
5891 5898
 
5892 5899
 	if len(patients) > 0 {
5893 5900
 		for _, item := range patients {
5901
+
5902
+			hans := item.Name // 要转换的汉字字符串
5903
+			// 创建一个拼音转换器
5904
+			p := pinyin.NewArgs()
5905
+
5906
+			// 将汉字转为拼音
5907
+			pinyinSlice := pinyin.Pinyin(hans, p)
5908
+
5909
+			// 输出拼音
5910
+			fmt.Println("Pinyin:", pinyinSlice)
5911
+
5912
+			// 获取首字母
5913
+			firstLetter := ""
5914
+			for _, py := range pinyinSlice {
5915
+				if len(py) > 0 {
5916
+					firstLetter += string(py[0][0])
5917
+				}
5918
+			}
5919
+
5920
+			item.FirstLetter = firstLetter
5894 5921
 			service.CreateExportPatient(item, item.ContagionIds, org.Creator)
5895 5922
 		}
5896 5923
 

+ 41 - 42
controllers/pharmacy_controller.go Visa fil

@@ -1,15 +1,16 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
+	"fmt"
5
+	"math"
6
+	"strconv"
7
+	"time"
8
+
4 9
 	"XT_New/enums"
5 10
 	"XT_New/models"
6 11
 	"XT_New/service"
7 12
 	"XT_New/utils"
8
-	"fmt"
9 13
 	"github.com/astaxie/beego"
10
-	"math"
11
-	"strconv"
12
-	"time"
13 14
 )
14 15
 
15 16
 type PharmacyController struct {
@@ -146,6 +147,7 @@ func (this *PharmacyController) IssuedDrug() {
146 147
 		}
147 148
 	}()
148 149
 	keyword := this.GetString("keyword", "")
150
+	fmt.Println(keyword)
149 151
 	times := this.GetString("time", "")
150 152
 	orgid := this.GetAdminUserInfo().CurrentOrgId
151 153
 	shift, err := this.GetInt64("shift", 0) //班次
@@ -169,50 +171,47 @@ func (this *PharmacyController) IssuedDrug() {
169 171
 		etime = stime + 86399
170 172
 	}
171 173
 
172
-	if orgid == 10164 || orgid == 3877 || orgid == 10188 || orgid == 10217 || orgid == 9671 || orgid == 10387 || orgid == 10375 || orgid == 10480 || orgid == 10344 {
173
-
174
-		//获取排班班次
175
-		schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
174
+	//获取排班班次
175
+	schedule, _ := service.GetSchedulePatientId(stime, etime, orgid, shift, partition)
176 176
 
177
-		var ids []int64
178
-		for _, item := range schedule {
179
-			ids = append(ids, item.PatientId)
180
-		}
177
+	var ids []int64
178
+	for _, item := range schedule {
179
+		ids = append(ids, item.PatientId)
180
+	}
181 181
 
182
-		list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
182
+	list, _ := service.GetTodayAdviceCountOne(stime, etime, orgid, 1, ids)
183 183
 
184
-		var flist []models.TmpPatientOne
185
-		if len(list) > 0 {
186
-			for _, item := range list {
187
-				patientlist, _ := service.GetPatientByAdviceId(item.PatientId)
188
-				flist = append(flist, patientlist)
189
-			}
184
+	var flist []models.TmpPatientOne
185
+	if len(list) > 0 {
186
+		for _, item := range list {
187
+			patientlist, _ := service.GetPatientByAdviceId(item.PatientId)
188
+			flist = append(flist, patientlist)
190 189
 		}
191
-		this.ServeSuccessJSON(map[string]interface{}{
192
-			"list": flist,
193
-		})
194 190
 	}
191
+	this.ServeSuccessJSON(map[string]interface{}{
192
+		"list": flist,
193
+	})
195 194
 
196
-	if orgid != 10164 && orgid == 3877 && orgid != 10188 && orgid != 10217 && orgid != 9671 && orgid != 10387 && orgid != 10375 && orgid != 10480 && orgid == 10344 {
197
-		//查询表里当天的数据
198
-		var flist []*models.TmpPatient
199
-		flist, err = service.GetTodayDrug(stime, etime, orgid, 1, keyword)
200
-		if err != nil {
201
-			utils.ErrorLog(err.Error())
202
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
203
-			return
204
-		}
205
-		listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
206
-		if err != nil {
207
-			utils.ErrorLog(err.Error())
208
-			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
209
-			return
210
-		}
211
-		this.ServeSuccessJSON(map[string]interface{}{
212
-			"list": listt,
213
-		})
214
-		return
215
-	}
195
+	//if orgid != 10164 && orgid == 3877 && orgid != 10188 && orgid != 10217 && orgid != 9671 && orgid != 10387 && orgid != 10375 && orgid != 10480 && orgid == 10344 {
196
+	//	//查询表里当天的数据
197
+	//	var flist []*models.TmpPatient
198
+	//	flist, err = service.GetTodayDrug(stime, etime, orgid, 1, keyword)
199
+	//	if err != nil {
200
+	//		utils.ErrorLog(err.Error())
201
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
202
+	//		return
203
+	//	}
204
+	//	listt, err := service.PartitionAndLayout(stime, etime, orgid, shift, partition, flist)
205
+	//	if err != nil {
206
+	//		utils.ErrorLog(err.Error())
207
+	//		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
208
+	//		return
209
+	//	}
210
+	//	this.ServeSuccessJSON(map[string]interface{}{
211
+	//		"list": listt,
212
+	//	})
213
+	//	return
214
+	//}
216 215
 
217 216
 }
218 217
 func (this *PharmacyController) WaitingDrug() {

+ 74 - 31
controllers/schedule_api_controller.go Visa fil

@@ -3986,7 +3986,11 @@ func (this *ScheduleApiController) GetNextWeekDayScheduleOne() {
3986 3986
 	loc, _ := time.LoadLocation("Local")
3987 3987
 	//theTimeStart, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
3988 3988
 	//theTimeEnd, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
3989
-
3989
+	ids := this.GetString("ids")
3990
+	var idStr []string
3991
+	if len(ids) > 0 {
3992
+		idStr = strings.Split(ids, ",")
3993
+	}
3990 3994
 	adminUserInfo := this.GetAdminUserInfo()
3991 3995
 	var theStartTIme int64
3992 3996
 	if len(record_date) > 0 {
@@ -3997,19 +4001,15 @@ func (this *ScheduleApiController) GetNextWeekDayScheduleOne() {
3997 4001
 		theStartTIme = theTime.Unix()
3998 4002
 	}
3999 4003
 
4000
-	schedule, err := service.GetNextWeekDayScheduleSix(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone, theStartTIme)
4001
-	fmt.Println("schedule------------------------------------------------", len(schedule))
4004
+	schedule, err := service.GetNextWeekDayScheduleSix(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone, theStartTIme, idStr)
4005
+
4002 4006
 	for _, item := range schedule {
4003 4007
 		order, _ := service.GetLastDialysisOrder(adminUserInfo.CurrentOrgId, item.PatientId, theStartTIme)
4004 4008
 		item.XtDialysisOrderSix = order
4005 4009
 		solutionLastWeek, _ := service.GetDialysisSolutionLastWeek(adminUserInfo.CurrentOrgId, item.PatientId, item.ModeId)
4006 4010
 		item.DialysisSolution = solutionLastWeek
4007
-		if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10340 {
4008
-
4009
-			dialysisprescription, _ := service.GetLastDialysisSolution(adminUserInfo.CurrentOrgId, item.PatientId, item.ModeId, item.ScheduleDate)
4010
-			item.DialysisPrescription = dialysisprescription
4011
-
4012
-		}
4011
+		prescription, _ := service.GetLastDialysisPrescriptionTwo(adminUserInfo.CurrentOrgId, item.PatientId, item.ModeId, item.ScheduleDate)
4012
+		item.DialysisPrescription = prescription
4013 4013
 
4014 4014
 	}
4015 4015
 	if err != nil {
@@ -4036,7 +4036,11 @@ func (this *ScheduleApiController) GetNextWeekDaySchedule() {
4036 4036
 	loc, _ := time.LoadLocation("Local")
4037 4037
 	theTimeStart, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
4038 4038
 	theTimeEnd, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
4039
-
4039
+	ids := this.GetString("ids")
4040
+	var idStr []string
4041
+	if len(ids) > 0 {
4042
+		idStr = strings.Split(ids, ",")
4043
+	}
4040 4044
 	adminUserInfo := this.GetAdminUserInfo()
4041 4045
 	var theStartTIme int64
4042 4046
 	if len(record_date) > 0 {
@@ -4047,7 +4051,7 @@ func (this *ScheduleApiController) GetNextWeekDaySchedule() {
4047 4051
 		theStartTIme = theTime.Unix()
4048 4052
 	}
4049 4053
 
4050
-	schedule, err := service.GetNextWeekDaySchedule(week_type, week_time, theTimeStart.Unix(), theTimeEnd.Unix(), adminUserInfo.CurrentOrgId, zone, theStartTIme)
4054
+	schedule, err := service.GetNextWeekDaySchedule(week_type, week_time, theTimeStart.Unix(), theTimeEnd.Unix(), adminUserInfo.CurrentOrgId, zone, theStartTIme, idStr)
4051 4055
 
4052 4056
 	for _, item := range schedule {
4053 4057
 		AssessmentBefor, _ := service.GetAssessmentBeforListLastWeek(item.ScheduleDate, item.PatientId, item.UserOrgId)
@@ -4425,6 +4429,13 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4425 4429
 	week_time, _ := this.GetInt64("week_time")
4426 4430
 	zones := this.GetString("zone")
4427 4431
 	zone := strings.Split(zones, ",")
4432
+	limit, _ := this.GetInt64("limit")
4433
+	page, _ := this.GetInt64("page")
4434
+	ids := this.GetString("ids")
4435
+	var idStr []string
4436
+	if len(ids) > 0 {
4437
+		idStr = strings.Split(ids, ",")
4438
+	}
4428 4439
 	thisTime := time.Now()
4429 4440
 	weekDay := int(thisTime.Weekday())
4430 4441
 	if weekDay == 0 {
@@ -4442,7 +4453,6 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4442 4453
 		weekTitle = append(weekTitle, indexWeek)
4443 4454
 		days = append(days, theDay.Format("2006-01-02"))
4444 4455
 	}
4445
-	fmt.Println(days)
4446 4456
 
4447 4457
 	var targetDayStr string
4448 4458
 	var startTime string
@@ -4488,19 +4498,25 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4488 4498
 
4489 4499
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4490 4500
 
4491
-	fmt.Println("week_type-------------------------", week_type)
4492 4501
 	if week_type > 0 {
4493
-		list, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone)
4502
+
4503
+		list, total, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone, limit, page, idStr)
4504
+
4494 4505
 		for _, item := range list {
4495 4506
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
4496
-			adviceList, _ := service.GetHisDoctorAdviceList(orgId, item.PatientId, targetDay.Unix())
4497
-			item.HisDoctorAdviceInfo = adviceList
4498 4507
 			item.XtDialysisOrderSix = order
4499
-			if orgId == 10340 {
4500
-
4501
-				solution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
4502
-				item.DialysisPrescription = solution
4503
-			}
4508
+			advicehisList, _ := service.GetHisDoctorAdviceList(orgId, item.PatientId, targetDay.Unix())
4509
+			item.HisDoctorAdviceInfo = advicehisList
4510
+			advices, _ := service.GetDoctorAdviceListSchedule(orgId, item.PatientId)
4511
+			item.DoctorAdvice = advices
4512
+			prescription, _ := service.GetLastDialysisPrescriptionTwo(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
4513
+			item.DialysisPrescription = prescription
4514
+			dialysisSolution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId)
4515
+			item.DialysisSolution = dialysisSolution
4516
+			lastDialysisAfter, _ := service.GetLastDialysisAfter(orgId, item.PatientId, item.ScheduleDate)
4517
+			item.LastAfterWeight = lastDialysisAfter
4518
+			assessmentBeforFourty, _ := service.GetAssessmentBeforFourty(orgId, item.PatientId, item.ScheduleDate)
4519
+			item.XtAssessmentBeforeDislysis = assessmentBeforFourty
4504 4520
 
4505 4521
 		}
4506 4522
 		if err != nil {
@@ -4509,23 +4525,33 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4509 4525
 		}
4510 4526
 
4511 4527
 		this.ServeSuccessJSON(map[string]interface{}{
4512
-			"list": list,
4513
-			"day":  targetDayStr,
4528
+			"list":  list,
4529
+			"day":   targetDayStr,
4530
+			"total": total,
4514 4531
 		})
4515 4532
 	}
4516 4533
 
4517 4534
 	if week_type == 0 {
4518 4535
 		startDate, _ := utils.ParseTimeStringToTime("2006-01-02", startTime)
4519
-		list, err := service.GetWeekDayScheduleByIdTwo(orgId, targetDay.Unix(), week_time, startDate.Unix(), zone)
4536
+		list, total, err := service.GetWeekDayScheduleByIdTwo(orgId, targetDay.Unix(), week_time, startDate.Unix(), zone, limit, page, idStr)
4520 4537
 		for _, item := range list {
4521 4538
 
4522 4539
 			order, _ := service.GetLastDialysisOrder(orgId, item.PatientId, targetDay.Unix())
4523 4540
 			item.XtDialysisOrderSix = order
4524
-			if orgId == 9671 || orgId == 9675 || orgId == 10340 {
4541
+			advicehisList, _ := service.GetHisDoctorAdviceList(orgId, item.PatientId, targetDay.Unix())
4542
+			item.HisDoctorAdviceInfo = advicehisList
4543
+			advices, _ := service.GetDoctorAdviceListSchedule(orgId, item.PatientId)
4544
+			item.DoctorAdvice = advices
4545
+			prescription, _ := service.GetLastDialysisPrescriptionTwo(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
4546
+			item.DialysisPrescription = prescription
4547
+			dialysisSolution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId)
4548
+			item.DialysisSolution = dialysisSolution
4525 4549
 
4526
-				solution, _ := service.GetLastDialysisSolution(orgId, item.PatientId, item.ModeId, item.ScheduleDate)
4527
-				item.DialysisPrescription = solution
4528
-			}
4550
+			lastDialysisAfter, _ := service.GetLastDialysisAfter(orgId, item.PatientId, item.ScheduleDate)
4551
+			item.LastAfterWeight = lastDialysisAfter
4552
+
4553
+			assessmentBeforFourty, _ := service.GetAssessmentBeforFourty(orgId, item.PatientId, item.ScheduleDate)
4554
+			item.XtAssessmentBeforeDislysis = assessmentBeforFourty
4529 4555
 
4530 4556
 		}
4531 4557
 		if err != nil {
@@ -4534,8 +4560,9 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4534 4560
 		}
4535 4561
 
4536 4562
 		this.ServeSuccessJSON(map[string]interface{}{
4537
-			"list": list,
4538
-			"day":  targetDayStr,
4563
+			"list":  list,
4564
+			"day":   targetDayStr,
4565
+			"total": total,
4539 4566
 		})
4540 4567
 	}
4541 4568
 
@@ -4759,7 +4786,7 @@ func (c *ScheduleApiController) GetScheduleOne() {
4759 4786
 	}
4760 4787
 
4761 4788
 	//查询排班里面的空透析器
4762
-	if adminInfo.CurrentOrgId == 10375 {
4789
+	if adminInfo.CurrentOrgId == 10375 || adminInfo.CurrentOrgId == 10510 || adminInfo.CurrentOrgId == 9538 {
4763 4790
 
4764 4791
 		schedulesFive, _ := service.GetWeekScheduleFive(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4765 4792
 
@@ -4780,6 +4807,22 @@ func (c *ScheduleApiController) GetScheduleOne() {
4780 4807
 				item.DialysisMachineName = DialysisMachineName
4781 4808
 				service.UpdateSchOne(item.ID, item.DialysisMachineName)
4782 4809
 			}
4810
+			if item.ScheduleDate < timeNewDate.Unix() {
4811
+				prescriptionList, _ := service.GetDialysisPrescriptionList(item.PatientId, item.UserOrgId, item.ScheduleDate)
4812
+				var DialysisMachineName string
4813
+				if len(prescriptionList.DialysisDialyszers) > 0 {
4814
+					DialysisMachineName = prescriptionList.DialysisDialyszers
4815
+				}
4816
+				if len(prescriptionList.DialyzerPerfusionApparatus) > 0 {
4817
+					DialysisMachineName = DialysisMachineName + "," + prescriptionList.DialyzerPerfusionApparatus
4818
+				}
4819
+
4820
+				if len(prescriptionList.DialysisIrrigation) > 0 {
4821
+					DialysisMachineName = DialysisMachineName + "," + prescriptionList.DialysisIrrigation
4822
+				}
4823
+				item.DialysisMachineName = DialysisMachineName
4824
+				service.UpdateSchOne(item.ID, item.DialysisMachineName)
4825
+			}
4783 4826
 
4784 4827
 		}
4785 4828
 

+ 106 - 72
controllers/self_drug_api_congtroller.go Visa fil

@@ -123,6 +123,12 @@ func SelfDrugRouters() {
123 123
 	beego.Router("/api/stock/getpurchaseDrugQueryList", &SelfDrugApiController{}, "Get:GetPurchaseDrugQueryList")
124 124
 
125 125
 	beego.Router("/api/stock/getpurchasestockquerylist", &SelfDrugApiController{}, "Get:GetPurchaseStockQueryList")
126
+
127
+	beego.Router("/api/drug/getcheckdrugbatchlist", &SelfDrugApiController{}, "Get:GetCheckDrugBatchList")
128
+
129
+	beego.Router("/api/good/getcheckgoodbatchlist", &SelfDrugApiController{}, "Get:GetCheckGoodBatchList")
130
+
131
+	beego.Router("/api/drug/getdrugpatientname", &SelfDrugApiController{}, "Get:GetDrugPatientName")
126 132
 }
127 133
 
128 134
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -2761,43 +2767,25 @@ func (this *SelfDrugApiController) GetGoodNewQuery() {
2761 2767
 	limit, _ := this.GetInt64("limit")
2762 2768
 
2763 2769
 	// 查询该机构所有耗材入库信息
2764
-	goodList, _ := service.GetAllGoodListSeven(orgId)
2765
-
2766
-	for _, it := range goodList {
2767
-		var sum_total int64
2768
-		//查询该耗材入库信息
2769
-		warehouseinfo, _ := service.GetGoodInformationWarehouseInfo(it.ID, orgId)
2770
-		for _, item := range warehouseinfo {
2771
-			sum_total += item.StockCount
2772
-		}
2773
-		service.UpdateGoodInformation(it.ID, orgId, sum_total)
2774
-
2775
-		//stockListTwo, _ := service.GetGoodStockCountList(orgId, it.ID)
2776
-		//if len(stockListTwo) > 0 {
2777
-		//	for _, item := range stockListTwo {
2778
-		//		var over_count int64
2779
-		//		over_count = item.StockInCount - item.FlushCount
2780
-		//		service.UpdateGoodListCount(item.UserOrgId, over_count, item.GoodId, item.StorehouseId)
2781
-		//
2782
-		//	}
2783
-		//}
2784
-		//
2785
-		//stockListOne, _ := service.GetGoodStockCountList(orgId, it.ID)
2786
-		//if len(stockListOne) > 0 {
2787
-		//	for _, item := range stockListOne {
2788
-		//		var over_count int64
2789
-		//		over_count = item.StockOutCount + item.StockCancelCount
2790
-		//		service.UpdateGoodListCountOne(item.UserOrgId, over_count, item.GoodId, item.StorehouseId)
2791
-		//	}
2792
-		//}
2793
-
2794
-	}
2770
+	//goodList, _ := service.GetAllGoodListSeven(orgId)
2771
+	//
2772
+	//for _, it := range goodList {
2773
+	//	var sum_total int64
2774
+	//	//查询该耗材入库信息
2775
+	//	warehouseinfo, _ := service.GetGoodInformationWarehouseInfo(it.ID, orgId)
2776
+	//	for _, item := range warehouseinfo {
2777
+	//		sum_total += item.StockCount
2778
+	//	}
2779
+	//	service.UpdateGoodInformation(it.ID, orgId, sum_total)
2780
+	//}
2795 2781
 
2796 2782
 	var ids []int64
2797 2783
 
2798
-	manufacturerList, _ := service.GetManufacturerListByKeyword(orgId, keyword)
2799
-	for _, it := range manufacturerList {
2800
-		ids = append(ids, it.ID)
2784
+	if len(keyword) > 0 {
2785
+		manufacturerList, _ := service.GetManufacturerListByKeyword(orgId, keyword)
2786
+		for _, it := range manufacturerList {
2787
+			ids = append(ids, it.ID)
2788
+		}
2801 2789
 	}
2802 2790
 
2803 2791
 	stockList, total, err := service.GetGoodStockList(orgId, storehouse_id, good_type, keyword, page, limit, ids)
@@ -3432,48 +3420,34 @@ func (this *SelfDrugApiController) GetDrugNewQuery() {
3432 3420
 	}
3433 3421
 	var ids []int64
3434 3422
 	var goodIds []int64
3435
-	manufacturerList, _ := service.GetManufacturerListByKeyword(orgId, keyword)
3436 3423
 
3424
+	if len(keyword) > 0 {
3425
+		manufacturerList, _ := service.GetManufacturerListByKeyword(orgId, keyword)
3426
+		for _, it := range manufacturerList {
3427
+			ids = append(ids, it.ID)
3428
+		}
3429
+	}
3437 3430
 	//查询药品库信息
3438
-	drug, _ := service.GetBaseDrugName(orgId)
3439
-
3440
-	for _, it := range drug {
3441
-		var sum_count int64
3442
-		var limit_count int64
3443
-		drugInfo, _ := service.GetDrugWarehouseInfoName(it.ID, orgId)
3444
-		for _, item := range drugInfo {
3431
+	//drug, _ := service.GetBaseDrugName(orgId)
3432
+	//
3433
+	//for _, it := range drug {
3434
+	//	var sum_count int64
3435
+	//	var limit_count int64
3436
+	//	drugInfo, _ := service.GetDrugWarehouseInfoName(it.ID, orgId)
3437
+	//	for _, item := range drugInfo {
3438
+	//
3439
+	//		sum_count += item.StockMaxNumber*it.MinNumber + item.StockMinNumber
3440
+	//	}
3441
+	//	stockInt, _ := strconv.ParseInt(it.DrugStockLimit, 10, 64)
3442
+	//	limit_count = stockInt * it.MinNumber
3443
+	//	service.UpdateDrugById(it.ID, orgId, limit_count, sum_count)
3444
+	//}
3445 3445
 
3446
-			sum_count += item.StockMaxNumber*it.MinNumber + item.StockMinNumber
3446
+	if storehouse_id > 0 {
3447
+		infoList, _ := service.GetDrugWarehouseInfoByOrgId(orgId, storehouse_id)
3448
+		for _, it := range infoList {
3449
+			goodIds = append(goodIds, it.DrugId)
3447 3450
 		}
3448
-		stockInt, _ := strconv.ParseInt(it.DrugStockLimit, 10, 64)
3449
-		limit_count = stockInt * it.MinNumber
3450
-		service.UpdateDrugById(it.ID, orgId, limit_count, sum_count)
3451
-
3452
-		//druglist, _ := service.GetDrugCountMapList(it.ID, orgId)
3453
-		//if len(druglist) > 0 {
3454
-		//	for _, item := range druglist {
3455
-		//		var over_count int64
3456
-		//		over_count = item.SumInCount - item.FlushCount
3457
-		//		service.UpdateDrugStockInCount(item.DrugId, item.StorehouseId, over_count, item.UserOrgId)
3458
-		//	}
3459
-		//}
3460
-
3461
-		//druglistOne, _ := service.GetDrugCountMapList(it.ID, orgId)
3462
-		//if len(druglistOne) > 0 {
3463
-		//	for _, item := range druglistOne {
3464
-		//		var over_count int64
3465
-		//		over_count = item.SumOutCount + item.SumCancelCount
3466
-		//		service.UpdateDrugStockInCountOne(item.DrugId, item.StorehouseId, over_count, item.UserOrgId)
3467
-		//	}
3468
-		//}
3469
-	}
3470
-
3471
-	for _, it := range manufacturerList {
3472
-		ids = append(ids, it.ID)
3473
-	}
3474
-	infoList, _ := service.GetDrugWarehouseInfoByOrgId(orgId, storehouse_id)
3475
-	for _, it := range infoList {
3476
-		goodIds = append(goodIds, it.DrugId)
3477 3451
 	}
3478 3452
 
3479 3453
 	countList, total, err := service.GetDrugStockCountList(orgId, storehouse_id, good_type, keyword, page, limit, ids, goodIds, startTime, endTime)
@@ -4387,3 +4361,63 @@ func (this *SelfDrugApiController) GetPurchaseStockQueryList() {
4387 4361
 	})
4388 4362
 
4389 4363
 }
4364
+
4365
+func (this *SelfDrugApiController) GetCheckDrugBatchList() {
4366
+
4367
+	drug_id, _ := this.GetInt64("drug_id")
4368
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4369
+
4370
+	advicelist, _ := service.GetHisAdviceGroupList(drug_id, orgId)
4371
+
4372
+	outInfo, _ := service.GetDrugWarehousOutInfo(drug_id, orgId)
4373
+
4374
+	outInfoOne, _ := service.GetDrugWarehousOutInfoOne(drug_id, orgId)
4375
+
4376
+	baseDrugList, _ := service.GetDrugByGoodId(drug_id)
4377
+
4378
+	drugflow, _ := service.GetCheckDrugFlow(drug_id, orgId)
4379
+
4380
+	this.ServeSuccessJSON(map[string]interface{}{
4381
+		"advicelist":   advicelist,
4382
+		"outInfo":      outInfo,
4383
+		"outInfoOne":   outInfoOne,
4384
+		"baseDrugList": baseDrugList,
4385
+		"drugflow":     drugflow,
4386
+	})
4387
+}
4388
+
4389
+func (this *SelfDrugApiController) GetCheckGoodBatchList() {
4390
+
4391
+	id, _ := this.GetInt64("id")
4392
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4393
+	projectList, _ := service.GetCheckGoodBatchList(id, orgId)
4394
+
4395
+	warehouseList, _ := service.GetCheckGoodWarehouseList(id, orgId)
4396
+
4397
+	this.ServeSuccessJSON(map[string]interface{}{
4398
+		"projectList":   projectList,
4399
+		"warehouseList": warehouseList,
4400
+	})
4401
+}
4402
+
4403
+func (this *SelfDrugApiController) GetDrugPatientName() {
4404
+
4405
+	drug_id, _ := this.GetInt64("drug_id")
4406
+
4407
+	sys_record_time, _ := this.GetInt64("sys_record_time")
4408
+
4409
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4410
+
4411
+	advicelist, _ := service.GetHisAdviceListBySysRrecordTime(drug_id, sys_record_time, orgId)
4412
+
4413
+	outInfor, _ := service.GetDrugWarehouseOutInfoBySysRecordTime(drug_id, sys_record_time, orgId)
4414
+
4415
+	patients, _ := service.GetAllpatient(orgId)
4416
+
4417
+	this.ServeSuccessJSON(map[string]interface{}{
4418
+		"advicelist": advicelist,
4419
+		"outInfor":   outInfor,
4420
+		"patients":   patients,
4421
+	})
4422
+
4423
+}

+ 238 - 43
controllers/stock_in_api_controller.go Visa fil

@@ -1,18 +1,20 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8 4
 	"encoding/json"
9 5
 	"fmt"
10
-	"github.com/astaxie/beego"
11
-	"github.com/jinzhu/gorm"
12 6
 	"reflect"
13 7
 	"strconv"
14 8
 	"strings"
15 9
 	"time"
10
+
11
+	"XT_New/enums"
12
+	"XT_New/models"
13
+	"XT_New/service"
14
+	"XT_New/utils"
15
+	"github.com/astaxie/beego"
16
+	"github.com/jinzhu/gorm"
17
+	"github.com/mozillazg/go-pinyin"
16 18
 )
17 19
 
18 20
 type StockManagerApiController struct {
@@ -159,6 +161,8 @@ func StockManagerApiRegistRouters() {
159 161
 
160 162
 	beego.Router("/api/stock/getstockfloworderlist", &StockManagerApiController{}, "Get:GetStockFlowOrderList")
161 163
 
164
+	beego.Router("/api/stock/getgoodpatientname", &StockManagerApiController{}, "Get:GetGoodPatientName")
165
+
162 166
 }
163 167
 func (c *StockManagerApiController) HandleRefundStock() {
164 168
 	order_id, _ := c.GetInt64("order_id", 0)
@@ -3574,6 +3578,40 @@ func (this *StockManagerApiController) AddGoodInformation() {
3574 3578
 
3575 3579
 		good.GoodUnit = unit_id
3576 3580
 
3581
+		default_count := int64(goodNameM["default_count"].(float64))
3582
+		if default_count == 0 { //名字为空则生成一条导入错误日志
3583
+			err_log := models.ExportErrLog{
3584
+				LogType:    5,
3585
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
3586
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "默认单次用量不能为空",
3587
+				Status:     1,
3588
+				CreateTime: time.Now().Unix(),
3589
+				UpdateTime: time.Now().Unix(),
3590
+				ExportTime: time.Now().Unix(),
3591
+			}
3592
+			service.CreateExportErrLog(&err_log)
3593
+			continue
3594
+		}
3595
+
3596
+		good.DefaultCount = default_count
3597
+
3598
+		default_count_unit := goodNameM["default_count_unit"].(string)
3599
+		if len(default_count_unit) == 0 { //名字为空则生成一条导入错误日志
3600
+			err_log := models.ExportErrLog{
3601
+				LogType:    5,
3602
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
3603
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "默认单次用量单位不能为空",
3604
+				Status:     1,
3605
+				CreateTime: time.Now().Unix(),
3606
+				UpdateTime: time.Now().Unix(),
3607
+				ExportTime: time.Now().Unix(),
3608
+			}
3609
+			service.CreateExportErrLog(&err_log)
3610
+			continue
3611
+		}
3612
+
3613
+		good.DefaultCountUnit = default_count_unit
3614
+
3577 3615
 		retail_prices := goodNameM["retail_price"].(string)
3578 3616
 		retail_price, _ := strconv.ParseFloat(retail_prices, 64)
3579 3617
 
@@ -3593,6 +3631,25 @@ func (this *StockManagerApiController) AddGoodInformation() {
3593 3631
 
3594 3632
 		good.RetailPrice = retail_price
3595 3633
 
3634
+		buy_prices := goodNameM["buy_price"].(string)
3635
+		buy_price, _ := strconv.ParseFloat(buy_prices, 64)
3636
+
3637
+		if buy_price <= 0 { //名字为空则生成一条导入错误日志
3638
+			err_log := models.ExportErrLog{
3639
+				LogType:    5,
3640
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
3641
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的进货价不能为空",
3642
+				Status:     1,
3643
+				CreateTime: time.Now().Unix(),
3644
+				UpdateTime: time.Now().Unix(),
3645
+				ExportTime: time.Now().Unix(),
3646
+			}
3647
+			service.CreateExportErrLog(&err_log)
3648
+			continue
3649
+		}
3650
+
3651
+		good.BuyPrice = buy_price
3652
+
3596 3653
 		if goodNameM["stock_warn_count"] == nil || reflect.TypeOf(goodNameM["stock_warn_count"]).String() != "float64" {
3597 3654
 			utils.ErrorLog("stock_warn_count")
3598 3655
 			return
@@ -3658,10 +3715,6 @@ func (this *StockManagerApiController) AddGoodInformation() {
3658 3715
 
3659 3716
 		good.Wubi = wubi
3660 3717
 
3661
-		buy_prices := goodNameM["buy_price"].(string)
3662
-		buy_price, _ := strconv.ParseFloat(buy_prices, 64)
3663
-		good.BuyPrice = buy_price
3664
-
3665 3718
 		if goodNameM["social_security_directory_code"] == nil || reflect.TypeOf(goodNameM["social_security_directory_code"]).String() != "string" {
3666 3719
 			utils.ErrorLog("social_security_directory_code")
3667 3720
 			return
@@ -3772,7 +3825,25 @@ func (this *StockManagerApiController) AddGoodInformation() {
3772 3825
 	if len(goods) > 0 {
3773 3826
 
3774 3827
 		for _, item := range goods {
3828
+			hans := item.GoodName // 要转换的汉字字符串
3829
+			// 创建一个拼音转换器
3830
+			p := pinyin.NewArgs()
3831
+
3832
+			// 将汉字转为拼音
3833
+			pinyinSlice := pinyin.Pinyin(hans, p)
3775 3834
 
3835
+			// 输出拼音
3836
+			fmt.Println("Pinyin:", pinyinSlice)
3837
+
3838
+			// 获取首字母
3839
+			firstLetter := ""
3840
+			for _, py := range pinyinSlice {
3841
+				if len(py) > 0 {
3842
+					firstLetter += string(py[0][0])
3843
+				}
3844
+			}
3845
+
3846
+			item.FirstLetter = firstLetter
3776 3847
 			goodInfo := models.GoodInfo{
3777 3848
 				GoodName:                    item.GoodName,
3778 3849
 				SpecificationName:           item.SpecificationName,
@@ -3804,6 +3875,9 @@ func (this *StockManagerApiController) AddGoodInformation() {
3804 3875
 				PackingUnit:                 item.PackingUnit,
3805 3876
 				PackingPrice:                item.RetailPrice,
3806 3877
 				IsWarehouse:                 1,
3878
+				DefaultCount:                item.DefaultCount,
3879
+				DefaultCountUnit:            item.DefaultCountUnit,
3880
+				FirstLetter:                 item.FirstLetter,
3807 3881
 			}
3808 3882
 
3809 3883
 			//查询同种耗材名称同种类型同种规格的耗材是否存在
@@ -4231,6 +4305,7 @@ func (this *StockManagerApiController) AddDrugInformation() {
4231 4305
 		var unit_id int64
4232 4306
 
4233 4307
 		drugDoseUnit := goodNameM["drug_dose_unit"].(string)
4308
+
4234 4309
 		if len(drugDoseUnit) == 0 {
4235 4310
 			err_log := models.ExportErrLog{
4236 4311
 				LogType:    4,
@@ -4245,6 +4320,41 @@ func (this *StockManagerApiController) AddDrugInformation() {
4245 4320
 			continue
4246 4321
 		}
4247 4322
 
4323
+		dataConfig, _ := service.GetDataConfigIsExist(0, units)
4324
+		if len(drugDoseUnit) != 0 {
4325
+			_, errcodedataconfig := service.GetChildeConfigIsExist(dataConfig.ID, drugDoseUnit, orgId)
4326
+			if errcodedataconfig == gorm.ErrRecordNotFound {
4327
+				childConfig, _ := service.GetLastChildeConfig(dataConfig.ID, orgId)
4328
+				dataconfig := models.Dataconfig{
4329
+					ParentId:       dataConfig.ID,
4330
+					Module:         "hemodialysis",
4331
+					OrgId:          orgId,
4332
+					Name:           drugDoseUnit,
4333
+					FieldName:      "",
4334
+					Value:          childConfig.Value + 1,
4335
+					CreatedTime:    "",
4336
+					UpdatedTime:    "",
4337
+					CreateUserId:   adminUser.AdminUser.Id,
4338
+					Status:         1,
4339
+					Remark:         "",
4340
+					DeleteIdSystem: 0,
4341
+					Title:          "",
4342
+					Content:        "",
4343
+					Order:          0,
4344
+					Code:           "",
4345
+					FieldType:      0,
4346
+				}
4347
+				service.CreateDataConfig(&dataconfig)
4348
+			}
4349
+		}
4350
+		list, _ := service.FindAllDataConfigList(orgId, dataConfig.ID)
4351
+		for _, it := range list {
4352
+			if drugDoseUnit == it.Name {
4353
+				unit_id = int64(it.Value)
4354
+			}
4355
+		}
4356
+		drug.DrugDoseUnit = unit_id
4357
+
4248 4358
 		manufacturer := goodNameM["manufacturer"].(string)
4249 4359
 		if len(manufacturer) == 0 { //名字为空则生成一条导入错误日志
4250 4360
 			err_log := models.ExportErrLog{
@@ -4310,51 +4420,96 @@ func (this *StockManagerApiController) AddDrugInformation() {
4310 4420
 		drug.Dealer = dealer_id
4311 4421
 
4312 4422
 		delivery_way := goodNameM["delivery_way"].(string)
4423
+		if len(delivery_way) == 0 {
4424
+			err_log := models.ExportErrLog{
4425
+				LogType:    4,
4426
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
4427
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的默认给药途径不能为空",
4428
+				Status:     1,
4429
+				CreateTime: time.Now().Unix(),
4430
+				UpdateTime: time.Now().Unix(),
4431
+				ExportTime: time.Now().Unix(),
4432
+			}
4433
+			service.CreateExportErrLog(&err_log)
4434
+			continue
4435
+		}
4313 4436
 
4314 4437
 		drug.DeliveryWay = delivery_way
4315 4438
 
4316 4439
 		execution_frequency := goodNameM["execution_frequency"].(string)
4317 4440
 
4441
+		if len(execution_frequency) == 0 {
4442
+			err_log := models.ExportErrLog{
4443
+				LogType:    4,
4444
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
4445
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的默认执行频率不能为空",
4446
+				Status:     1,
4447
+				CreateTime: time.Now().Unix(),
4448
+				UpdateTime: time.Now().Unix(),
4449
+				ExportTime: time.Now().Unix(),
4450
+			}
4451
+			service.CreateExportErrLog(&err_log)
4452
+			continue
4453
+		}
4454
+
4318 4455
 		drug.ExecutionFrequency = execution_frequency
4319 4456
 
4320
-		lmt_used_flags := int64(goodNameM["lmt_used_flag"].(float64))
4457
+		prescribing_number := goodNameM["prescribing_number"].(float64)
4321 4458
 
4322
-		drug.LmtUsedFlag = lmt_used_flags
4459
+		if prescribing_number == 0 {
4460
+			err_log := models.ExportErrLog{
4461
+				LogType:    4,
4462
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
4463
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的默认开药数量不能为空",
4464
+				Status:     1,
4465
+				CreateTime: time.Now().Unix(),
4466
+				UpdateTime: time.Now().Unix(),
4467
+				ExportTime: time.Now().Unix(),
4468
+			}
4469
+			service.CreateExportErrLog(&err_log)
4470
+			continue
4471
+		}
4472
+		drug.PrescribingNumber = prescribing_number
4323 4473
 
4324
-		dataConfig, _ := service.GetDataConfigIsExist(0, units)
4325
-		if len(drugDoseUnit) != 0 {
4326
-			_, errcodedataconfig := service.GetChildeConfigIsExist(dataConfig.ID, drugDoseUnit, orgId)
4327
-			if errcodedataconfig == gorm.ErrRecordNotFound {
4328
-				childConfig, _ := service.GetLastChildeConfig(dataConfig.ID, orgId)
4329
-				dataconfig := models.Dataconfig{
4330
-					ParentId:       dataConfig.ID,
4331
-					Module:         "hemodialysis",
4332
-					OrgId:          orgId,
4333
-					Name:           drugDoseUnit,
4334
-					FieldName:      "",
4335
-					Value:          childConfig.Value + 1,
4336
-					CreatedTime:    "",
4337
-					UpdatedTime:    "",
4338
-					CreateUserId:   adminUser.AdminUser.Id,
4339
-					Status:         1,
4340
-					Remark:         "",
4341
-					DeleteIdSystem: 0,
4342
-					Title:          "",
4343
-					Content:        "",
4344
-					Order:          0,
4345
-					Code:           "",
4346
-					FieldType:      0,
4347
-				}
4348
-				service.CreateDataConfig(&dataconfig)
4474
+		prescribing_number_unit := goodNameM["prescribing_number_unit"].(string)
4475
+
4476
+		if len(prescribing_number_unit) == 0 {
4477
+			err_log := models.ExportErrLog{
4478
+				LogType:    4,
4479
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
4480
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的默认开药数量单位不能为空",
4481
+				Status:     1,
4482
+				CreateTime: time.Now().Unix(),
4483
+				UpdateTime: time.Now().Unix(),
4484
+				ExportTime: time.Now().Unix(),
4349 4485
 			}
4486
+			service.CreateExportErrLog(&err_log)
4487
+			continue
4350 4488
 		}
4351
-		list, _ := service.FindAllDataConfigList(orgId, dataConfig.ID)
4352
-		for _, it := range list {
4353
-			if drugDoseUnit == it.Name {
4354
-				unit_id = int64(it.Value)
4489
+
4490
+		drug.PrescribingNumberUnit = prescribing_number_unit
4491
+
4492
+		drug_day := goodNameM["drug_day"].(string)
4493
+
4494
+		if len(drug_day) == 0 {
4495
+			err_log := models.ExportErrLog{
4496
+				LogType:    4,
4497
+				UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
4498
+				ErrMsg:     "第" + strconv.Itoa(index+2) + "行" + "的天数不能为空",
4499
+				Status:     1,
4500
+				CreateTime: time.Now().Unix(),
4501
+				UpdateTime: time.Now().Unix(),
4502
+				ExportTime: time.Now().Unix(),
4355 4503
 			}
4504
+			service.CreateExportErrLog(&err_log)
4505
+			continue
4356 4506
 		}
4357
-		drug.DrugDoseUnit = unit_id
4507
+
4508
+		drug.DrugDay = drug_day
4509
+
4510
+		lmt_used_flags := int64(goodNameM["lmt_used_flag"].(float64))
4511
+
4512
+		drug.LmtUsedFlag = lmt_used_flags
4358 4513
 
4359 4514
 		if goodNameM["drug_alias"] == nil || reflect.TypeOf(goodNameM["drug_alias"]).String() != "string" {
4360 4515
 			utils.ErrorLog("drug_alias")
@@ -4399,7 +4554,6 @@ func (this *StockManagerApiController) AddDrugInformation() {
4399 4554
 		}
4400 4555
 
4401 4556
 		drugCategoryList, _ := service.GetParentDataConfig(drugCategoryConfig.ID, orgId)
4402
-		fmt.Println("drugCategoryList", drugCategoryList)
4403 4557
 		for _, it := range drugCategoryList {
4404 4558
 			if drug_category == it.Name {
4405 4559
 				drug_category_id = int64(it.Value)
@@ -4557,6 +4711,26 @@ func (this *StockManagerApiController) AddDrugInformation() {
4557 4711
 
4558 4712
 	if len(drugList) > 0 {
4559 4713
 		for _, item := range drugList {
4714
+			hans := item.DrugName // 要转换的汉字字符串
4715
+			// 创建一个拼音转换器
4716
+			p := pinyin.NewArgs()
4717
+
4718
+			// 将汉字转为拼音
4719
+			pinyinSlice := pinyin.Pinyin(hans, p)
4720
+
4721
+			// 输出拼音
4722
+			fmt.Println("Pinyin:", pinyinSlice)
4723
+
4724
+			// 获取首字母
4725
+			firstLetter := ""
4726
+			for _, py := range pinyinSlice {
4727
+				if len(py) > 0 {
4728
+					firstLetter += string(py[0][0])
4729
+				}
4730
+			}
4731
+
4732
+			item.FirstLetter = firstLetter
4733
+			item.Pinyin = firstLetter
4560 4734
 			goodInfo := models.BaseDrugLib{
4561 4735
 				DrugName:                    item.DrugName,
4562 4736
 				DrugAlias:                   item.DrugAlias,
@@ -4608,6 +4782,9 @@ func (this *StockManagerApiController) AddDrugInformation() {
4608 4782
 				MinNumber:                   item.MinNumber,
4609 4783
 				IsUse:                       2,
4610 4784
 				MinPrice:                    item.MinPrice,
4785
+				PrescribingNumber:           item.PrescribingNumber,
4786
+				PrescribingNumberUnit:       item.PrescribingNumberUnit,
4787
+				FirstLetter:                 item.FirstLetter,
4611 4788
 			}
4612 4789
 
4613 4790
 			//查询同种药品同种规格是否存在
@@ -7998,3 +8175,21 @@ func (this *StockManagerApiController) GetStockFlowOrderList() {
7998 8175
 
7999 8176
 	}
8000 8177
 }
8178
+
8179
+func (this *StockManagerApiController) GetGoodPatientName() {
8180
+
8181
+	good_id, _ := this.GetInt64("good_id")
8182
+
8183
+	sys_record_time, _ := this.GetInt64("sys_record_time")
8184
+
8185
+	orgId := this.GetAdminUserInfo().CurrentOrgId
8186
+
8187
+	projectList, _ := service.GetGoodProjectList(good_id, sys_record_time, orgId)
8188
+
8189
+	outList, _ := service.GetWarehouseOutListBySysrecordTime(good_id, sys_record_time, orgId)
8190
+
8191
+	this.ServeSuccessJSON(map[string]interface{}{
8192
+		"projectList": projectList,
8193
+		"outList":     outList,
8194
+	})
8195
+}

+ 1 - 0
models/dialysis.go Visa fil

@@ -658,6 +658,7 @@ type AssessmentAfterDislysis struct {
658 658
 	TransfusionVolume               string  `gorm:"column:transfusion_volume" json:"transfusion_volume" form:"transfusion_volume"`
659 659
 	Condenser                       string  `gorm:"column:condenser" json:"condenser" form:"condenser"`
660 660
 	LastAfterWeight                 string  `gorm:"column:last_after_weight" json:"last_after_weight" form:"last_after_weight"`
661
+	DisplaceLiquiValue              string  `gorm:"column:displace_liqui_value" json:"displace_liqui_value" form:"displace_liqui_value"`
661 662
 }
662 663
 
663 664
 func (AssessmentAfterDislysis) TableName() string {

+ 1 - 0
models/new_stock_models.go Visa fil

@@ -172,6 +172,7 @@ type NewBaseDrugOne struct {
172 172
 	Manufacturer           int64                  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
173 173
 	Dealer                 int64                  `gorm:"column:dealer" json:"dealer" form:"dealer"`
174 174
 	MedicalInsuranceNumber string                 `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
175
+	DrugType               int64                  `gorm:"column:drug_type" json:"drug_type" form:"drug_type"`
175 176
 }
176 177
 
177 178
 func (NewBaseDrugOne) TableName() string {

+ 2 - 0
models/patient_models.go Visa fil

@@ -231,6 +231,7 @@ type Patients struct {
231 231
 	AllergicHistory          string  `gorm:"column:allergic_history" json:"allergic_history" form:"allergic_history"`
232 232
 	PatientAddress           string  `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
233 233
 	FirstLetter              string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
234
+	PrintDate                int64   `gorm:"column:print_date" json:"print_date" form:"print_date"`
234 235
 }
235 236
 
236 237
 func (Patients) TableName() string {
@@ -857,6 +858,7 @@ type XtPatientsNew struct {
857 858
 	AllergicHistory              string  `gorm:"column:allergic_history" json:"allergic_history" form:"allergic_history"`
858 859
 	PatientAddress               string  `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
859 860
 	FirstLetter                  string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
861
+	PrintDate                    int64   `gorm:"column:print_date" json:"print_date" form:"print_date"`
860 862
 }
861 863
 
862 864
 func (XtPatientsNew) TableName() string {

+ 5 - 5
models/smart_sch.go Visa fil

@@ -14,11 +14,11 @@ func (SmartSchPatient) TableName() string {
14 14
 }
15 15
 
16 16
 type SmartSchTemplatePatient struct {
17
-	ID         int64  `gorm:"column:id" json:"id" form:"id"`
18
-	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
19
-	Name       string `gorm:"column:name" json:"name" form:"name"`
20
-	DialysisNo string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
21
-
17
+	ID                          int64  `gorm:"column:id" json:"id" form:"id"`
18
+	UserOrgId                   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
19
+	Name                        string `gorm:"column:name" json:"name" form:"name"`
20
+	DialysisNo                  string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
21
+	Lapseto                     int64  `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
22 22
 	XtPatientScheduleTemplateId []*XtPatientScheduleTemplateId
23 23
 }
24 24
 

+ 3 - 0
models/user_models.go Visa fil

@@ -199,6 +199,9 @@ type XtDialysisPrescription struct {
199 199
 	Epo                        string  `gorm:"column:epo" json:"epo" form:"epo"`
200 200
 	EpoCount                   float64 `gorm:"column:epo_count" json:"epo_count" form:"epo_count"`
201 201
 	BloodAccessPartId          string  `gorm:"column:blood_access_part_id" json:"blood_access_part_id" form:"blood_access_part_id"`
202
+	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
203
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
204
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
202 205
 }
203 206
 
204 207
 func (XtDialysisPrescription) TableName() string {

+ 11 - 2
service/dialysis_service.go Visa fil

@@ -1,13 +1,14 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"encoding/json"
6 5
 	"fmt"
7
-	"github.com/jinzhu/gorm"
8 6
 	"strconv"
9 7
 	"strings"
10 8
 	"time"
9
+
10
+	"XT_New/models"
11
+	"github.com/jinzhu/gorm"
11 12
 )
12 13
 
13 14
 // GetPatientList 返回患者的列表
@@ -303,6 +304,14 @@ func UpadateReceiveTreatmentAsses(receiveTreatmentAsses *models.ReceiveTreatment
303 304
 	return err
304 305
 }
305 306
 
307
+func GetPredialysisEvaluation(patient_id int64, org_id int64) (models.PredialysisEvaluation, error) {
308
+
309
+	evaluation := models.PredialysisEvaluation{}
310
+
311
+	err := XTReadDB().Where("patient_id = ? and user_org_id = ? and status =1 and symptom_before_dialysis!=''", patient_id, org_id).Last(&evaluation).Error
312
+	return evaluation, err
313
+}
314
+
306 315
 // 修改透前评估
307 316
 func UpadatePredialysisEvaluation(predialysisEvaluation *models.PredialysisEvaluation) error {
308 317
 	err := writeDb.Save(&predialysisEvaluation).Error

+ 14 - 4
service/mobile_dialysis_service.go Visa fil

@@ -1,12 +1,13 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5 4
 	"encoding/json"
6 5
 	"fmt"
7
-	"github.com/jinzhu/gorm"
8 6
 	"strconv"
9 7
 	"time"
8
+
9
+	"XT_New/models"
10
+	"github.com/jinzhu/gorm"
10 11
 )
11 12
 
12 13
 // func GetSchedualPatients(orgID int64) ([]*MDialysisScheduleVM, error) {
@@ -1139,6 +1140,7 @@ func MobileGetLastTimeAssessmentAfterDislysis(orgID int64, patientID int64, maxD
1139 1140
 
1140 1141
 	// cur_date := time.Now().Format("2006-01-02")
1141 1142
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(maxDate, 10) + ":assessment_after_dislysis_last"
1143
+	redis.Set(key, "", time.Second)
1142 1144
 	assessment_after_dislysis_last_str, _ := redis.Get(key).Result()
1143 1145
 
1144 1146
 	if len(assessment_after_dislysis_last_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -2348,11 +2350,10 @@ func MobileGetDialysisSolutionByModeId(orgID int64, patientID int64, mode_id int
2348 2350
 
2349 2351
 	// cur_date := time.Now().Format("2006-01-02")
2350 2352
 	key := strconv.FormatInt(orgID, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_solution"
2351
-
2352 2353
 	dialysis_solution_str, _ := redis.Get(key).Result()
2353 2354
 
2354 2355
 	if len(dialysis_solution_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2355
-		err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
2356
+		err := readDb.Model(&models.DialysisSolution{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ? and solution_status=1", patientID, orgID, mode_id).Last(&record).Error
2356 2357
 		if err != nil {
2357 2358
 			if err == gorm.ErrRecordNotFound {
2358 2359
 				if record.ID <= 0 {
@@ -3170,6 +3171,15 @@ func GetAssessmentBeforThrity(orgid int64, patientid int64, recorddate int64) (m
3170 3171
 	return evaluation, err
3171 3172
 }
3172 3173
 
3174
+func GetAssessmentBeforFourty(orgid int64, patientid int64, recorddate int64) (models.XtAssessmentBeforeDislysis, error) {
3175
+
3176
+	evaluation := models.XtAssessmentBeforeDislysis{}
3177
+
3178
+	err := XTReadDB().Model(&evaluation).Where("user_org_id = ? and patient_id = ? and assessment_date = ? and status = 1", orgid, patientid, recorddate).Find(&evaluation).Error
3179
+
3180
+	return evaluation, err
3181
+}
3182
+
3173 3183
 func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his []*models.HisDoctorAdviceInfo, err error) {
3174 3184
 	redis := RedisClient()
3175 3185
 	defer redis.Close()

+ 8 - 5
service/new_warehouse_service.go Visa fil

@@ -1,15 +1,16 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/utils"
6 4
 	"errors"
7 5
 	"fmt"
8
-	"github.com/jinzhu/gorm"
9 6
 	"math"
10 7
 	"strconv"
11 8
 	"strings"
12 9
 	"time"
10
+
11
+	"XT_New/models"
12
+	"XT_New/utils"
13
+	"github.com/jinzhu/gorm"
13 14
 )
14 15
 
15 16
 // 耗材出库
@@ -2631,13 +2632,13 @@ func FindNewDrugAutoReduceRecordInfo(patient_id int64, advice_date int64, orgid
2631 2632
 
2632 2633
 func UpdateDrugAutoReduceRecordInfo(patient_id int64, record_date int64, drug_id int64, detail *models.DrugAutomaticReduceDetail) error {
2633 2634
 
2634
-	err := XTWriteDB().Model(&models.DrugAutomaticReduceDetail{}).Where("patient_id = ? and record_date = ? and drug_id = ?", patient_id, record_date, drug_id).Update(map[string]interface{}{"patient_id": detail.PatientId, "record_time": detail.RecordTime, "drug_id": detail.DrugId, "count": detail.Count, "count_unit": detail.CountUnit, "warehouse_info_id": detail.WarehouseInfoId, "advice_id": detail.AdviceId, "storehouse_id": detail.StorehouseId}).Error
2635
+	err := XTWriteDB().Model(&models.DrugAutomaticReduceDetail{}).Where("patient_id = ? and record_time = ? and drug_id = ?", patient_id, record_date, drug_id).Update(map[string]interface{}{"patient_id": detail.PatientId, "record_time": detail.RecordTime, "drug_id": detail.DrugId, "count": detail.Count, "count_unit": detail.CountUnit, "warehouse_info_id": detail.WarehouseInfoId, "advice_id": detail.AdviceId, "storehouse_id": detail.StorehouseId}).Error
2635 2636
 	return err
2636 2637
 }
2637 2638
 
2638 2639
 func UpdateNewDrugAutoReduceRecordInfo(patient_id int64, record_date int64, drug_id int64, detail *models.DrugAutomaticReduceDetail, tx *gorm.DB) error {
2639 2640
 
2640
-	err := tx.Model(&models.DrugAutomaticReduceDetail{}).Where("patient_id = ? and record_date = ? and drug_id = ?", patient_id, record_date, drug_id).Update(map[string]interface{}{"patient_id": detail.PatientId, "record_time": detail.RecordTime, "drug_id": detail.DrugId, "count": detail.Count, "count_unit": detail.CountUnit, "warehouse_info_id": detail.WarehouseInfoId, "advice_id": detail.AdviceId, "storehouse_id": detail.StorehouseId}).Error
2641
+	err := tx.Model(&models.DrugAutomaticReduceDetail{}).Where("patient_id = ? and record_time = ? and drug_id = ?", patient_id, record_date, drug_id).Update(map[string]interface{}{"patient_id": detail.PatientId, "record_time": detail.RecordTime, "drug_id": detail.DrugId, "count": detail.Count, "count_unit": detail.CountUnit, "warehouse_info_id": detail.WarehouseInfoId, "advice_id": detail.AdviceId, "storehouse_id": detail.StorehouseId}).Error
2641 2642
 	if err != nil {
2642 2643
 		tx.Rollback()
2643 2644
 		return err
@@ -3910,6 +3911,8 @@ func NewBloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehous
3910 3911
 			lastDrugOutInfo, _ := GetNewNewDrugWarehouseOutInfoSix(advice.DrugId, advice.PatientId, advice.RecordDate, advice.UserOrgId, advice.ID, warehouse.ID, tx)
3911 3912
 
3912 3913
 			if lastDrugOutInfo.ID == 0 {
3914
+				//删除在新增
3915
+				UpdateNewDrugWarehouseOutInfoTen(lastDrugOutInfo.PatientId, lastDrugOutInfo.SysRecordTime, advice.ID, tx)
3913 3916
 				AddNewSigleDrugWarehouseOutInfo(warehouseOutInfo, tx)
3914 3917
 			}
3915 3918
 			if lastDrugOutInfo.ID > 0 {

+ 18 - 3
service/patient_service.go Visa fil

@@ -1,14 +1,15 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/utils"
6 4
 	"encoding/json"
7 5
 	"fmt"
8 6
 	"strconv"
9 7
 	"strings"
10 8
 	"time"
11 9
 
10
+	"XT_New/models"
11
+	"XT_New/utils"
12
+
12 13
 	"github.com/jinzhu/gorm"
13 14
 )
14 15
 
@@ -901,7 +902,7 @@ func UpdatePatientLapseto(patientid int64, lapseto models.PatientLapseto) error
901 902
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
902 903
 
903 904
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
904
-		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime, "patient_end_time": patientsNew.PatientEndTime, "infectious_remark": patientsNew.InfectiousRemark, "allergic_history": patientsNew.AllergicHistory, "patient_address": patientsNew.PatientAddress}).Error
905
+		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime, "patient_end_time": patientsNew.PatientEndTime, "infectious_remark": patientsNew.InfectiousRemark, "allergic_history": patientsNew.AllergicHistory, "patient_address": patientsNew.PatientAddress, "print_date": patientsNew.PrintDate}).Error
905 906
 	return err
906 907
 }
907 908
 
@@ -4024,3 +4025,17 @@ func DeleteSolutionById(id int64) (models.DialysisSolution, error) {
4024 4025
 
4025 4026
 	return solution, err
4026 4027
 }
4028
+
4029
+func GetPatientBeforRecordList(patient_id int64, user_org_id int64) (befor []*models.XtAssessmentBeforeDislysis, err error) {
4030
+
4031
+	err = XTReadDB().Where("patient_id = ? and user_org_id =? and status=1", patient_id, user_org_id).Order("id desc").Limit(5).Find(&befor).Error
4032
+
4033
+	return befor, err
4034
+}
4035
+
4036
+func GetPatientAfterRecordList(patient_id int64, user_org_id int64) (after []*models.XtAssessmentAfterDislysis, err error) {
4037
+
4038
+	err = XTReadDB().Where("patient_id = ? and user_org_id =? and status=1", patient_id, user_org_id).Order("id desc").Limit(5).Find(&after).Error
4039
+
4040
+	return after, err
4041
+}

+ 46 - 23
service/schedule_service.go Visa fil

@@ -956,9 +956,10 @@ func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64,
956 956
 	return list, err
957 957
 }
958 958
 
959
-func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType int64, zone []string) (list []*models.VmSchedulesRemind, err error) {
959
+func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType int64, zone []string, limit int64, page int64, ids []string) (list []*models.VmSchedulesRemind, total int64, err error) {
960 960
 
961 961
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
962
+	offset := (page - 1) * limit
962 963
 	if orgid > 0 {
963 964
 		db = db.Where("x.user_org_id = ?", orgid)
964 965
 	}
@@ -972,20 +973,20 @@ func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType in
972 973
 		db = db.Where("x.partition_id in (?)", zone)
973 974
 	}
974 975
 
975
-	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1 and dialysis_date = ?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
976
-		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
977
-	}).Preload("DialysisPrescription", "status = 1 and record_date =? and user_org_id = ?", scheduleDate, orgid).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
978
-		return db.Where("status =1 and solution_status = 1").Order("id asc")
979
-	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
980
-		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate).Limit(1)
981
-	}).Find(&list).Error
976
+	if len(ids) > 0 {
977
+		db = db.Where("x.patient_id in(?)", ids)
978
+	}
982 979
 
983
-	return list, err
980
+	err = db.Offset(offset).Limit(limit).Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Count(&total).Find(&list).Error
981
+
982
+	return list, total, err
984 983
 }
985 984
 
986
-func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone []string) (list []*models.VmSchedulesRemind, err error) {
985
+func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone []string, limit int64, page int64, ids []string) (list []*models.VmSchedulesRemind, total int64, err error) {
987 986
 
988 987
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
988
+	offset := (page - 1) * limit
989
+
989 990
 	if orgid > 0 {
990 991
 		db = db.Where("x.user_org_id = ?", orgid)
991 992
 	}
@@ -998,16 +999,13 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
998 999
 	if len(zone) > 0 {
999 1000
 		db = db.Where("x.partition_id in (?)", zone)
1000 1001
 	}
1002
+	if len(ids) > 0 {
1003
+		db = db.Where("x.patient_id in(?)", ids)
1004
+	}
1001 1005
 
1002
-	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export,x.mode_id").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1 and dialysis_date =?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
1003
-		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
1004
-	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date = ?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
1005
-		return db.Where("status =1 and solution_status =1").Order("id asc")
1006
-	}).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
1007
-		return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgid, scheduleDate).Limit(1)
1008
-	}).Find(&list).Error
1006
+	err = db.Offset(offset).Limit(limit).Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export,x.mode_id").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Count(&total).Find(&list).Error
1009 1007
 
1010
-	return list, err
1008
+	return list, total, err
1011 1009
 }
1012 1010
 
1013 1011
 func RemoveRepeatedElement(arr []*models.DoctorAdvice) (newArr []*models.DoctorAdvice) {
@@ -1167,7 +1165,7 @@ func UpdateNewScheduleTemplateStatus(id int64, org_id int64) (err error) {
1167 1165
 	return
1168 1166
 }
1169 1167
 
1170
-func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone []string, record_date int64) (schedules []*models.WeekScheduleSix, err error) {
1168
+func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone []string, record_date int64, ids []string) (schedules []*models.WeekScheduleSix, err error) {
1171 1169
 
1172 1170
 	db := XTReadDB().Table("xt_schedule as s ").Where("s.status =1")
1173 1171
 	if orgID > 0 {
@@ -1197,6 +1195,9 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
1197 1195
 	if len(zone) > 0 {
1198 1196
 		db = db.Where("s.partition_id in (?)", zone)
1199 1197
 	}
1198
+	if len(ids) > 0 {
1199
+		db = db.Where("s.patient_id in (?)", ids)
1200
+	}
1200 1201
 	err = db.
1201 1202
 		Preload("DeviceZone", "status = 1 ").
1202 1203
 		Preload("DeviceNumber", "status = 1 ").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
@@ -1365,7 +1366,7 @@ func GetDataPrint(orgid int64) (models.XtDataPrint, error) {
1365 1366
 func GetNextWeekPanels(startime int64, endtime int64, orgid int64) (schedule []*models.XtSchedule, err error) {
1366 1367
 
1367 1368
 	err = XTReadDB().Model(&schedule).Where("schedule_date >=? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
1368
-		return db.Where("user_org_id = ? and status = 1 and  assessment_date>=1672502400  and assessment_date < ?", orgid, endtime)
1369
+		return db.Where("user_org_id = ? and status = 1 and  assessment_date>=1704038400  and assessment_date < ?", orgid, endtime)
1369 1370
 	}).Find(&schedule).Error
1370 1371
 	return schedule, err
1371 1372
 }
@@ -1514,14 +1515,33 @@ func GetHisDoctorAdviceList(org_id int64, patient_id int64, dialysis_date int64)
1514 1515
 	return adviceInfo, err
1515 1516
 }
1516 1517
 
1517
-func GetLastDialysisSolution(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1518
+func GetDoctorAdviceListSchedule(org_id int64, patient_id int64) (advices []*models.DoctorAdvice, err error) {
1519
+
1520
+	err = XTReadDB().Where("patient_id=? and user_org_id = ?  and status=1 and parent_id=0 and advice_type =1", patient_id, org_id).Preload("ChildDoctorAdvice", "status = 1").Find(&advices).Error
1521
+	return advices, err
1522
+}
1523
+
1524
+func GetLastDialysisPrescriptionTwo(org_id int64, patient_id int64, mode_id int64, schedule_date int64) (models.NewDialysisPrescription, error) {
1518 1525
 
1519 1526
 	dialysisprescription := models.NewDialysisPrescription{}
1520
-	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and record_date>=1672502400 and record_date<?", org_id, patient_id, mode_id, schedule_date).Order("id desc").First(&dialysisprescription).Error
1527
+	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode_id = ? and status = 1 and record_date>=1704038400 and record_date<?", org_id, patient_id, mode_id, schedule_date).Order("id desc").First(&dialysisprescription).Error
1521 1528
 	return dialysisprescription, err
1522 1529
 
1523 1530
 }
1524 1531
 
1532
+func GetLastDialysisSolution(org_id int64, patient_id int64, mode_id int64) (models.DialysisSolution, error) {
1533
+	dialysisSolution := models.DialysisSolution{}
1534
+	err := XTReadDB().Where("user_org_id =? and patient_id = ? and mode_id = ? and status=1 and solution_status=1", org_id, patient_id, mode_id).Find(&dialysisSolution).Error
1535
+	return dialysisSolution, err
1536
+}
1537
+
1538
+func GetLastDialysisAfter(org_id int64, patient_id int64, schedule_date int64) (models.AssessmentAfterDislysis, error) {
1539
+
1540
+	dislysis := models.AssessmentAfterDislysis{}
1541
+	err := XTReadDB().Where("user_org_id = ? and patient_id =? and assessment_date <= ? and status=1", org_id, patient_id, schedule_date).Order("id desc").Last(&dislysis).Error
1542
+	return dislysis, err
1543
+}
1544
+
1525 1545
 func GetDoctorAdviceLastWeek(org_id int64, patient_id int64, schedule_date int64) (advice []*models.DoctorAdvice, err error) {
1526 1546
 
1527 1547
 	err = XTReadDB().Where("user_org_id = ? and patient_id = ? and status= 1 and parent_id = 0 and advice_date = ?", org_id, patient_id, schedule_date).Preload("ChildDoctorAdvice", "status = 1 and advice_date = ?", schedule_date).Find(&advice).Error
@@ -1543,7 +1563,7 @@ func GetDialysisSolutionLastWeek(user_org_id int64, patient_id int64, mode_id in
1543 1563
 	return solution, err
1544 1564
 }
1545 1565
 
1546
-func GetNextWeekDayScheduleSix(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone []string, record_date int64) (schedules []*models.WeekScheduleSeven, err error) {
1566
+func GetNextWeekDayScheduleSix(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone []string, record_date int64, ids []string) (schedules []*models.WeekScheduleSeven, err error) {
1547 1567
 
1548 1568
 	db := XTReadDB().Table("xt_schedule as s ").Where("s.status =1")
1549 1569
 	if orgID > 0 {
@@ -1574,6 +1594,9 @@ func GetNextWeekDayScheduleSix(weektype int64, weektime int64, startime int64, e
1574 1594
 	if len(zone) > 0 {
1575 1595
 		db = db.Where("s.partition_id in (?)", zone)
1576 1596
 	}
1597
+	if len(ids) > 0 {
1598
+		db = db.Where("s.patient_id in(?)", ids)
1599
+	}
1577 1600
 	err = db.
1578 1601
 		Preload("DeviceZone", "status = 1 ").
1579 1602
 		Preload("DeviceNumber", "status = 1 ").

+ 72 - 0
service/self_drug_service.go Visa fil

@@ -3214,3 +3214,75 @@ func GetNewDrugFlowNoPofitWarehouseInfo(drug_id int64, user_org_id int64, start_
3214 3214
 	err = db.Find(&list).Error
3215 3215
 	return list, err
3216 3216
 }
3217
+
3218
+func GetHisAdviceGroupList(drug_id int64, user_org_id int64) (advicelist []*models.HisDoctorAdviceInfo, err error) {
3219
+
3220
+	if user_org_id == 10265 {
3221
+		err = XTReadDB().Where("drug_id = ? and user_org_id = ? and status=1 and execution_state =1", drug_id, user_org_id).Order("advice_date asc").Find(&advicelist).Error
3222
+
3223
+		return advicelist, err
3224
+	} else {
3225
+		err = XTReadDB().Where("drug_id = ? and user_org_id = ? and status=1", drug_id, user_org_id).Order("advice_date asc").Find(&advicelist).Error
3226
+
3227
+		return advicelist, err
3228
+	}
3229
+
3230
+}
3231
+
3232
+func GetDrugWarehousOutInfo(drug_id int64, org_id int64) (out []*models.XtDrugWarehouseOutInfo, err error) {
3233
+
3234
+	err = XTReadDB().Where("drug_id = ? and status=1 and org_id=? and is_sys=1", drug_id, org_id).Order("sys_record_time asc").Find(&out).Error
3235
+	return out, err
3236
+}
3237
+
3238
+func GetDrugWarehousOutInfoOne(drug_id int64, org_id int64) (out []*models.XtDrugWarehouseOutInfo, err error) {
3239
+
3240
+	err = XTReadDB().Where("drug_id = ? and status=1 and org_id=? and is_sys=0", drug_id, org_id).Order("sys_record_time asc").Find(&out).Error
3241
+	return out, err
3242
+}
3243
+
3244
+func GetCheckDrugFlow(drug_id int64, user_org_id int64) (drugflow []*models.DrugFlow, err error) {
3245
+
3246
+	err = XTReadDB().Where("drug_id =? and status=1 and (consumable_type =10 or consumable_type =11) and user_org_id = ?", drug_id, user_org_id).Order("system_time asc").Find(&drugflow).Error
3247
+	return drugflow, err
3248
+}
3249
+
3250
+func GetCheckGoodBatchList(good_id int64, user_org_id int64) (project []*models.HisPrescriptionProject, err error) {
3251
+
3252
+	err = XTReadDB().Where("project_id = ? and user_org_id = ? and status =1 and type =3", good_id, user_org_id).Order("record_date asc").Find(&project).Error
3253
+
3254
+	return project, err
3255
+}
3256
+
3257
+func GetCheckGoodWarehouseList(good_id int64, org_id int64) (info []*models.WarehouseOutInfo, err error) {
3258
+
3259
+	err = XTReadDB().Where("good_id = ? and org_id = ? and status=1 and is_sys=0", good_id, org_id).Order("sys_record_time").Find(&info).Error
3260
+	return info, err
3261
+}
3262
+
3263
+func GetHisAdviceListBySysRrecordTime(drug_id int64, sys_record_time int64, user_org_id int64) (info []*models.HisDoctorAdviceInfo, err error) {
3264
+
3265
+	err = XTReadDB().Where("drug_id=? and advice_date = ? and user_org_id = ? and status =1", drug_id, sys_record_time, user_org_id).Find(&info).Error
3266
+
3267
+	return info, err
3268
+}
3269
+
3270
+func GetDrugWarehouseOutInfoBySysRecordTime(drug_id int64, sys_record_time int64, user_org_id int64) (info []*models.DrugWarehouseOutInfo, err error) {
3271
+
3272
+	err = XTReadDB().Where("drug_id=? and sys_record_time =? and org_id = ? and status =1", drug_id, sys_record_time, user_org_id).Find(&info).Error
3273
+
3274
+	return info, err
3275
+}
3276
+
3277
+func GetGoodProjectList(good_id int64, sys_record_time int64, user_org_id int64) (project []*models.HisPrescriptionProject, err error) {
3278
+
3279
+	err = XTReadDB().Where("project_id = ? and status =1 and record_date = ? and user_org_id=? and type =3", good_id, sys_record_time, user_org_id).Find(&project).Error
3280
+
3281
+	return project, err
3282
+}
3283
+
3284
+func GetWarehouseOutListBySysrecordTime(good_id int64, sys_record_time int64, user_org_id int64) (out []*models.WarehouseOutInfo, err error) {
3285
+
3286
+	err = XTReadDB().Where("good_id = ? and sys_record_time =? and org_id = ? and status=1 and is_sys=1", good_id, sys_record_time, user_org_id).Find(&out).Error
3287
+	return out, err
3288
+}

+ 3 - 2
service/smart_sch.go Visa fil

@@ -1,9 +1,10 @@
1 1
 package service
2 2
 
3 3
 import (
4
+	"time"
5
+
4 6
 	"XT_New/models"
5 7
 	"github.com/jinzhu/gorm"
6
-	"time"
7 8
 )
8 9
 
9 10
 func GetSmartSchPatientByKeyWord(orgID int64, keywords string) (patient []*models.SmartSchPatient, err error) {
@@ -56,7 +57,7 @@ func GetSmartSchPatientByPatientID(orgID int64, id int64) (sch []*models.SmartSc
56 57
 }
57 58
 
58 59
 func GetSmartSchTemplatePatientByKeyWord(orgID int64, keywords string) (patient []*models.SmartSchTemplatePatient, err error) {
59
-	db := readDb.Model(&models.SmartSchTemplatePatient{}).Where("user_org_id=? and status=1", orgID)
60
+	db := readDb.Model(&models.SmartSchTemplatePatient{}).Where("user_org_id=? and status=1 and lapseto=1", orgID)
60 61
 	if len(keywords) > 0 {
61 62
 		likekey := "%" + keywords + "%"
62 63
 		err = db.Where("name LIKE ? OR dialysis_no LIKE ? ", likekey, likekey).Find(&patient).Error

+ 14 - 6
service/stock_service.go Visa fil

@@ -878,10 +878,13 @@ func FindLastDrugWarehousingInfoByID(drug_id int64, storehouse_id int64) (info m
878 878
 
879 879
 func FindNewLastDrugWarehousingInfoByID(drug_id int64, storehouse_id int64, tx *gorm.DB) (info models.XtDrugWarehouseInfo, err error) {
880 880
 	err = tx.Model(&models.XtDrugWarehouseInfo{}).Where("drug_id = ? AND status = 1 AND (stock_max_number > 0 or stock_min_number > 0) and storehouse_id = ? and is_check = 1", drug_id, storehouse_id).Order("ctime").First(&info).Error
881
-	if err != nil {
882
-		tx.Rollback()
883
-		return info, err
881
+	if err != gorm.ErrRecordNotFound {
882
+		if err != nil {
883
+			tx.Rollback()
884
+			return info, err
885
+		}
884 886
 	}
887
+
885 888
 	return info, err
886 889
 }
887 890
 
@@ -2023,10 +2026,13 @@ func GetManufactureById(id int64) (models.Manufacturer, error) {
2023 2026
 func GetNewManufactureById(id int64, tx *gorm.DB) (models.Manufacturer, error) {
2024 2027
 	manufacturer := models.Manufacturer{}
2025 2028
 	err := tx.Model(&manufacturer).Where("id = ? and status = 1", id).Find(&manufacturer).Error
2026
-	if err != nil {
2027
-		tx.Rollback()
2028
-		return manufacturer, err
2029
+	if err != gorm.ErrRecordNotFound {
2030
+		if err != nil {
2031
+			tx.Rollback()
2032
+			return manufacturer, err
2033
+		}
2029 2034
 	}
2035
+
2030 2036
 	return manufacturer, err
2031 2037
 }
2032 2038
 
@@ -2740,6 +2746,7 @@ func UpDateDrugWarehouseInfoByStock(info *models.XtDrugWarehouseInfo) (err error
2740 2746
 
2741 2747
 func UpDateNewDrugWarehouseInfoByStock(info *models.XtDrugWarehouseInfo, tx *gorm.DB) (err error) {
2742 2748
 	err = tx.Save(&info).Error
2749
+
2743 2750
 	if err != nil {
2744 2751
 		tx.Rollback()
2745 2752
 		return err
@@ -8912,6 +8919,7 @@ func GetNewWarehouseOutInfoIsExistTen(good_id int64, patient_id int64, record_ti
8912 8919
 	err := tx.Where("good_id = ? and sys_record_time = ? and status = 1 and patient_id = ? and project_id = ? and warehouse_info_id = ?", good_id, record_time, patient_id, project_id, warehouse_info_id).Find(&info).Error
8913 8920
 	if err != gorm.ErrRecordNotFound {
8914 8921
 		if err != nil {
8922
+			tx.Rollback()
8915 8923
 			return info, err
8916 8924
 		}
8917 8925
 	}

+ 9 - 7
service/warhouse_service.go Visa fil

@@ -1,16 +1,17 @@
1 1
 package service
2 2
 
3 3
 import (
4
-	"XT_New/models"
5
-	"XT_New/utils"
6 4
 	"errors"
7 5
 	"fmt"
8 6
 	_ "fmt"
9
-	"github.com/jinzhu/gorm"
10 7
 	"math"
11 8
 	"strconv"
12 9
 	"strings"
13 10
 	"time"
11
+
12
+	"XT_New/models"
13
+	"XT_New/utils"
14
+	"github.com/jinzhu/gorm"
14 15
 )
15 16
 
16 17
 // 药品出库
@@ -6022,7 +6023,7 @@ func AutoDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, warehous
6022 6023
 		CreateDrugFlowOne(drugflow)
6023 6024
 
6024 6025
 		//更新出库id
6025
-		UpdateDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count)
6026
+		UpdateDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price)
6026 6027
 
6027 6028
 		return nil
6028 6029
 
@@ -6089,7 +6090,7 @@ func AutoDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, warehous
6089 6090
 
6090 6091
 		CreateDrugFlowOne(drugflow)
6091 6092
 		//更新出库id
6092
-		UpdateDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count)
6093
+		UpdateDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price)
6093 6094
 		// 出库完成后,要将该批次库存清零
6094 6095
 
6095 6096
 		prescribingNumber_two_temp := deliver_number - stock_number
@@ -6102,9 +6103,9 @@ func AutoDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, warehous
6102 6103
 	return
6103 6104
 }
6104 6105
 
6105
-func UpdateDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64, over_count int64) error {
6106
+func UpdateDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64, over_count int64, drug_price float64) error {
6106 6107
 	ut := XTWriteDB().Begin()
6107
-	err = ut.Model(&models.DrugWarehouseOutInfo{}).Where("id = ? and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count}).Error
6108
+	err = ut.Model(&models.DrugWarehouseOutInfo{}).Where("id = ? and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "price": drug_price, "retail_price": drug_price}).Error
6108 6109
 	if err != nil {
6109 6110
 		ut.Rollback()
6110 6111
 		return err
@@ -6194,6 +6195,7 @@ func FindLastDrugWarehouseOutInfo(orgid int64) (models.DrugWarehouseOutInfo, err
6194 6195
 func FindNewLastDrugWarehouseOutInfo(orgid int64, tx *gorm.DB) (models.DrugWarehouseOutInfo, error) {
6195 6196
 	info := models.DrugWarehouseOutInfo{}
6196 6197
 	err := tx.Where("org_id = ? and status = 1", orgid).Last(&info).Error
6198
+
6197 6199
 	if err != gorm.ErrRecordNotFound {
6198 6200
 		if err != nil {
6199 6201
 			tx.Rollback()