소스 검색

2024/6/17

28169 11 달 전
부모
커밋
7d906c3949

+ 4 - 4
controllers/base_api_controller.go 파일 보기

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

+ 20 - 15
controllers/drug_stock_api_contorller.go 파일 보기

@@ -3787,7 +3787,6 @@ func (c *StockDrugApiController) CheckDrugOut() {
3787 3787
 	orgId := c.GetAdminUserInfo().CurrentOrgId
3788 3788
 	warehousingOutInfoList, _ := service.GetDrugWarehouseOutListById(warehouse_out_id, orgId)
3789 3789
 	drugWarehouseOut, _ := service.GetDrugWarehouseOutByLastId(warehouse_out_id)
3790
-	storeHouseConfig, _ := service.GetAllStoreHouseConfig(orgId)
3791 3790
 
3792 3791
 	for _, it := range warehousingOutInfoList {
3793 3792
 		var total_count int64
@@ -3850,7 +3849,7 @@ func (c *StockDrugApiController) CheckDrugOut() {
3850 3849
 			out_count_one = it.Count
3851 3850
 		}
3852 3851
 
3853
-		service.AddDrugCount(it.DrugId, it.OrgId, storeHouseConfig.DrugStorehouseOut, out_count_one)
3852
+		service.AddDrugCount(it.DrugId, it.OrgId, it.StorehouseId, out_count_one)
3854 3853
 
3855 3854
 	}
3856 3855
 	warehousingOutInfoListThree, _ := service.GetDrugWarehouseOutListById(warehouse_out_id, orgId)
@@ -3861,7 +3860,7 @@ func (c *StockDrugApiController) CheckDrugOut() {
3861 3860
 		service.AutoDrugDeliverInfoFourtyOne(orgId, it.Count, &drugWarehouseOut, &drup, it, it.CountUnit)
3862 3861
 
3863 3862
 		//查询剩余库存
3864
-		stockInfo, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, it.OrgId, it.DrugId)
3863
+		stockInfo, _ := service.GetDrugAllStockInfo(it.StorehouseId, it.OrgId, it.DrugId)
3865 3864
 		var sum_count int64
3866 3865
 		for _, its := range stockInfo {
3867 3866
 			if its.MaxUnit == medical.MaxUnit {
@@ -3869,11 +3868,19 @@ func (c *StockDrugApiController) CheckDrugOut() {
3869 3868
 			}
3870 3869
 			sum_count += its.StockMaxNumber + its.StockMinNumber
3871 3870
 		}
3872
-		//更新基础库库存
3873
-		service.UpdateBaseDrugSumTwo(it.DrugId, sum_count, it.OrgId)
3874
-
3875
-		service.UpdateDrugStockCount(it.DrugId, it.OrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
3871
+		service.UpdateDrugStockCount(it.DrugId, it.OrgId, it.StorehouseId, sum_count)
3876 3872
 
3873
+		storeHouseConfig, _ := service.GetAllStoreHouseConfig(orgId)
3874
+		stockInfoOne, _ := service.GetDrugAllStockInfo(storeHouseConfig.DrugStorehouseOut, it.OrgId, it.DrugId)
3875
+		var sum_count_one int64
3876
+		for _, its := range stockInfoOne {
3877
+			if its.MaxUnit == medical.MaxUnit {
3878
+				its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
3879
+			}
3880
+			sum_count_one += its.StockMaxNumber + its.StockMinNumber
3881
+		}
3882
+		//更新基础库库存
3883
+		service.UpdateBaseDrugSumTwo(it.DrugId, sum_count_one, it.OrgId)
3877 3884
 	}
3878 3885
 
3879 3886
 	out := models.DrugWarehouseOut{
@@ -3994,24 +4001,22 @@ func (c *StockDrugApiController) ToReturnCheck() {
3994 4001
 			out_count = item.Count
3995 4002
 		}
3996 4003
 		//增加出库数量
3997
-		service.ReduceDrugCount(item.DrugId, item.OrgId, storeHouseConfig.DrugStorehouseOut, out_count)
4004
+		service.ReduceDrugCount(item.DrugId, item.OrgId, item.StorehouseId, out_count)
3998 4005
 
3999 4006
 		//查询该药品剩余库存
4000
-		infolist, _ := service.FindDrugWarehouseInfoFlushCountByStorehouse(item.DrugId, item.OrgId, storeHouseConfig.DrugStorehouseOut)
4007
+		infolist, _ := service.FindDrugWarehouseInfoFlushCountByStorehouse(item.DrugId, item.OrgId, item.StorehouseId)
4001 4008
 		var over_count int64
4002 4009
 		for _, its := range infolist {
4003 4010
 			baseDrug, _ := service.GetBaseDrugMedical(its.DrugId)
4004
-			fmt.Println("ITS", its.MaxUnit)
4005
-			fmt.Println("itwowoowow", baseDrug.MaxUnit)
4011
+
4006 4012
 			if its.MaxUnit == baseDrug.MaxUnit {
4007 4013
 				its.StockMaxNumber = its.StockMaxNumber * baseDrug.MinNumber
4008 4014
 			}
4009
-			fmt.Println("its.StockMaxNumber", its.StockMaxNumber)
4010
-			fmt.Println("its.StockMinNumber", its.StockMinNumber)
4015
+
4011 4016
 			over_count += its.StockMaxNumber + its.StockMinNumber
4012 4017
 		}
4013
-		fmt.Println("over_coutnwowowowowo", over_count)
4014
-		service.UpdateDrugStockCount(item.DrugId, item.OrgId, storeHouseConfig.DrugStorehouseOut, over_count)
4018
+
4019
+		service.UpdateDrugStockCount(item.DrugId, item.OrgId, item.StorehouseId, over_count)
4015 4020
 
4016 4021
 	}
4017 4022
 	c.ServeSuccessJSON(map[string]interface{}{

+ 47 - 3
controllers/his_api_controller.go 파일 보기

@@ -1696,6 +1696,10 @@ func (c *HisApiController) GetHisPatientInfo() {
1696 1696
 
1697 1697
 	//获取所有科室信息
1698 1698
 	department, _ := service.GetAllDepartMent(admin.CurrentOrgId)
1699
+
1700
+	beforThrity, _ := service.GetAssessmentBeforThrity(admin.CurrentOrgId, patient_id, recordDateTime)
1701
+
1702
+	LastCaseHistory, _ := service.GetLastHisPatientCaseHistory(admin.CurrentOrgId, patient_id)
1699 1703
 	c.ServeSuccessJSON(map[string]interface{}{
1700 1704
 		"his_info":     his_patient_info,
1701 1705
 		"xt_info":      xt_patient_info,
@@ -1712,6 +1716,8 @@ func (c *HisApiController) GetHisPatientInfo() {
1712 1716
 		"count":              count,
1713 1717
 		"drugStockConfig":    drugStockConfig,
1714 1718
 		"last_info":          lastPatientPrescriptionInfo,
1719
+		"befor":              beforThrity,
1720
+		"LastCaseHistory":    LastCaseHistory,
1715 1721
 	})
1716 1722
 	return
1717 1723
 
@@ -3423,6 +3429,11 @@ func (c *HisApiController) CreateHisPrescription() {
3423 3429
 
3424 3430
 										}
3425 3431
 
3432
+										fmt.Println("药品名称----------------------", drug.DrugName)
3433
+										fmt.Println("药品名称----------------------", drug.IsUse)
3434
+										fmt.Println("is_user_total-------------------------", is_user_total)
3435
+										fmt.Println("no_user_total-------------------------", no_user_total)
3436
+
3426 3437
 										if is_user_total != no_user_total {
3427 3438
 											//出库
3428 3439
 											if drug.IsUse == 2 {
@@ -3543,9 +3554,9 @@ func (c *HisApiController) CreateHisPrescription() {
3543 3554
 													history_count += prescribingNumberSevenTy
3544 3555
 												}
3545 3556
 
3546
-												//fmt.Println("local_count0000000000000000000000000000000000000000000", local_count)
3547
-												//
3548
-												//fmt.Println("history_count999999999999999999999999999999999999999", history_count)
3557
+												fmt.Println("drug_nam,e---------------", drug.DrugName)
3558
+												fmt.Println("local_count0000000000000000000000000000000000000000000", local_count)
3559
+												fmt.Println("history_count999999999999999999999999999999999999999", history_count)
3549 3560
 
3550 3561
 												//如果当前出库数量大于历史出库数量则需要出库
3551 3562
 												if local_count > history_count {
@@ -3570,6 +3581,12 @@ func (c *HisApiController) CreateHisPrescription() {
3570 3581
 													service.NewHisDrugAutoCancelInfo(s.UserOrgId, creater, newadviceInfo, cha_count, drug, tx)
3571 3582
 												}
3572 3583
 
3584
+												if local_count == history_count {
3585
+													if is_user_total == 0 {
3586
+														service.NewHisDrugsDelivery(s.UserOrgId, creater, newadviceInfo, tx)
3587
+													}
3588
+
3589
+												}
3573 3590
 											}
3574 3591
 
3575 3592
 											//更新字典里面的库存
@@ -3877,6 +3894,33 @@ func (c *HisApiController) CreateHisPrescription() {
3877 3894
 
3878 3895
 											}
3879 3896
 
3897
+											if nowCount == historyCount {
3898
+												if historyCount == 0 {
3899
+													recordDateStr := time.Now().Format("2006-01-02")
3900
+													recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
3901
+													nowtime := recordDate.Unix()
3902
+													lastOut, _ := service.FindNewLastPrescriptionWarehouseOut(adminInfo.CurrentOrgId, nowtime, tx)
3903
+													goodObj, _ := service.GetNewGoodInformationByGoodIdThirty(p.ProjectId, tx)
3904
+													houseConfig, _ := service.GetNewAllStoreHouseConfig(p.UserOrgId, tx)
3905
+													creater := c.GetAdminUserInfo().AdminUser.Id
3906
+													dialyPrepareOne := models.DialysisBeforePrepare{
3907
+														GoodTypeId:   goodObj.GoodTypeId,
3908
+														GoodId:       p.ProjectId,
3909
+														PatientId:    p.PatientId,
3910
+														RecordDate:   p.RecordDate,
3911
+														UserOrgId:    adminInfo.CurrentOrgId,
3912
+														Count:        nowCount,
3913
+														Ctime:        time.Now().Unix(),
3914
+														Creater:      creater,
3915
+														Status:       1,
3916
+														StorehouseId: houseConfig.StorehouseOutInfo,
3917
+														ProjectId:    p.ID,
3918
+													}
3919
+													//出库
3920
+													service.ConsumableNewHisPrescriptionDelivery(adminInfo.CurrentOrgId, p.PatientId, p.RecordDate, &dialyPrepareOne, &lastOut, creater, tx)
3921
+												}
3922
+											}
3923
+
3880 3924
 											//lastHisProject, _ := service.GetLastHisProject(p.PatientId, p.UserOrgId, p.RecordDate, tx, p.ProjectId)
3881 3925
 											////查询历史出库数据
3882 3926
 											//flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)

+ 9 - 2
controllers/mobile_api_controllers/dialysis_api_controller.go 파일 보기

@@ -1379,7 +1379,8 @@ func (c *DialysisAPIController) PostAssessmentAfterDislysis() {
1379 1379
 	channels, _ := c.GetInt64("channel", 0)
1380 1380
 	return_blood, _ := c.GetInt64("return_blood", 0)
1381 1381
 	rehydration_volume, _ := c.GetInt64("rehydration_volume", 0)
1382
-	dialysis_during, _ := c.GetInt64("dialysis_during", 0)
1382
+	//dialysis_during, _ := c.GetInt64("dialysis_during", 0)
1383
+	dialysis_during, _ := c.GetFloat("dialysis_during")
1383 1384
 	stroke_volume, _ := c.GetInt64("stroke_volume", 0)
1384 1385
 	blood_flow, _ := c.GetInt64("blood_flow", 0)
1385 1386
 	//sealing_fluid_dispose, _ := c.GetInt64("sealing_fluid_dispose", 0)
@@ -2739,6 +2740,10 @@ func (c *DialysisAPIController) Finish() {
2739 2740
 		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
2740 2741
 	}
2741 2742
 
2743
+	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 10617 {
2744
+		tempassessmentAfterDislysis.ActualUltrafiltration = endmonitorRecords.UltrafiltrationVolume
2745
+	}
2746
+
2742 2747
 	if endmonitorRecords.ID > 0 && adminUserInfo.Org.Id == 9829 {
2743 2748
 		tempassessmentAfterDislysis.SystolicBloodPressure = endmonitorRecords.SystolicBloodPressure
2744 2749
 		tempassessmentAfterDislysis.DiastolicBloodPressure = endmonitorRecords.DiastolicBloodPressure
@@ -3604,7 +3609,9 @@ func (this *DialysisAPIController) StartDialysis() {
3604 3609
 			record.DialysateTemperature = 36.5
3605 3610
 		}
3606 3611
 
3607
-		err := service.CreateMonitor(&record)
3612
+		if adminUserInfo.Org.Id != 10683 {
3613
+			err = service.CreateMonitor(&record)
3614
+		}
3608 3615
 
3609 3616
 		//记录日志
3610 3617
 		byterequest, _ := json.Marshal(record)

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

@@ -2998,6 +2998,8 @@ func (this *NewDialysisApiController) GetInspectionGroup() {
2998 2998
 
2999 2999
 	if len(inspection) > 0 {
3000 3000
 		for _, item := range inspection {
3001
+			lastInspection, _ := service.GetLastInspectionProject(item.PatientId, org_id, item.ProjectId)
3002
+			item.InspectDate = lastInspection.InspectDate
3001 3003
 			inspecList, _ := service.GetInspectionByProjectId(item.PatientId, org_id, item.ProjectId)
3002 3004
 			item.Count = int64(len(inspecList))
3003 3005
 		}

+ 1 - 1
controllers/self_drug_api_congtroller.go 파일 보기

@@ -4093,7 +4093,7 @@ func (this *SelfDrugApiController) GetDrugFlowDetailById() {
4093 4093
 
4094 4094
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4095 4095
 	list, _ := service.GetDrugFlowDetailById(drug_id, orgId)
4096
-	fmt.Println("list====================", list)
4096
+
4097 4097
 	drugMedical, _ := service.GetBaseDrugMedical(drug_id)
4098 4098
 
4099 4099
 	for index, _ := range list {

+ 1 - 1
models/dialysis.go 파일 보기

@@ -631,7 +631,7 @@ type AssessmentAfterDislysis struct {
631 631
 	CvcV                            float64 `gorm:"column:cvc_v" json:"cvc_v" form:"cvc_v"`
632 632
 	ReturnBlood                     int64   `gorm:"column:return_blood" json:"return_blood" form:"return_blood"`
633 633
 	RehydrationVolume               int64   `gorm:"column:rehydration_volume" json:"rehydration_volume" form:"rehydration_volume"`
634
-	DialysisDuring                  int64   `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
634
+	DialysisDuring                  float64 `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
635 635
 	StrokeVolume                    int64   `gorm:"column:stroke_volume" json:"stroke_volume" form:"stroke_volume"`
636 636
 	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
637 637
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`

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

@@ -314,7 +314,7 @@ func GetDrugInOrderDetail(startime int64, endtime int64, orgid int64, orderType
314 314
 	}
315 315
 
316 316
 	if len(keyword) > 0 {
317
-		db = db.Joins("left join sgj_xt.xt_drug_warehouse as o on o.id = x.warehousing_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater").Group("s.id")
317
+		db = db.Joins("left join sgj_xt.xt_drug_warehouse as o on o.id = x.warehousing_id  left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = o.creater")
318 318
 		db = db.Where("x.warehousing_order like ? or t.drug_name like ? or r.user_name like ? ", likeKey, likeKey, likeKey)
319 319
 
320 320
 	}

+ 8 - 0
service/his_service.go 파일 보기

@@ -339,6 +339,14 @@ func GetHisPatientCaseHistoryInfo(org_id int64, patient_id int64, record_date in
339 339
 	return
340 340
 }
341 341
 
342
+func GetLastHisPatientCaseHistory(org_id int64, patient_id int64) (models.HisPatientCaseHistory, error) {
343
+
344
+	patientCaseHistory := models.HisPatientCaseHistory{}
345
+	err := readDb.Where("user_org_id =? and status= 1 and patient_id = ?", org_id, patient_id).Last(&patientCaseHistory).Error
346
+
347
+	return patientCaseHistory, err
348
+}
349
+
342 350
 func GetHisPatientCaseHistoryList(org_id int64, patient_id int64) (caseHistorys []*models.HisPatientCaseHistory, err error) {
343 351
 	db := readDb.Model(&models.HisPatientCaseHistory{}).Where("user_org_id = ? AND status = 1  AND his_patient_id = ?", org_id, patient_id)
344 352
 	err = db.Find(&caseHistorys).Error

+ 10 - 1
service/inspection_service.go 파일 보기

@@ -368,6 +368,15 @@ func GetInspectionGroup(patient_id int64, org_id int64) (inspection []*models.Ne
368 368
 	return inspection, err
369 369
 }
370 370
 
371
+func GetLastInspectionProject(patient_id int64, org_id int64, project_id int64) (models.XtInspection, error) {
372
+
373
+	inspection := models.XtInspection{}
374
+
375
+	err := XTReadDB().Where("patient_id = ? and org_id = ? and project_id = ? and status=1", patient_id, org_id, project_id).Last(&inspection).Error
376
+
377
+	return inspection, err
378
+}
379
+
371 380
 func GetInspectionByProjectId(patient_id int64, org_id int64, project_id int64) (inspection []*models.NewInspection, err error) {
372 381
 
373 382
 	db := XTReadDB().Table("xt_inspection").Where("status =1")
@@ -382,7 +391,7 @@ func GetInspectionByProjectId(patient_id int64, org_id int64, project_id int64)
382 391
 		db = db.Where("project_id = ?", project_id)
383 392
 	}
384 393
 
385
-	err = db.Order("inspect_date desc").Group("inspect_date").Scan(&inspection).Error
394
+	err = db.Order("id asc").Group("inspect_date").Scan(&inspection).Error
386 395
 	return inspection, err
387 396
 
388 397
 }

+ 1 - 1
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go 파일 보기

@@ -378,7 +378,7 @@ type AssessmentAfterDislysisVM struct {
378 378
 	Channel                         int64   `gorm:"column:channel" json:"channel" form:"channel"`
379 379
 	ReturnBlood                     int64   `gorm:"column:return_blood" json:"return_blood" form:"return_blood"`
380 380
 	RehydrationVolume               int64   `gorm:"column:rehydration_volume" json:"rehydration_volume" form:"rehydration_volume"`
381
-	DialysisDuring                  int64   `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
381
+	DialysisDuring                  float64 `gorm:"column:dialysis_during" json:"dialysis_during" form:"dialysis_during"`
382 382
 	StrokeVolume                    int64   `gorm:"column:stroke_volume" json:"stroke_volume" form:"stroke_volume"`
383 383
 	BloodFlow                       int64   `gorm:"column:blood_flow" json:"blood_flow" form:"blood_flow"`
384 384
 	SealingFluidDispose             string  `gorm:"column:sealing_fluid_dispose" json:"sealing_fluid_dispose" form:"sealing_fluid_dispose"`

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

@@ -1153,7 +1153,7 @@ func DeleteSecondOrderInfo(id int64) error {
1153 1153
 
1154 1154
 func GetStockFlowOrderList(good_id int64, user_org_id int64) (list []*models.VmStockFlow, err error) {
1155 1155
 
1156
-	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1 and ctime>=1711900800", good_id, user_org_id).Order("id asc").Find(&list).Error
1156
+	err = XTReadDB().Where("good_id = ? and user_org_id =?  and status=1", good_id, user_org_id).Order("id asc").Find(&list).Error
1157 1157
 	return list, err
1158 1158
 }
1159 1159
 

+ 3 - 2
service/user_service.go 파일 보기

@@ -4,8 +4,9 @@ import (
4 4
 	"XT_New/models"
5 5
 
6 6
 	"fmt"
7
-	"github.com/jinzhu/gorm"
8 7
 	"time"
8
+
9
+	"github.com/jinzhu/gorm"
9 10
 )
10 11
 
11 12
 func GetAdminUserByUserID(userID int64) (*models.AdminUser, error) {
@@ -217,7 +218,7 @@ func GetAllHisDoctor(orgid int64) (appRole []*models.App_Role, err error) {
217 218
 
218 219
 func GetDrugFlowDetailById(drug_id int64, org_id int64) (flow []*models.DrugFlow, err error) {
219 220
 
220
-	err = XTReadDB().Model(&flow).Where("drug_id = ? and status =1 and user_org_id =?", drug_id, org_id).Order("id asc").Find(&flow).Error
221
+	err = XTReadDB().Model(&flow).Where("drug_id = ? and status =1 and user_org_id =?", drug_id, org_id).Order("ctime asc").Find(&flow).Error
221 222
 
222 223
 	return flow, err
223 224
 }