28169 9 meses atrás
pai
commit
53a2e72517

+ 6 - 6
controllers/base_api_controller.go Ver arquivo

83
 		userAdmin.ModifyTime = 1530786071
83
 		userAdmin.ModifyTime = 1530786071
84
 		var subscibe models.ServeSubscibe
84
 		var subscibe models.ServeSubscibe
85
 		subscibe.ID = 11
85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 9671 //机构id
86
+		subscibe.OrgId = 10702 //机构id
87
 		subscibe.PeriodStart = 1547447814
87
 		subscibe.PeriodStart = 1547447814
88
 		subscibe.PeriodEnd = 1550039814
88
 		subscibe.PeriodEnd = 1550039814
89
 		subscibe.State = 1
89
 		subscibe.State = 1
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94
 		subscibes[4] = &subscibe
94
 		subscibes[4] = &subscibe
95
 		var adminUserInfo service.AdminUserInfo
95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 9671 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 3244 //4
96
+		adminUserInfo.CurrentOrgId = 10702 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 3244  //4
98
 		adminUserInfo.AdminUser = &userAdmin
98
 		adminUserInfo.AdminUser = &userAdmin
99
 		adminUserInfo.Subscibes = subscibes
99
 		adminUserInfo.Subscibes = subscibes
100
 		this.SetSession("admin_user_info", &adminUserInfo)
100
 		this.SetSession("admin_user_info", &adminUserInfo)
329
 		userAdmin.ModifyTime = 1530786071
329
 		userAdmin.ModifyTime = 1530786071
330
 		var subscibe models.ServeSubscibe
330
 		var subscibe models.ServeSubscibe
331
 		subscibe.ID = 11
331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 9671 //机构id小英9675或4
332
+		subscibe.OrgId = 10702 //机构id小英9675或4
333
 		subscibe.PeriodStart = 1538035409
333
 		subscibe.PeriodStart = 1538035409
334
 		subscibe.PeriodEnd = 1569571409
334
 		subscibe.PeriodEnd = 1569571409
335
 		subscibe.State = 1
335
 		subscibe.State = 1
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340
 		subscibes[4] = &subscibe
340
 		subscibes[4] = &subscibe
341
 		var adminUserInfo service.AdminUserInfo
341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 9671 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 3244 //4
342
+		adminUserInfo.CurrentOrgId = 10702 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 3244  //4
344
 		adminUserInfo.AdminUser = &userAdmin
344
 		adminUserInfo.AdminUser = &userAdmin
345
 		adminUserInfo.Subscibes = subscibes
345
 		adminUserInfo.Subscibes = subscibes
346
 		this.SetSession("admin_user_info", &adminUserInfo)
346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 22 - 0
controllers/dialysis_api_controller.go Ver arquivo

3173
 			}
3173
 			}
3174
 		}
3174
 		}
3175
 
3175
 
3176
+		//针对孝昌康桥超滤率计算问题
3177
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10635 {
3178
+			if assessmentBeforeDislysis.ID == 0 {
3179
+				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3180
+				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3181
+					dewater_amount = assessmentBeforeDislysis.WeightBefore - assessmentBeforeDislysis.DryWeight - assessmentBeforeDislysis.AdditionalWeight
3182
+
3183
+					service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
3184
+				}
3185
+			}
3186
+
3187
+			if assessmentBeforeDislysis.ID > 0 {
3188
+				dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.CurrentOrgId, patient, recordDate.Unix())
3189
+				if dialysisPrescribeOne.ID > 0 && assessmentBeforeDislysis.ID > 0 {
3190
+					dewater_amount = assessmentBeforeDislysis.WeightBefore - assessmentBeforeDislysis.DryWeight - assessmentBeforeDislysis.AdditionalWeight
3191
+
3192
+					service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
3193
+				}
3194
+			}
3195
+
3196
+		}
3197
+
3176
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
3198
 		err := service.UpadatePredialysisEvaluation(&assessmentBeforeDislysis)
3177
 
3199
 
3178
 		//创建步骤表
3200
 		//创建步骤表

+ 98 - 44
controllers/his_api_controller.go Ver arquivo

3657
 								timeFormat := tempTime.Format("20060102150405")
3657
 								timeFormat := tempTime.Format("20060102150405")
3658
 								s.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "1" + "-" + strconv.FormatInt(s.ID, 10)
3658
 								s.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "1" + "-" + strconv.FormatInt(s.ID, 10)
3659
 
3659
 
3660
-								//查询改药品是否已经停用
3661
-								base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
3660
+								if s.ID == 0 {
3661
+									//查询改药品是否已经停用
3662
+									base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
3662
 
3663
 
3663
-								if base.ID > 0 {
3664
-									tx.Rollback()
3665
-									c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
3666
-									return
3664
+									if base.ID > 0 {
3665
+										tx.Rollback()
3666
+										c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
3667
+										return
3668
+
3669
+									}
3670
+
3671
+									drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
3667
 
3672
 
3673
+									if drugMedical.SumCount == 0 {
3674
+										tx.Rollback()
3675
+										c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
3676
+										return
3677
+
3678
+									}
3668
 								}
3679
 								}
3669
 
3680
 
3670
-								drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
3681
+								//赤峰
3682
+								if adminInfo.CurrentOrgId == 10265 {
3671
 
3683
 
3672
-								if drugMedical.SumCount == 0 {
3673
-									tx.Rollback()
3674
-									c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
3675
-									return
3684
+									drug, _ := service.FindNewBaseDrugLibRecord(adminInfo.CurrentOrgId, s.DrugId, tx)
3685
+
3686
+									info, _ := service.FindNewLastDrugWarehousingInfoByID(s.DrugId, storeConfig.DrugStorehouseOut, tx)
3676
 
3687
 
3688
+									if info.RetailPrice > 0 {
3689
+										if s.DeliveryWay == "口服" {
3690
+											if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
3691
+												s.Price = drug.RetailPrice
3692
+											}
3693
+											if s.PrescribingNumberUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
3694
+												s.Price = info.RetailPrice
3695
+											}
3696
+
3697
+											if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
3698
+												s.Price = info.RetailPrice
3699
+											}
3700
+										}
3701
+
3702
+									}
3677
 								}
3703
 								}
3678
 
3704
 
3679
 								service.CreateHisDoctorAdviceOne(&s, tx)
3705
 								service.CreateHisDoctorAdviceOne(&s, tx)
3749
 								}
3775
 								}
3750
 
3776
 
3751
 								if p.Type == 3 {
3777
 								if p.Type == 3 {
3752
-									//查询该耗材是否停用
3753
-									goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
3754
-									//表示该耗材已经停用,不能保存
3755
-									if goodInfoSeven.ID == 0 {
3756
-										goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3757
-										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
3758
-										return
3759
-									}
3760
 
3778
 
3761
-									goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3762
-									if goodInfoOne.SumCount == 0 {
3763
-										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
3764
-										return
3779
+									if p.ID == 0 {
3780
+										//查询该耗材是否停用
3781
+										goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
3782
+										//表示该耗材已经停用,不能保存
3783
+										if goodInfoSeven.ID == 0 {
3784
+											goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3785
+											c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
3786
+											return
3787
+										}
3788
+
3789
+										goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
3790
+										if goodInfoOne.SumCount == 0 {
3791
+											c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
3792
+											return
3793
+										}
3765
 									}
3794
 									}
3766
 
3795
 
3767
 								}
3796
 								}
4463
 									}
4492
 									}
4464
 								}
4493
 								}
4465
 
4494
 
4466
-								//查询改药品是否已经停用
4467
-								base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
4495
+								if s.ID == 0 {
4496
+									//查询改药品是否已经停用
4497
+									base, _ := service.GetBasedrugById(s.DrugId, s.UserOrgId)
4468
 
4498
 
4469
-								if base.ID > 0 {
4470
-									c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
4471
-									return
4499
+									if base.ID > 0 {
4500
+										c.ServeDynamicFailJsonSend(base.DrugName + "已停用!请更换其他药品")
4501
+										return
4472
 
4502
 
4473
-								}
4503
+									}
4474
 
4504
 
4475
-								drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
4505
+									drugMedical, _ := service.GetBaseDrugMedical(s.DrugId)
4476
 
4506
 
4477
-								if drugMedical.SumCount == 0 {
4478
-									c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
4479
-									return
4507
+									if drugMedical.SumCount == 0 {
4508
+										c.ServeDynamicFailJsonSend(drugMedical.DrugName + "库存不足,保存失败!")
4509
+										return
4510
+
4511
+									}
4512
+								}
4513
+
4514
+								//赤峰
4515
+								if s.UserOrgId == 10265 {
4516
+									drug, _ := service.GetDrugByGoodId(s.DrugId)
4517
+									info, _ := service.GetWarehoseInfoByDrugId(s.DrugId, s.UserOrgId)
4518
+									if info.RetailPrice > 0 {
4519
+										if s.DeliveryWay == "口服" {
4520
+											if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit != drug.MinUnit {
4521
+												s.Price = drug.RetailPrice
4522
+											}
4523
+											if s.PrescribingNumberUnit == drug.MinUnit && drug.MaxUnit != drug.MinUnit {
4524
+												s.Price = info.RetailPrice
4525
+											}
4480
 
4526
 
4527
+											if s.PrescribingNumberUnit == drug.MaxUnit && drug.MaxUnit == drug.MinUnit {
4528
+												s.Price = info.RetailPrice
4529
+											}
4530
+										}
4531
+									}
4481
 								}
4532
 								}
4482
 
4533
 
4483
 								service.CreateHisDoctorAdvice(&s)
4534
 								service.CreateHisDoctorAdvice(&s)
4577
 								}
4628
 								}
4578
 
4629
 
4579
 								if p.Type == 3 {
4630
 								if p.Type == 3 {
4580
-									//查询该耗材是否停用
4581
-									goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
4582
-									//表示该耗材已经停用,不能保存
4583
-									if goodInfoSeven.ID == 0 {
4631
+									if p.ID == 0 {
4632
+										//查询该耗材是否停用
4633
+										goodInfoSeven, _ := service.GetGoodByIdIsStop(p.ProjectId, adminInfo.CurrentOrgId)
4634
+										//表示该耗材已经停用,不能保存
4635
+										if goodInfoSeven.ID == 0 {
4636
+											goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4637
+											c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
4638
+											return
4639
+										}
4640
+
4584
 										goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4641
 										goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4585
-										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材已经停用,保存失败!")
4586
-										return
4642
+										if goodInfoOne.SumCount == 0 {
4643
+											c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
4644
+											return
4645
+										}
4587
 									}
4646
 									}
4588
 
4647
 
4589
-									goodInfoOne, _ := service.GetGoodInformationByGoodIdOne(p.ProjectId)
4590
-									if goodInfoOne.SumCount == 0 {
4591
-										c.ServeDynamicFailJsonSend(goodInfoOne.GoodName + "耗材无库存,保存失败!")
4592
-										return
4593
-									}
4594
 								}
4648
 								}
4595
 
4649
 
4596
 								service.CreateHisProjectTwo(&p)
4650
 								service.CreateHisProjectTwo(&p)

+ 29 - 5
controllers/inspection_api_controller.go Ver arquivo

1
 package controllers
1
 package controllers
2
 
2
 
3
 import (
3
 import (
4
-	"XT_New/enums"
5
-	"XT_New/models"
6
-	"XT_New/service"
7
-	"XT_New/utils"
8
 	"encoding/json"
4
 	"encoding/json"
9
 	"fmt"
5
 	"fmt"
10
-	"github.com/astaxie/beego"
11
 	"strconv"
6
 	"strconv"
12
 	"strings"
7
 	"strings"
13
 	"time"
8
 	"time"
9
+
10
+	"XT_New/enums"
11
+	"XT_New/models"
12
+	"XT_New/service"
13
+	"XT_New/utils"
14
+	"github.com/astaxie/beego"
14
 )
15
 )
15
 
16
 
16
 type InspectionApiController struct {
17
 type InspectionApiController struct {
34
 
35
 
35
 	beego.Router("/api/patient/inspection_remind/set", &InspectionApiController{}, "Get:SetInspectionRemind")
36
 	beego.Router("/api/patient/inspection_remind/set", &InspectionApiController{}, "Get:SetInspectionRemind")
36
 
37
 
38
+	beego.Router("/api/getnewinspectionList", &InspectionApiController{}, "Get:GetNewInspectionList")
39
+
37
 }
40
 }
38
 func (c *InspectionApiController) SetInspectionRemind() {
41
 func (c *InspectionApiController) SetInspectionRemind() {
39
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
42
 	remind_cycle, _ := c.GetInt64("remind_cycle", 0)
866
 
869
 
867
 	adminUserInfo := c.GetAdminUserInfo()
870
 	adminUserInfo := c.GetAdminUserInfo()
868
 	inspections, total, dateTime, err := service.GetPatientInspections(adminUserInfo.CurrentOrgId, patient, projectId, page)
871
 	inspections, total, dateTime, err := service.GetPatientInspections(adminUserInfo.CurrentOrgId, patient, projectId, page)
872
+
869
 	fmt.Println("inspections", inspections)
873
 	fmt.Println("inspections", inspections)
870
 	if err != nil {
874
 	if err != nil {
871
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
875
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
1073
 	return
1077
 	return
1074
 
1078
 
1075
 }
1079
 }
1080
+
1081
+func (c *InspectionApiController) GetNewInspectionList() {
1082
+
1083
+	patient, _ := c.GetInt64("patient")
1084
+
1085
+	project_id, _ := c.GetInt64("project_id")
1086
+
1087
+	orgId := c.GetAdminUserInfo().CurrentOrgId
1088
+
1089
+	inspection, _ := service.GetNewInspectionList(patient, project_id, orgId)
1090
+
1091
+	inspectionGroup, _ := service.GetNewGroupInspectionList(patient, project_id, orgId)
1092
+
1093
+	inspectionInspectDateGroup, _ := service.GetNewGroupInspectionInspectionList(patient, project_id, orgId)
1094
+	c.ServeSuccessJSON(map[string]interface{}{
1095
+		"inspectionGroup": inspectionGroup,
1096
+		"inspection":      inspection,
1097
+		"list":            inspectionInspectDateGroup,
1098
+	})
1099
+}

+ 20 - 0
controllers/mobile_api_controllers/patient_api_controller.go Ver arquivo

3974
 
3974
 
3975
 	}
3975
 	}
3976
 
3976
 
3977
+	//针对孝昌康桥超滤率计算问题
3978
+	if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10635 {
3979
+		if evaluation.ID == 0 {
3980
+			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
3981
+			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
3982
+				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3983
+				service.UpdateMobileGetDialysisPrescribe(dialysisPrescribeOne.ID, dewater_amount)
3984
+			}
3985
+		}
3986
+
3987
+		if evaluation.ID > 0 {
3988
+			dialysisPrescribeOne, _ := service.MobileGetDialysisPrescribeOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
3989
+			if dialysisPrescribeOne.ID > 0 && evaluation.ID > 0 {
3990
+				dewater_amount = evaluation.WeightBefore - evaluation.DryWeight - evaluation.AdditionalWeight
3991
+				service.UpdateMobileGetDialysisPrescribeOne(dialysisPrescribeOne.ID, dewater_amount)
3992
+			}
3993
+		}
3994
+
3995
+	}
3996
+
3977
 	err = service.UpadatePredialysisEvaluation(&evaluation)
3997
 	err = service.UpadatePredialysisEvaluation(&evaluation)
3978
 
3998
 
3979
 	//记录日志
3999
 	//记录日志

+ 1 - 1
routers/router.go Ver arquivo

11
 func init() {
11
 func init() {
12
 	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
12
 	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
13
 		//AllowAllOrigins:  true,
13
 		//AllowAllOrigins:  true,
14
-		AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://localhost:9529", "http://localhost:9531", "http://xt.test.shengws.com", "http://new_mobile.test.sgjyun.com", "https://api.xt.test.sgjyun.com", "https://xt.test.shengws.com", "http://xt.test.sgjyun.com", "https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com", "https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com", "http://mobile.sgjyun.com", "http://mobile.kuyicloud.com", "https://mobile.kuyicloud.com"},
14
+		AllowOrigins: []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://localhost:9529", "http://localhost:9531", "http://xt.test.shengws.com", "http://new_mobile.test.sgjyun.com", "https://api.xt.test.sgjyun.com", "https://xt.test.shengws.com", "http://xt.test.sgjyun.com", "https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com", "https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com", "http://mobile.sgjyun.com", "http://mobile.kuyicloud.com", "https://mobile.kuyicloud.com", ""},
15
 		//AllowOrigins:     []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://xt.test.shengws.com","https://xt.test.shengws.com", "http://xt.test.sgjyun.com","https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com","https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com","http://mobile.sgjyun.com","http://mobile.kuyicloud.com"},
15
 		//AllowOrigins:     []string{"https://xt.kuyicloud.com", "http://localhost:9528", "http://xt.test.shengws.com","https://xt.test.shengws.com", "http://xt.test.sgjyun.com","https://xt.test.sgjyun.com", "http://localhost:8081", "http://localhost:8082", "https://pad.kuyicloud.com", "http://pad.kuyicloud.com", "http://pad.test.sgjyun.com","https://pad.test.sgjyun.com", "http://admin.xt.test.sgjyun.com", "http://admin.xt.kuyicloud.com","http://mobile.sgjyun.com","http://mobile.kuyicloud.com"},
16
 		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
16
 		AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
17
 		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "X-XSRF-TOKEN", "Permission", "KyToken"},
17
 		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type", "X-XSRF-TOKEN", "Permission", "KyToken"},

+ 20 - 0
service/inspection_service.go Ver arquivo

415
 
415
 
416
 	return inspection, err
416
 	return inspection, err
417
 }
417
 }
418
+
419
+func GetNewInspectionList(patient_id int64, project_id int64, user_org_id int64) (inspection []*models.Inspection, err error) {
420
+
421
+	err = XTReadDB().Where("patient_id = ? and project_id = ? and org_id = ?", patient_id, project_id, user_org_id).Find(&inspection).Error
422
+
423
+	return inspection, err
424
+}
425
+
426
+func GetNewGroupInspectionList(patient_id int64, project_id int64, user_org_id int64) (inspection []*models.Inspection, err error) {
427
+
428
+	err = XTReadDB().Where("patient_id = ? and project_id = ? and org_id = ?", patient_id, project_id, user_org_id).Group("item_id").Find(&inspection).Error
429
+
430
+	return inspection, err
431
+}
432
+
433
+func GetNewGroupInspectionInspectionList(patient_id int64, project_id int64, user_org_id int64) (inspection []*models.Inspection, err error) {
434
+
435
+	err = XTReadDB().Where("patient_id = ? and project_id = ? and org_id = ?", patient_id, project_id, user_org_id).Group("inspect_date").Order("inspect_date asc").Find(&inspection).Error
436
+	return inspection, err
437
+}

+ 19 - 0
service/mobile_dialysis_service.go Ver arquivo

1264
 	return &record, nil
1264
 	return &record, nil
1265
 }
1265
 }
1266
 
1266
 
1267
+func MobileGetDialysisPrescribeOne(orgID int64, patientID int64, recordDate int64) (models.DialysisPrescription, error) {
1268
+	var record models.DialysisPrescription
1269
+	err = readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 and record_date = ?", patientID, orgID, recordDate).Find(&record).Error
1270
+
1271
+	return record, nil
1272
+}
1273
+
1274
+func UpdateMobileGetDialysisPrescribe(id int64, dewater_amount float64) error {
1275
+
1276
+	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id=? and status=1", id).Updates(map[string]interface{}{"target_ultrafiltration": dewater_amount, "prescription_water": dewater_amount}).Error
1277
+	return err
1278
+}
1279
+
1280
+func UpdateMobileGetDialysisPrescribeOne(id int64, dewater_amount float64) error {
1281
+
1282
+	err := XTWriteDB().Model(&models.DialysisPrescription{}).Where("id=? and status=1", id).Updates(map[string]interface{}{"target_ultrafiltration": dewater_amount}).Error
1283
+	return err
1284
+}
1285
+
1267
 func MobileGetDialysisSchedual(orgID int64, patientID int64, scheduleDate int64) (*models.XtSchedule, error) {
1286
 func MobileGetDialysisSchedual(orgID int64, patientID int64, scheduleDate int64) (*models.XtSchedule, error) {
1268
 	var schedule models.XtSchedule
1287
 	var schedule models.XtSchedule
1269
 	err := readDb.Model(&models.XtSchedule{}).Where("patient_id = ? and user_org_id = ? and status = 1 and schedule_date = ?", patientID, orgID, scheduleDate).First(&schedule).Error
1288
 	err := readDb.Model(&models.XtSchedule{}).Where("patient_id = ? and user_org_id = ? and status = 1 and schedule_date = ?", patientID, orgID, scheduleDate).First(&schedule).Error