陈少旭 1 year ago
parent
commit
ad961ef630

+ 28 - 28
controllers/his_api_controller.go View File

@@ -1057,7 +1057,7 @@ func (c *HisApiController) GetPrivateExpensesOrder() {
1057 1057
 	printor_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, admin_user_id)
1058 1058
 	charge_admin, _ := service.GetAdminUserInfoByID(adminUser.CurrentOrgId, order.Creator)
1059 1059
 
1060
-	patient, _ := service.GetPatientByID(order.UserOrgId, order.PatientId)
1060
+	patient, _ := service.GetFaPiaoPatientByID(order.UserOrgId, order.PatientId)
1061 1061
 
1062 1062
 	c.ServeSuccessJSON(map[string]interface{}{
1063 1063
 		"patient":                                     patient,
@@ -7718,7 +7718,7 @@ func (c *HisApiController) GetAllOrderDetail() {
7718 7718
 	record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
7719 7719
 	org_id := c.GetAdminUserInfo().CurrentOrgId
7720 7720
 	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
7721
-	patient, _ := service.GetPatientByID(org_id, order.PatientId)
7721
+	patient, _ := service.GetFaPiaoPatientByID(org_id, order.PatientId)
7722 7722
 	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
7723 7723
 	c.ServeSuccessJSON(map[string]interface{}{
7724 7724
 		"order":           order,
@@ -7743,7 +7743,7 @@ func (c *HisApiController) GetAllOrderDetailCollect() {
7743 7743
 	org_id := c.GetAdminUserInfo().CurrentOrgId
7744 7744
 	adminInfo, _ := service.GetAdminUserInfoByID(org_id, order.Creator)
7745 7745
 	order_info, _ := service.GetHisOrderDetailByNumber(order.Number, org_id)
7746
-	patient, _ := service.GetPatientByID(org_id, order.PatientId)
7746
+	patient, _ := service.GetFaPiaoPatientByID(org_id, order.PatientId)
7747 7747
 
7748 7748
 	his, _ := service.GetHisPatientInfoThree(order.UserOrgId, order.MdtrtId)
7749 7749
 	//his, _ := service.Get(order.UserOrgId, order.MdtrtId)
@@ -8386,7 +8386,7 @@ func (c *HisApiController) GetFaPiaoData() {
8386 8386
 
8387 8387
 	his_hospital_record, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
8388 8388
 
8389
-	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
8389
+	patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
8390 8390
 
8391 8391
 	var bedCostTotal float64 = 0         //床位总费
8392 8392
 	var bedCostSelfTotal float64 = 0     //床位自费
@@ -9860,23 +9860,23 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
9860 9860
 
9861 9861
 	orderInfos, _ := service.GetHisOrderInfoByNumberOne(order.Number)
9862 9862
 	orderInfos_two, _ := service.GetHisOrderInfoByNumberTwo(order.Number)
9863
-	orderInfos_three, _ := service.GetHisOrderInfoByNumberThree(order.Number)
9863
+	//orderInfos_three, _ := service.GetHisOrderInfoByNumberThree(order.Number)
9864 9864
 
9865
-	var orderInfos_four []*models.HisOrderInfoTwo
9866
-	for _, item := range orderInfos_three {
9867
-		if item.HisPrescriptionProject.HisProject.CostClassify == 3 {
9868
-			item.HisPrescriptionProject.IsCheckTeam = 1
9869
-			orderInfos_four = append(orderInfos_four, item)
9870
-
9871
-		}
9872
-		if item.HisPrescriptionProject.HisProject.CostClassify != 3 {
9873
-			item.HisPrescriptionProject.IsCheckTeam = 2
9874
-			orderInfos_two = append(orderInfos_two, item)
9875
-		}
9876
-	}
9865
+	//var orderInfos_four []*models.HisOrderInfoTwo
9866
+	//for _, item := range orderInfos_three {
9867
+	//	if item.HisPrescriptionProject.HisProject.CostClassify == 3 {
9868
+	//		item.HisPrescriptionProject.IsCheckTeam = 1
9869
+	//		orderInfos_four = append(orderInfos_four, item)
9870
+	//
9871
+	//	}
9872
+	//	if item.HisPrescriptionProject.HisProject.CostClassify != 3 {
9873
+	//		item.HisPrescriptionProject.IsCheckTeam = 2
9874
+	//		orderInfos_two = append(orderInfos_two, item)
9875
+	//	}
9876
+	//}
9877 9877
 
9878 9878
 	//new_order_info := RemoveRepeatedTeam(orderInfos_four)
9879
-	var cus_slice []CustomOrderInfo
9879
+	//var cus_slice []CustomOrderInfo
9880 9880
 	//for _, item := range new_order_info {
9881 9881
 	//	var cus CustomOrderInfo
9882 9882
 	//	cus.Name = item.HisPrescriptionProject.XtHisProjectTeam.ProjectTeam
@@ -9896,20 +9896,20 @@ func (c *HisApiController) GetPrivateExpensesInfo() {
9896 9896
 
9897 9897
 	orderInfos = append(orderInfos, orderInfos_two...)
9898 9898
 	//if c.GetAdminUserInfo().CurrentOrgId != 10138 || c.GetAdminUserInfo().CurrentOrgId != 10278 {
9899
-	orderInfos = append(orderInfos, orderInfos_three...)
9899
+	//orderInfos = append(orderInfos, orderInfos_three...)
9900 9900
 
9901 9901
 	//}/**/
9902 9902
 
9903
-	patient, _ := service.GetPatientByID(org_id, order.PatientId)
9903
+	patient, _ := service.GetFaPiaoPatientByID(org_id, order.PatientId)
9904 9904
 	c.ServeSuccessJSON(map[string]interface{}{
9905
-		"order":          order,
9906
-		"order_info":     orderInfos,
9907
-		"patient":        patient,
9908
-		"admin_info":     adminInfo,
9909
-		"his":            his,
9910
-		"current_admin":  role,
9911
-		"org_config":     miConfig,
9912
-		"new_order_info": cus_slice,
9905
+		"order":         order,
9906
+		"order_info":    orderInfos,
9907
+		"patient":       patient,
9908
+		"admin_info":    adminInfo,
9909
+		"his":           his,
9910
+		"current_admin": role,
9911
+		"org_config":    miConfig,
9912
+		//"new_order_info": cus_slice,
9913 9913
 	})
9914 9914
 
9915 9915
 }

+ 2 - 2
controllers/his_project_api_controller.go View File

@@ -1560,7 +1560,7 @@ func (this *HisProjectApiController) GetChargePrint() {
1560 1560
 	adminUserInfo := this.GetAdminUserInfo()
1561 1561
 	chargePrint, err := service.GetChargePrint(recordDateTime, patient_id, adminUserInfo.CurrentOrgId)
1562 1562
 	prescription, err := service.GetHisPrescriptionNight(adminUserInfo.CurrentOrgId, patient_id, recordDateTime, prescription_id)
1563
-	patient, err := service.GetPatientByID(adminUserInfo.CurrentOrgId, patient_id)
1563
+	patient, err := service.GetFaPiaoPatientByID(adminUserInfo.CurrentOrgId, patient_id)
1564 1564
 	hisPatient, err := service.GetHisPatientById(patient_id)
1565 1565
 	if err != nil {
1566 1566
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
@@ -1648,7 +1648,7 @@ func (this *HisProjectApiController) GetPatientDetail() {
1648 1648
 
1649 1649
 	id, _ := this.GetInt64("id")
1650 1650
 	adminUserInfo := this.GetAdminUserInfo()
1651
-	patient, err := service.GetPatientByID(adminUserInfo.CurrentOrgId, id)
1651
+	patient, err := service.GetFaPiaoPatientByID(adminUserInfo.CurrentOrgId, id)
1652 1652
 	if err != nil {
1653 1653
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1654 1654
 		return

+ 2 - 2
controllers/his_summary_controller.go View File

@@ -46,7 +46,7 @@ func (this *HisSummaryApiController) GetHisSummaryDetailList() {
46 46
 	endRecordDateTime := endTime.Unix()
47 47
 
48 48
 	list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
49
-	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
49
+	patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
50 50
 
51 51
 	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
52 52
 
@@ -101,7 +101,7 @@ func (this *HisSummaryApiController) GetGatherDetaiList() {
101 101
 	endRecordDateTime := endTime.Unix()
102 102
 
103 103
 	list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
104
-	patient, _ := service.GetPatientByID(adminUser.CurrentOrgId, patient_id)
104
+	patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
105 105
 
106 106
 	his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
107 107
 

+ 1 - 1
controllers/inspection_api_controller.go View File

@@ -137,7 +137,7 @@ func (c *InspectionApiController) PatientInspectionReference() {
137 137
 		return
138 138
 	}
139 139
 
140
-	patient_info, _ := service.GetPatientByID(adminUserInfo.CurrentOrgId, patient)
140
+	patient_info, _ := service.GetFaPiaoPatientByID(adminUserInfo.CurrentOrgId, patient)
141 141
 
142 142
 	counts, err := service.GetPatientInspectionProjectCount(adminUserInfo.CurrentOrgId, patient)
143 143
 	if err != nil {

+ 1 - 1
controllers/statistics_api_controller.go View File

@@ -176,7 +176,7 @@ func (c *StatisticsApiController) GetPersonInspectionStatistisc() {
176 176
 		endTime = theTime.Unix()
177 177
 	}
178 178
 
179
-	patient, _ := service.GetPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
179
+	patient, _ := service.GetFaPiaoPatientByID(c.GetAdminUserInfo().CurrentOrgId, patient_id)
180 180
 	//获取配置
181 181
 	reference, _ := service.GetInspectionReferenceThree(project_id, item_id)
182 182
 	//获取数值在正常范围内的总数

+ 3 - 3
service/his_service.go View File

@@ -1858,9 +1858,9 @@ func GetHisOrderInfoByNumberOne(order_number string) (order []*models.HisOrderIn
1858 1858
 
1859 1859
 func GetHisOrderInfoByNumberTwo(order_number string) (order []*models.HisOrderInfoTwo, err error) {
1860 1860
 	db := readDb.Model(&models.HisOrderInfoTwo{})
1861
-	db = db.Joins("Join his_prescription_project as p  On p.id = his_order_info.project_id AND p.team_id = 0")
1861
+	db = db.Joins("Join his_prescription_project as p  On p.id = his_order_info.project_id")
1862 1862
 	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1863
-		return db.Preload("XtHisProjectTeam", "status = 1").Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
1863
+		return db.Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
1864 1864
 	})
1865 1865
 	err = db.Where("his_order_info.order_number = ? AND his_order_info.status = 1 AND his_order_info.project_id > 0 ", order_number).Find(&order).Error
1866 1866
 	return
@@ -1871,7 +1871,7 @@ func GetHisOrderInfoByNumberThree(order_number string) (order []*models.HisOrder
1871 1871
 	db = db.Joins("Join his_prescription_project as p  On p.id = his_order_info.project_id AND p.team_id > 0")
1872 1872
 
1873 1873
 	db = db.Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
1874
-		return db.Preload("XtHisProjectTeam", "status = 1").Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
1874
+		return db.Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("status = 1")
1875 1875
 	})
1876 1876
 	err = db.Where("his_order_info.order_number = ? AND his_order_info.status = 1 AND his_order_info.project_id > 0", order_number).Find(&order).Error
1877 1877
 	return

+ 13 - 0
service/patient_dataconfig_service.go View File

@@ -133,3 +133,16 @@ func DeletePatientPhysiqueCheckInBatch(orgID int64, patientID int64, recordIDs [
133 133
 	err := writeDb.Model(&models.XtPatientPhysiqueCheck{}).Where("org_id = ? and patient_id = ? and id in (?) and status = 1", orgID, patientID, recordIDs).Updates(map[string]interface{}{"status": 2, "mtime": time.Now().Unix()}).Error
134 134
 	return err
135 135
 }
136
+
137
+func GetFaPiaoPatientByID(orgID int64, patientID int64) (*models.Patients, error) {
138
+	var patient models.Patients
139
+	err := readDb.Model(&models.Patients{}).Where("id = ? and user_org_id=? and status=1", patientID, orgID).First(&patient).Error
140
+	if err != nil {
141
+		if err == gorm.ErrRecordNotFound {
142
+			return nil, nil
143
+		} else {
144
+			return nil, err
145
+		}
146
+	}
147
+	return &patient, nil
148
+}